Discussion:
[R-sig-ME] glmmTMB pearson residuals
Stephanie Rivest
2018-09-18 18:20:59 UTC
Permalink
Hello,

I am working with glmmTMB and have a question about calculating the pearson
residuals. Following the math laid out in Zuur et al. (2012) I can
understand how the following code works for models fit with the family
nbinom2:

v <- family(model)$variance
p <- predict(model,zitype="zprob") ## z-i probability
mu <- predict(model,zitype="conditional") ## mean of conditional
distribution
pred <- predict(model,zitype="response") ## (1-p)*mu
k <- sigma(m5) ## dispersion parameter
pvar <- (1-p)*v(mu,k)+mu^2*(p^2+p)
pearson_resid <- (data.frame$Response-pred)/sqrt(pvar)

What I am unsure about is how this changes if the family being used is
nbinom1?

For the poisson family, does the following code make sense for calculating
pearson resids?

p <- predict(model,zitype="zprob") ## z-i probability
mu <- predict(model,zitype="conditional") ## mean of conditional
distribution
pred <- predict(model,zitype="response") ## (1-p)*mu
pvar <- (1-p)*(mu + p*mu^2)
pearson_resid <- (data.frame$Response - pred) / sqrt(pvar)

Any help is greatly appreciated!

Stephanie Rivest
Ph.D. Candidate | Candidate au Doctorat
Dept. of Biology | Dép. de Biologie
University of Ottawa | Université d'Ottawa

[[alternative HTML version deleted]]

Loading...