From: Vivek Saxena on
Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote in message <897885874.433029.1269434001451.JavaMail.root(a)gallium.mathforum.org>...
> Say you have measurements
> (x_1)_i,...,(x_9)_i, y_i (i=1,...,n).
> Define a matrix A with n rows and 9 columns by
> A(i,j) = (x_j)_i (j=1,...,9 ; i=1,...,n))
> Define a vector b by
> b(i) = y_i (i=1,...,n).
> Then the MATLAB command
> gamma = A\b
> gives your regression coefficients gamma_j.
>
> Best wishes
> Torsten.

Torsten, that is not correct. The regression coefficients are solutions to the least square equation, not A^-1b. The latter approach is simply not applicable because of the presence of error in each measurement (statistical, not deterministic).
From: Torsten Hennig on
> Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote
> in message
> <897885874.433029.1269434001451.JavaMail.root(a)gallium.
> mathforum.org>...
> > Say you have measurements
> > (x_1)_i,...,(x_9)_i, y_i (i=1,...,n).
> > Define a matrix A with n rows and 9 columns by
> > A(i,j) = (x_j)_i (j=1,...,9 ; i=1,...,n))
> > Define a vector b by
> > b(i) = y_i (i=1,...,n).
> > Then the MATLAB command
> > gamma = A\b
> > gives your regression coefficients gamma_j.
> >
> > Best wishes
> > Torsten.
>
> Torsten, that is not correct. The regression
> coefficients are solutions to the least square
> equation, not A^-1b. The latter approach is simply
> not applicable because of the presence of error in
> each measurement (statistical, not deterministic).

gamma = A\b
is the least-squares solution to the (overdetermíned)
linear system A*gamma = b.

Best wishes
Torsten.
From: Vivek Saxena on
Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote in message <911486177.433479.1269437740916.JavaMail.root(a)gallium.mathforum.org>...
> > Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote
> gamma = A\b
> is the least-squares solution to the (overdetermíned)
> linear system A*gamma = b.
>
> Best wishes
> Torsten.

Oh, isn't it just A^-1 b? Hmm, I didn't know. Thanks for pointing out. I use A\b for A^-1 b because MATLAB warns me if I use inv(A)*b. I didn't know its the least square solution.
From: dpb on
Vivek Saxena wrote:
....

> Oh, isn't it just A^-1 b? Hmm, I didn't know. ...

doc mldivide

--
From: Peter Perkins on
On 3/24/2010 8:43 AM, Vivek Saxena wrote:

> Thanks for your reply Peter. Usually when multicollinearity is to be
> detected and removed, one begins with a unit length model (centered and
> scaled), which contains no constant term. [At least that is what we have
> been taught.] Does MATLAB include a command for standardizing the
> regression model?

I don't know about "usually", but you can certainly call ZSCORES on your data before fittgin the regression. RIDGE, which does ridge regression, does this automatically for you, but not functions like REGRESS.


> Also, if the design matrix input to REGSTATS is of the form [x11, x12,
> ...; x21, x22, ...], how does REGSTATS know whether or not a constant
> term exists? You say that the estimated coefficients and their CIs are
> estimated correctly even when the model does not include an intercept.
> But, the models are entirely different in the two cases. How do I know
> that beta(1) is not an intercept, but the regression coefficient for x1?

Because REGSTATS does not take a design matrix as an input. It takes a data matrix, and it's the third input that determines how that is turned into a design matrix.

>> help regstats
REGSTATS Regression diagnostics for linear models.
[snip]
The optional input MODEL specifies how the design matrix is created
from DATA. The design matrix is the matrix of term values for each
observation. MODEL can be any of the following strings:

'linear' Constant and linear terms (the default)
'interaction' Constant, linear, and interaction terms
'quadratic' Constant, linear, interaction, and squared terms
'purequadratic' Constant, linear, and squared terms

Alternatively, MODEL can be a matrix of model terms accepted by the
X2FX function. See X2FX for a description of this matrix and for
a description of the order in which terms appear. You can use this
matrix to specify other models including ones without a constant term.

First  |  Prev  | 
Pages: 1 2
Prev: plot maple plot in matlab
Next: axis off + label