linear models

Andreas Weingessel Andreas.Weingessel@ci.tuwien.ac.at
Tue, 3 Feb 1998 09:10:42 +0100


How can I use linear model regression for more than 1 dependent (response=
)
variable?

In S it is possible to do something like
S> x<-matrix(rnorm(300),100,3)
S> lm(x[,1:2]~x[,3])
to get

----------------------------------------------------------------------

Response: Y1=20
Call:
lm(formula =3D x[, 1:2] ~ x[, 3])

Coefficients:
 (Intercept)     x[, 3]=20
  0.02778965 -0.1081179

Degrees of freedom: 100 total; 98 residual
Residual standard error: 0.8294969=20

Response: Y2=20
Call:
lm(formula =3D x[, 1:2] ~ x[, 3])

Coefficients:
 (Intercept)     x[, 3]=20
  0.08045632 -0.1815675

Degrees of freedom: 100 total; 98 residual
Residual standard error: 1.081359=20

----------------------------------------------------------------------

This is not possible in R:

R> x<-matrix(rnorm(300),100,3)
R> lm(x[,1:2]~x[,3])
Error: dimnames: number of dimensions must equal number of names


	Andreas

************************************************************************
*                          Andreas Weingessel                          *
************************************************************************
* Institut f=FCr Statistik      *                Tel: (+43 1) 58801 4541 =
*
* Technische Universit=E4t Wien *                Fax: (+43 1)  504 14 98 =
*
* Wiedner Hauptstr. 8-10/1071 *     Andreas.Weingessel@ci.tuwien.ac.at *
* A-1040 Wien, Austria        * http://www.ci.tuwien.ac.at/~weingessel *
************************************************************************

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._