MathGroup Archive 2008

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

Search the Archive

Re: Regressions in Mathematica

  • To: mathgroup at
  • Subject: [mg92010] Re: Regressions in Mathematica
  • From: Jens-Peer Kuska <kuska at>
  • Date: Tue, 16 Sep 2008 19:27:10 -0400 (EDT)
  • References: <gag2m5$3a8$>



tdata = Append[#, Times @@ #] & /@ Table[RandomReal[], {10}, {2}];

Regress[tdata, {1, x, y, x*y}, {x, y}]



Gregory Lypny wrote:
> 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]
> or
> 	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.
> Regards,
> 	Gregory

  • Prev by Date: Re: Apparent error integrating product of DiracDelta's
  • Next by Date: Re: Label style in PieChart?
  • Previous by thread: Re: Regressions in Mathematica
  • Next by thread: Functional programming?