[R] Error in lm() with very small (close to zero) regressor

RiGui raluca.gui at business.uzh.ch
Sun Mar 29 21:53:46 CEST 2015


RiGui <raluca.gui <at> business.uzh.ch> writes:

>

[snip]
 
> I am terribly sorry for the code not being reproducible, is the
> first time I am posting here, I run the code several times before I
> posted, but...I forgot about the library used.

  Thanks for updating.
 
> To answer to your questions:
> 
>> How do you know this answer is "correct"? 
 
> What I am doing is actually a "fixed effect" estimation. I apply a
> projection matrix to the data, both dependent and independent
> variables, projection which renders the regressors that do not vary,
> equal to basically zero - the x1 from the post.
 
> Once I apply the projection, I need to run OLS to get the estimates,
> so x1 should be zero.

  Yes, but not *exactly* zero.
 
> Therefore, the results with the scaled regressor is not correct. 
 
> Besides, I do not see why the bOLS is wrong, since is the formula of
> the OLS estimator from any Econometrics book.

" Because it's numerically unstable.
 Unfortunately, you can't always translate formulas directly from
books into code and expect them to be reliable.

  Based on Peter's comments, I believe that as expected lm()
is actually getting closer to the 'correct' answer.
"


Thank you to both of you for your comments! I will re-do the analysis
following your advice.

Best,

Raluca





--
View this message in context: http://r.789695.n4.nabble.com/Error-in-lm-with-very-small-close-to-zero-regressor-tp4705185p4705231.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list