Re: Regressions in Mathematica

*To*: mathgroup at smc.vnet.net*Subject*: [mg92010] Re: Regressions in Mathematica*From*: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>*Date*: Tue, 16 Sep 2008 19:27:10 -0400 (EDT)*References*: <gag2m5$3a8$1@smc.vnet.net>

Hi, Needs["LinearRegression`"] tdata = Append[#, Times @@ #] & /@ Table[RandomReal[], {10}, {2}]; Regress[tdata, {1, x, y, x*y}, {x, y}] ?? Regards Jens 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 >