MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Regressions in Mathematica

  • To: mathgroup at
  • Subject: [mg91932] Regressions in Mathematica
  • From: Gregory Lypny <gregory.lypny at>
  • Date: Sat, 13 Sep 2008 05:54:58 -0400 (EDT)

Hello everyone,

I'm having trouble understanding the syntax of the Regress command.   
If data is an nx2 matrix where the first column is the explanatory  
variable and the second is the dependent variable,  then either

	Regress[data, {1, x}, x]


	Regress[data, x, x]

performs a standard regression of the second column on the first with  
a constant thrown in.  But how do I write the command for the case of  
more than one explanatory variable?  Say that my data matrix is now  
nx3, so that the first two columns are the explanatory variables and  
the last is the dependent variable.

Regress[data, {x,x}, x] or Regress[data, {1, x,x}, x] gives the error  
message "Number of coordinates (2) is not equal to the number of  
variables (1)".  I'm not sure how I'm supposed to identify each  
explanatory variable.



  • Prev by Date: Re: How can you get the list of all used variables and functions
  • Next by Date: Functional programming?
  • Previous by thread: Re: eliminate values while caculating Mean[data]
  • Next by thread: Re: Regressions in Mathematica