Re: [R] how to do multiple responses in a linear regression

2009-12-24 Thread Benilton Carvalho
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 res

Re: [R] how to do multiple responses in a linear regression

2009-12-24 Thread Jorge Ivan Velez
Dear Jeff, Take a look at the following example. It may get you started. # Some data set.seed(123) x1 <- rnorm(100) x2 <- runif(100) x3 <- rpois(100, 2) er <- rnorm(100) y1 <- 3 + 2*x1 + .5*x2 + x3 + er y2 <- 1 + .5*x1 + 3*x2 + .2*x3 + er # model m <- lm(cbind(y1, y2) ~ x1 + x2 + x3) summary(m)

[R] how to do multiple responses in a linear regression

2009-12-24 Thread Hao Cen
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 ___