The update() function of R does not work with objects returned from the gamm4() function of the mgcv package.
Question: *Does anyone know of an equivalent way of updating gamm4 objects?
*
I have found a function called "uGamm" in the MuMIn package that is supposed to do this, but it does not seem to work either. Here is some example code:
This returns a gamm4 object:
temp<-gamm4::gamm4(X4~X3,random=~(1|group),data=sim_normal.with.nesting,family=gaussian)
#Now, run update:
update(temp,~.+X1)
The following error message is returned:
Error in update.default(temp, ~. + X1) : need an object with call component
#If I run uGamm, this is what happens:
uGamm(temp)
Error in gf[[1]][2] : object of type 'S4' is not subsettable
update()doesn't work because the object returned bygamm4::gamm4()(andmgcv::gamm()for that matter) is a list with the two faces of the GAMM$lmeror$lmecomponent for the mixed model face, and$gamfor the GAM faceThis object in an of itself doesn't have a
callcomponent and this can't be updated.I think the intended use is that you fit the GAMM with
uGamm()(notmgcv::gamm()orgamm4::gamm4()) and that the resulting object has a call that can be updated:Results in:
(Not that I think this kind of model selection is that useful; use
select = TRUEwithgam()for example...)