[R] Selecting variables in a multivariate regression
Edson Tirelli
ed.tirelli at gmail.com
Mon Apr 14 05:08:25 CEST 2014
I am quite new to R and I am having trouble figuring out how to select
variables in a multivariate linear regression in R. My google-fu also
did not find anything.
Pretend I have the following formulas:
P = aX + bY
Q = cZ + bY
I have a data frame with column P, Q, X, Y, Z and I need to find a, b and c.
If I do a simple multivariate regression:
result <- lm( cbind( P, Q ) ~ X + Y + Z - 1 )
It calculates a coefficient for "c" on P's regression and for "a" on
Q's regression.
If I calculate the regressions individually then "b" will be different
in each regression.
How can I select the variables to consider in a multivariate
regression? I.e., how do I tell R to ignore cZ when calculating P, and
ignore aX when calculating Q?
Thank you,
Edson
More information about the R-help
mailing list