Skip to content
Back to formatted view

Raw Message

Message-ID: <CAAYeMWGcg14Pug0D5kiz-DauZpM0DCVfOz7oJsLFvtw_0FhgTw@mail.gmail.com>
Date: 2018-09-18T18:20:59Z
From: Stephanie Rivest
Subject: glmmTMB pearson residuals

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]]