[Rcpp-devel] [rcpp-devel] Rcpp Gallery Example fastLm vs R native lm

Dirk Eddelbuettel edd at debian.org
Thu Mar 21 17:52:01 CET 2013


On 21 March 2013 at 10:55, Hadley Wickham wrote:
| > Should I expect the results to match? Why do fastLmProto and fastLm produce
| > a single fitted parameter (I would expect two)? Why are they different? Am I
| > doing something wrong here, or just being naïve in my assumptions?
| 
| Hint:
| 
| > coef(lm(y1 ~ x1 - 1, data = anscombe))
|        x1
| 0.7968032

Also the Gallery article may not be the most exhaustive reference -- are you
aware that the packages

    RcppArmadillo

    RcppEigen

    RcppGSL

all carry fastLm implementations with and with formula interface?  Some of
these also have timing benchmark examples.

Another hint:  If you care about speed, do NOT use the formula interface.

I have factored out the Arma version (from RcppArmadillo/src/fastLm.cpp and
the related R file) a few times.

Hope this help,  Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com  


More information about the Rcpp-devel mailing list