I an trying to perform a multivariate linear regression in R.
I have two dependent variables (outcomes) and one independent variable (predictor). The model would be something like:
y1,y2~x
I did not find any way to implement this in R. Any help?
I an trying to perform a multivariate linear regression in R.
I have two dependent variables (outcomes) and one independent variable (predictor). The model would be something like:
y1,y2~x
I did not find any way to implement this in R. Any help?
lm can do that:
> y<-matrix(rnorm(100*2),100,2)
> x<-rnorm(100)
> lm(y~x)
Call:
lm(formula = y ~ x)
Coefficients:
[,1] [,2]
(Intercept) -0.18837 0.01386
x 0.25135 0.04769
A Multivariate Response model could be more accurate and powerful than 2 Univariate response model because it will use the correlation between the 2 or more dependent variables to improve the prediction on each of the dependent variable. A complete description of existing methods and a new approach are described in this paper by Breiman and Friedman (2002). However I haven't tried them with R yet. I found the article available for free download here http://onlinelibrary.wiley.com/doi/10.1111/1467-9868.00054/pdf
y1~xandy2~x? – whuber Nov 25 '12 at 21:11