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)

Best regards,
Jorge

On Thu, Dec 24, 2009 at 12: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@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.
>

	[[alternative HTML version deleted]]


