# Re: [R] Problems with lm()

From: Daniel Malter <daniel_at_umd.edu>
Date: Mon, 07 Jul 2008 20:42:32 -0400

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.

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.

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. Received on Tue 08 Jul 2008 - 00:46:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 08 Jul 2008 - 11:31:09 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.