Skip to content

Error with add_ci() fed with a glmer(...,family=Gamma) model #44

@NicolasDeguines

Description

@NicolasDeguines

Dear John,

I am running GLMM models with family=Gamma and I want to use add_ci() to compute confidence intervals around predictions (many thanks for developing this by the way).
Unfortunately, add_ci() often encounters the following error:
Error in quantile.default(newX[, i], ...) : missing values and NaN's not allowed if 'na.rm' is FALSE

often but not always; I can re-run add_ci() and it might fail or not.

And it seems to be associated with this type of warning message:
In lme4::bootMer(fit, my_pred, nsim = nSims, type = "parametric", : some bootstrap runs failed (1/100)

Here is the code I’m running:
modfinal<-glmer(cumulative_duration ~ winter + month + s_cumul_dura_small + big_treat + (1 | id_first_feederpair), data=data_FRICOE, family = Gamma(link = "log")),
with cumulative_duration being the time (in seconds) spent by the common chaffinch (Fringilla coelebs) on a feeder.

newdatpred <- expand.grid(winter=as.factor("4")
,month=as.factor("Jan")
,s_cumul_dura_small=0
,big_treat=as.factor(c("NONE","PICPIC"))
,id_first_feederpair=as.factor("0060564"))

add_ci(newdatpred,modfinal,alpha=0.01,response=T,includeRanef=F,type="boot",nSims=100,names=c("lowBCI","uppBCI"))
(Note: nSims set to 100 for speed reason, but planning on using 1000 for final results)

I hope I'm giving enough useful details on this. I'm happy to share more as needed.
I attach the data table data_FRICOE.txt if it can help reproduce this error (several runs of add_ci() might be required given it does not always yield this error)
data_FRICOE.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions