glmmTMB objects and residual plots

1,217 views
Skip to first unread message

Rosie Lennon

unread,
May 29, 2018, 9:15:23 AM5/29/18
to TMB Users
Hi, 

I have been trying to find a function that to create residual plots for several glmmTMB objects (approx size: 2.3Mb). I have tried:

residuals.glmmTMB() # function does not exist
simulate
() # only exists in bblme and does not recognise glmmTMB object
simulateResiduals
() # via DHARMa package, but glmmTMB object not recognised
plot
() # glmmTMB object not recognised
qqnorm
(resid(), main="normal qq-plot, residuals") # glmmTMB object not recognised
qqline
(resid()) # glmmTMB object not recognised

Either the function does not exist (TMB version 1.7.13, glmmTMB version 0.2.0, bblme version 1.0.20), or the glmmTMB object is not recognised with the error message: 

 Error in is.data.frame(data) : object 'x' not found

Apologies if this is a simple issue to fix, but I have not been able to find a solution on any forum I have come across. Does anyone know of an up to date function within glmmTMB that works?

Many thanks,
Rosie 

Koen van Benthem

unread,
May 29, 2018, 9:32:53 AM5/29/18
to Rosie Lennon, TMB Users
Dear Rosie,

on my machine the following code runs and seems to return the residuals:
m1 <- glmmTMB(count~ mined + (1|site), zi=~mined, family=poisson, data=Salamanders)
residuals(m1)

If you  want to explicitly force the usage of the glmmTMB function, you could try:
glmmTMB:::residuals.glmmTMB(m1)

I hope this helps.

Best,

Koen



--
To post to this group, send email to us...@tmb-project.org. Before posting, please check the wiki and issuetracker at https://github.com/kaskr/adcomp/. Please try to create a simple repeatable example to go with your question (e.g issues 154, 134, 51). Use the issuetracker to report bugs.
---
You received this message because you are subscribed to the Google Groups "TMB Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmb-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tmb-users/387d2dc0-bd94-4cad-a55a-a63b9aec905e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mollie Brooks

unread,
May 29, 2018, 9:36:16 AM5/29/18
to Koen van Benthem, Rosie Lennon, TMB Users
Hi Rosie,

Newer versions of DHARMa can handle glmmTMB. There is a discussion here 
You probably also need to update glmmTMB.

simulateResiduals() can be a bit slow with large data sets, but it works.

This is more of a question for the R-sig-mixed list. 

cheers,
Mollie


To unsubscribe from this group and stop receiving emails from it, send an email to tmb-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tmb-users/CAAEMPO59H5o5YyPn7kFahNv7ZtKtDFwZCUtN3ERcnFG8%3Dw%2BKSw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages