Vote count: 0
I have found that predict function is curently not implemented in cummulative link mixed models fitted using clmm function in ordinal package. While predict is implemented for clmm2 in the same package, I choose to apply clmm instead because the later allows for more than one random effects. Further, I have also fitted several clmm models and have performed model averaging using model.avg function in MuMIn package. Idealy, I want to predic probabilities using the average model. However, while MuMIn supports clmm models, predict will also not work with the average model.
Is there a hack (or a way to) of a predict function that could not only predict probabilities from a clmm model, but that can also predict using model averaged coefficiets from clmm (i.e. object of class "averaging")?
require(ordinal)
require(MuMIn)
mm1 <- clmm(SURENESS ~ PROD + (1|RESP) + (1|RESP:PROD), data = soup,
link = "probit", threshold = "equidistant")
## test random effect:
mm2 <- clmm(SURENESS ~ PROD + (1|RESP) + (1|RESP:PROD), data = soup,
link = "logistic", threshold = "equidistant")
#create a model selection object
mm.sel<-model.sel(mm1,mm2)
##perform a model average
mm.sel<-model.sel(mm1,mm2)
#create new data and predict
new.data<-soup
##predict with indivindual model
predict(mm1, new.data)
##Error message
In UseMethod("predict") :
no applicable method for `predict` applied to an object of class "clmm"
##predict with model average
predict(mm.avg, new.data)
##Error
Error in predict.averaging(mm.avg, new.data) :
`predict` for models 'mm1' and 'mm2' caused errors
Probability predictions with model averaged Cumulative Link Mixed Models fitted with clmm in ordinal package
Aucun commentaire:
Enregistrer un commentaire