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

RiGui raluca.gui at business.uzh.ch
Tue Mar 31 14:10:33 CEST 2015


I found a fix to my problem using the fastLm() from package RcppEigen, using
the Jacobi singular value decomposition (SVD) (method 4) or a method based
on the eigenvalue-eigenvector decomposition of X'X - method 5 of the fastLm
function



install.packages("RcppEigen")
library(RcppEigen)

n_obs <- 1500
y  <- rnorm(n_obs, 10,2.89)
x1 <- rnorm(n_obs, 0.00000000000001235657,0.000000000000000045)
x2 <- rnorm(n_obs, 10,3.21)
X  <- cbind(x1,x2)



bFE <- fastLm(y ~ x1 + x2, method =4)
bFE

Call:
fastLm.formula(formula = y ~ x1 + x2, method = 4)

Coefficients:
        (Intercept)                  x1                  x2 
9.94832839474159414 0.00000000000012293 0.00440078989949841 


Best,

Raluca





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



More information about the R-help mailing list