Re: [R] multivariate regression using R

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Fri 08 Jul 2005 - 08:35:10 EST

"Lusk, Jeffrey J" <jjlusk@purdue.edu> writes:

> Does anyone know if there is a way to run multivariate linear regression
> in R? I tried using the lm function (e.g., lm(dv1, dv2~iv1+iv2+iv3),
> but got error messages. Is my syntax wrong, or do I need a particular
> package?

You need a matrix response: lm(cbind(dv1,dv2)~iv1+iv2+iv3) should do. There is an anova() method for comparing the resulting "mlm" objects.

And yes, your syntax is wrong: you're calling lm with 2 arguments, dv1 and dv2~iv1+iv2+iv3.

-- 
   O__  ---- Peter Dalgaard             ุster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)                  FAX: (+45) 35327907

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Fri Jul 08 08:42:35 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:22 EST