Skip to content

predict.glmmTMB when "cloglog" link is used.

4 messages · Rolf Turner, Mollie Brooks

#
Please consider the follow examples:

library(glmmTMB)
X <- dget("demoDat.txt")
fit1 <- glmmTMB(cbind(Dead,Alive) ~ (0+Trt)/Dose +
                 (Dose|Rep),family=binomial(link="logit"),data=X)
fit2 <- glmmTMB(cbind(Dead,Alive) ~ (0+Trt)/Dose +
                 (Dose|Rep),family=binomial(link="cloglog"),data=X)
p1 <- predict(fit1,type="response")
p2 <- predict(fit2,type="response")

The vector p1 appears to have "reasonable" entries i.e. they look (as 
they should) like probabilities:
0.998988370
The entries of p2 do not seem "reasonable".  In particular they all less 
than or equal to zero:
Am I misunderstanding something, or is there a bug in predict.glmmTMB? 
The data set in question is attached as "demoDat.txt".

Thanks for any enlightenment.

cheers,

Rolf Turner
#
Further remarks:

In an off-list message it was suggested to me that perhaps the value of 
p2 should be exponentiated.  Indeed p1 and exp(p2) are "reasonably 
similar".  I really don't understand how the necessity for 
exponentiation could arise, however.

When the "probit" link is used to fit the model, predict.glmmTMB() seems 
to work just fine.

I have stared a bit at the code for predict.glmmTMB() but the subtleties 
are too great for me to be able to figure out what is going on/wrong.

cheers,

Rolf Turner
On 22/03/20 9:01 pm, Rolf Turner wrote:
#
This sounds like a bug, but I can?t repeat the behavior. I get reasonable values in p2 and they look highly correlated to p1. Are you using the latest version from CRAN, 1.0.1? It should be essentially the same as the master branch on GitHub (only one vignette is behind). I can?t remember any recent changes (to either the CRAN or GitHub versions) that would make a difference, but updating is worth a try.

cheers,
Mollie
#
On 23/03/20 11:51 pm, Mollie Brooks wrote:

            
Turned out I was using version 1.0.0; I upgraded to 1.0.1 and the 
problem went away.

The key to the mystery may be that I was actually using the *patched* 
version that Ben Bolker had put up on github, which I installed via
Ben was trying to alleviate a problem that I'd encountered in trying to 
use glmmTMB() to fit models that involved the betabinomial family and 
the "cloglog" link.  Perhaps he buggered something up in attempting the 
fix (which turned out not to work anyway!).

Anyhow, predict.glmmTMB() now seems to work, at least.

Thanks.

cheers,

Rolf