[R] Lm gives different results depending on x-bit architecture
AdamMarczak
adam.marczak at gmail.com
Mon Aug 29 13:54:58 CEST 2011
Dear all,
I have encountered problem when developing application. My linear regression
does give different results depending on architecture.
Following example describes my problem perfectly.
xxx <- data.frame(a=c(0.2,0.2,0.2,0.2,0.2),b=c(7,8,9,10,11))
lm(a~b,xxx)
summary(lm(a~b,xxx))$r.squared
returns on 32-bit R:
Call:
lm(formula = a ~ b, data = xxx)
Coefficients:
(Intercept) b
2.000e-01 -1.503e-18
>summary(lm(a~b,xxx))$r.squared
[1] 0
and on 64-bit R:
Call:
lm(formula = a ~ b, data = xxx)
Coefficients:
(Intercept) b
2.0e-01 0
>summary(lm(a~b,xxx))$r.squared
[1] NA
It is very easy to notice slope should be 0 in the above case. I also
understand it is related to the precision of 32 and 64 bit and dependant on
how those are internally written, but maybe someone had this problem and
found any solution.
With regards,
Adam.
--
View this message in context: http://r.789695.n4.nabble.com/Lm-gives-different-results-depending-on-x-bit-architecture-tp3776027p3776027.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list