Re: Regressions in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg91961] Re: Regressions in Mathematica
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Mon, 15 Sep 2008 03:40:44 -0400 (EDT)
On 9/13/08 at 5:54 AM, gregory.lypny at videotron.ca (Gregory Lypny) wrote: >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. The syntax is Regress[data, basisFunctionList, independentVariableList] So with two independent variables you would do: Regress[data, {1, x, y^2}, {x, y}] where I am fitting the model a + b x + c y^2 to the data. The list of variables in the third argument needs to list them in order they appear in data.