I noted a very large memory overhead in the simulate.res.S helper function.
The function calls:
many.obj = list(obj)[rep(1, n.res)]
This create many lists of the same stackedsdm object.
Unfortunately the LM and GLM models have quite a large memory foot print - and so if you working with 1000's of samples and 1000's of species then memory requirements become enormous in this step you in effect multiple the memory usage by the number of simulations.
I propose you run the following instead:
res = lapply(1:n.res,function(x) residuals(obj))
This achieves the desired outcome to produce the residuals but without the unnecessary memory usage.
Hey guys
I noted a very large memory overhead in the simulate.res.S helper function.
The function calls:
many.obj = list(obj)[rep(1, n.res)]
This create many lists of the same stackedsdm object. Unfortunately the LM and GLM models have quite a large memory foot print - and so if you working with 1000's of samples and 1000's of species then memory requirements become enormous in this step you in effect multiple the memory usage by the number of simulations. I propose you run the following instead:res = lapply(1:n.res,function(x) residuals(obj))
This achieves the desired outcome to produce the residuals but without the unnecessary memory usage.Cheers, Chris