[R] Problems with lm()
Daniel Malter
daniel at umd.edu
Tue Jul 8 02:42:32 CEST 2008
If that is so, i.e. x1=-x2, then they do not convey different meaning and
cannot be estimated. Think about it that way you leave the house 8 hours
after midnight. This is identical to saying that you leave the house 16
hours before midnight. This conveys the exact (!) same information and
neither measure is better than the other. Therefore you do not gain anything
by including both. You need variation in the measures so that both can be
meaningfully estimates. Be aware though that even if there is variation, but
when this variation is marginal, then your model may suffer from
"multicollinearity" and you may find "weird" results (e.g. unexpected,
"crazy" coefficients; "wrong" signs on your coefficients; insignificance
when you would expect significance). Then excluding one of the regressors
may still be necessary because despite their variation (i.e. x1 is slightly
different from -x2), the difference in information convey by them is
marginal. Multicollinearity violates the model assumptions of OLS.
http://en.wikipedia.org/wiki/Multicollinearity
Cheers,
Daniel
-------------------------
cuncta stricte discussurus
-------------------------
-----Ursprüngliche Nachricht-----
Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Im
Auftrag von Chibisi Chima-Okereke
Gesendet: Monday, July 07, 2008 8:09 PM
An: r-help at r-project.org
Betreff: [R] Problems with lm()
Dear all,
I am trying to fit a multiple linear regression model to a table of data. My
data.frame is like this ...
fit.data <- data.frame(y, x1, x2, x3, x4, x5, x6), then I use the linea
regression command ...
lm(formula = y ~ x1 + x2 + x3 + x4 + x5 + x6, data = fit.data)
however, for some tables the data in column x1 is equal to -x2, so I get NA
values for both coefficients of x1 and x2. I need to have real fitted
coefficients for all the parameters or the physical meaning of the
parameters is lost. Is there any way of forcing R to fit all the parameters?
I have seen the contrast option but I don't really understand it (I am not a
statistician) so I would be greatful if anyone could explain that.
Kind Regards
Chibisi
[[alternative HTML version deleted]]
______________________________________________
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