I have a question about the fastLm example in the Gallery 
http://gallery.rcpp.org/articles/fast-linear-model-with-armadillo/. I put the 
code directly into my package (after renaming it fastLmProto so I don't mask 
the RcppArmadillo function by the same name). After building the package, I 
wanted to compare results:

 

> require(datasets)

> coef(lm(y1 ~ x1, data = anscombe))

(Intercept)          x1 

  3.0000909   0.5000909 

> coef(fastLmProto(anscombe$y1, as.matrix(anscombe$x1)))
          [,1]
[1,] 0.7968032
> coef(fastLm(anscombe$y1, as.matrix(anscombe$x1)))
[1] 1.208169

 

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?

 

I reviewed the RcppArmadillo documentation and the article 
http://dirk.eddelbuettel.com/papers/RcppArmadillo.pdf but could not find 
anything relevant.

 

Thanks,

Dale Smith, Ph.D.

Senior Financial Quantitative Analyst

Risk & Compliance

Fiserv

Office: 678-375-5315

www.fiserv.com <http://www.fiserv.com/> 

 

_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to