I'm looking for the best way to do the following:
run a set of GAM models, and then make predictions with new data.
My problem is the size of the gam model object, I would like to strip it
down to the bare minimum of information needed to apply the model to new
data. For example, if this were a linear model, I would just keep the
betas. If this were an ordinary spline fit, I think I would just need the
coefficients and the basis generating function.
I've been looking at Chapter 5 (p243-247) in Wood (2006) "GAMs: An
Introduction with R", and I've been trying to understand what is needed
for
the smooth.construct and the predict.gam(type='lpmatrix') functions.
It's possible to generate a new prediction matrix with predict(gm, newdata,
type='lpmatrix), but the entire model object is needed as input. I looked
into it further, and the predict method (using type='lpmatrix") depends
on
the following model components:
object$model
object$terms
object$coefficients
object$contrasts
object$xlevels
object$pterms
object$nsdf
object$smooth
object$Xcentre
Stripping out the other object parts saves some space, but the
"smooth" part
seems to still be storing all the original data. Isn't there some way that
I can just use the coefficients?
Thanks,
Gene
[[alternative HTML version deleted]]