Romain Francois, Professional R Enthusiast - Tag - cplusplus - CommentsIndependant statistical/R consultant2013-03-24T15:53:22+01:00Romain Francoisurn:md5:2cdb21a695f56bfe2b31ee2133c51b42DotclearRcpp 0.8.0 - Annurn:md5:c55478b70cfd86528ad7065cccf1a1a02010-06-11T08:04:20+02:00Ann<p>Thanks for information!</p>Rcpp 0.7.2 - Vinhurn:md5:b7e6ae818a4cb4ddadced7d6bc53ff492010-01-14T17:05:23+01:00Vinh<p>Oh yes, I keep forgetting about lm.fit and glm.fit. I guess the only extra step would be model.matrix(), something along the line of:</p>
<p>fit <- lm.fit(y, x=model.matrix(y~ x1+...+xn), weights=myweights)</p>
<p>Anyhow, my hypothetical question is meant to see the benefits of calling R functions in Rcpp. I was lazy and wanted to know the added benefits without trying it myself =).</p>Rcpp 0.7.2 - Romain Francoisurn:md5:ffd0c1eb608406d71901a3ea7625a9f42010-01-14T10:29:50+01:00Romain Francois<p>Hi,</p>
<p>you might want to start with using the much faster lm.fit when doing simulations, it is a bit more work than just using lm or glm but it pays off.</p>
<p>For the speed, I don't know, it is worth a shot. Note that Rcpp has its <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" rel="nofollow">mailing list</a> where more people (at least one more) would be able to answer this. </p>
<p>Romain</p>Rcpp 0.7.2 - Vinhurn:md5:6406ae735505de6227b4cc8336cc40e42010-01-13T21:34:14+01:00Vinh<p>Wow this makes me look like I want to try out Rcpp as playing in C looks a lot simpler.</p>
<p>Out of curiosity, suppose I were to do a simulation with linear regression and record the coefficients and standard error. Would doing such a loop using Rcpp be a lot faster than the loop in R? That is, all the benefits of doing things in C are still there. I'm wondering because the linear regression function lm() is still being but in C instead of R now. Thanks!</p>
<p>Vinh</p>