Last night I started a complex calculation with gamm() and it took me...
user system elapsed 9259.76 326.05 9622.64 (s)
...meaning it took me 160 minutes or 2.67 hours for that calculation. The problem is that I have to do around 50 or even 100 more of these! So I was wondering if there is any way that could speed up these calculations. I compared the 32bit with the 64bit version (4gb) and R 2.12.2 to calculate a less complex gamm().
32bit solution
User System elapsed 41.87 0.01 42.0164 bit solution
User System elapsed 40.06 2.82 43.05
but it took even longer using 64bit!
My question now:
Would it help to simply buy more ram, for example 8GB DDR3? or would that be a waste of money? Or would the compiler package in R 2.13.0 be able to handle that properly? I do not think that rcpp can handle gamm() functions, or am I wrong?
any comments welcome!
the gamm() model call for the 160min process was:
g1 <- gamm(CountPP10M ~ s(tempsurf,bs="cr")
+ s(salsurf,bs="cr")
+ s(speedsurf,bs="cr")
+ s(Usurf,bs="cr")
+ s(Vsurf,bs="cr")
+ s(Wsurf,bs="cr")
+ s(water_depth,bs="cr")
+ s(distance.to.bridge,bs="cr")
+ s(dist_land2,bs="cr")
+ s(Dist_sventa,bs="cr"),
data=data,
random=list(ID_Station=~1),
family=poisson,
methods="REML",
control=lmc)
)
rcppis a package that allows easy wrapping/integration of C++ code within R and writing of C++ that exploits R object structures etc. gamm() is already coded in C. Yes it could be made faster (hence the gamm4 package which uses lme4 which is much faster at the mixed model computations than nlme was/is), but you can't make it faster using rcpp without rewriting the entire model in your own C++ using the C++ classes/API that rcpp provides. The help for gamm does warn you that you are stressing the computational ability of the code and your machine when fitting even modestly sized models. – Gavin Simpson Jul 7 '11 at 10:10