2
$\begingroup$

I want to extract the predicted values from a gamm() whose coefficients have been averaged using the package MuMIn, but I'm getting an error.

library(mgcv)
library(MuMIn)
set.seed(0)
dat <- gamSim(6, n = 100, scale = 5, dist = "normal")
fmm1 <- uGamm(y ~s(x0)+ s(x3) + s(x2), family = gaussian, data = dat, random = list(fac = ~1))

dredge(fmm1)->sel
confset.95p <- get.models (sel, cumsum(weight) <= .95)
avgmod<- model.avg(confset.95p) # 

pred <- predict (avgmod, type="link", backtransform= TRUE)


Error in predict.averaging(avgmod, type = "link", backtransform = TRUE) : 
  'predict' for models '3', '7' and '4' caused errors
In addition: Warning messages:
1: In UseMethod("predict") :
  no applicable method for 'predict' applied to an object of class "c('gamm', 'list')"
2: In UseMethod("predict") :
  no applicable method for 'predict' applied to an object of class "c('gamm', 'list')"
3: In UseMethod("predict") :
  no applicable method for 'predict' applied to an object of class "c('gamm', 'list')"

From the error message it appears I am doing more than one thing wrong. Can anyone help understand this? Thanks

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.