stripHLfit {spaMM} | R Documentation |
Reduce the size of fitted objects
Description
Large matrices and other memory-expensive objects may be stored in a fit object. This function removes them in order to reduce the size of the object, particularly when stored on disk. In principle, the removed objects can be regenerated automatically when needed (e.g., for a predict()).
Usage
stripHLfit(object, ...)
Arguments
object |
The result of a fit (an object of class |
... |
Further arguments, not currently used. |
Value
The input fit objects with some elements removed.
Note
The effect may change without notice between versions as the efficiency of the operation is highly sensitive to implementation details.
Examples
## Not run:
## rather unconvincing example : quantitative effect is small.
# measure size of saved object:
saveSize <- function (object,...) {
tf <- tempfile(fileext = ".RData")
on.exit(unlink(tf))
save(object, file = tf,...)
file.size(tf)
}
data("Loaloa")
lfit <- fitme(cbind(npos,ntot-npos)~elev1+elev2+elev3+elev4+maxNDVI1+seNDVI
+Matern(1|longitude+latitude), method="HL(0,1)",
data=Loaloa, family=binomial(), fixed=list(nu=0.5,rho=1,lambda=0.5))
saveSize(lfit)
pfit <- predict(lfit,newdata=Loaloa,variances=list(cov=TRUE)) # increases size!
saveSize(lfit)
lfit <- stripHLfit(lfit)
saveSize(lfit)
## End(Not run)
[Package spaMM version 4.5.0 Index]