[R] Help on making code faster-would C help ?

From: Benn Fine <bennfine_at_yahoo.com>
Date: Fri 21 Jul 2006 - 00:47:40 EST


Using R on windows....

I have the following code

for(i in 1:10000) {

draw some random weights

perfom a weighted least squares regression

some simple addition and multiplication
}

The code works fine but is slow.

I have mingw installed and can dyn.load, although I am more used to doing this on Unix than Windows.

Would it make sense to re-write the whole thing in C ? I am vectorizing the random draws-the speed culprit is looping and the matrix manipulations.

My guess is to use the matrix routines from gls-does this sound feasible ?

Thanks!



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri Jul 21 00:54:11 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 21 Jul 2006 - 02:20:14 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.