Displaying 1 result from an estimated 1 matches for "makelm".
2011 Jul 19
4
Randomness not due to seed
..._ reproduce an R object. However, I am experiencing
unexpected randomness in some calculations. I have a hard time finding out
exactly how it occurs. The code below illustrates the issue.
mylm1 <- lm(dist~speed, data=cars);
mylm2 <- lm(dist~speed, data=cars);
identical(mylm1, mylm2); #TRUE
makelm <- function(){
return(lm(dist~speed, data=cars));
}
mylm1 <- makelm();
mylm2 <- makelm();
identical(mylm1, mylm2); #FALSE
When inspecting both objects there seem to be some rounding differences.
Setting a seed does not make a difference. Is there any way I can remove
this randomness and...