[R] lm for matrix of response...

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jun 11 07:51:07 CEST 2007


On Sun, 10 Jun 2007, vinod gullu wrote:

> Dear All,
> 1)Can I use lm() to fit more than one response in
> single expression. e.g data is a matrix of these
> variables
> R1 R2 R3  X Y Z
> 1 2 1 1 2 3
> ....
> Now i wnat to fit R1:R3 ~ X+Y+Z.

?lm says

      If 'response' is a matrix a linear model is fitted separately by
      least-squares to each column of the matrix.

so cbind(R1,R2,R3) ~ X+Y+Z

> 2) How can i use Singular Value decomposition (SVD) as
> an alternate to lsq.

See ?svd.

Note that SVD is not a model-fitting criterion, and can be used to fit by 
least squares.  If you mean something else, please study the posting guide 
and tell us precisely what you mean, with references.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list