[R] how to do multiple responses in a linear regression
Benilton Carvalho
bcarvalh at jhsph.edu
Thu Dec 24 18:40:55 CET 2009
you need to be more clear on your question...
what is it (exactly) that you want? Is it the following?
y1 ~ x1 + ... + xm
y2 ~ x1 + ... + xm
...
yn ~ x1 + ... + xm
?
if so:
lm(cbind(y1, y2, ..., yn) ~ x1+x2+...+xm)
b
On Dec 24, 2009, at 3:33 PM, Hao Cen wrote:
> Hi,
>
> I have multiple responses y1, y2, .., yn, and would like to do linear
> regression for each of them with x1, x2, ..., xm. Instead of doing
> regression n times, it it possible to do it all at once?
>
> I tried lm(y1+y2 ~ x1 + x2 + x3) and lm added y1 y2 and then did the
> regression.
>
> thanks
>
> Jeff
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list