[R-sig-ME] glmmTMB: Get phi from dispersion model

John Maindonald john@m@|ndon@|d @end|ng |rom @nu@edu@@u
Wed Jan 13 09:53:27 CET 2021

If you specify  "dispformula=~1”, the output is the same as when a dispformula is not
specified.  Certainly, that is the case for models with a betabinomial error.  One can
extract phi as “phi=sigma(obj)

If you specify
a dispformula with >1 coefficients, then calculate either

  coef(HCbb.cll)[['disp’]]  ## Gives the coefficients
  coef(summary(HCbb.cll))[['disp’]]  ## Adds SE, etc, information

In both cases a logarithmic link function is used.

The following is a function that I have found useful:

getRho <-
function (obj)
    mm <- model.matrix(obj$modelInfo$allForm$dispformula, data = obj$frame)
    fixdisp <- fixef(obj)[["disp"]]
    1/(1 + exp(mm %*% fixdisp))

If you just want phi, rather than the intra-class correlation rho (which makes more
intuitive sense to me), just set “phi =  exp(mm %*% fixdisp)”.  I think this works
in just the same way with nbinom2 errors, but I have not checked the details.

John Maindonald             email: john.maindonald using anu.edu.au<mailto:john.maindonald using anu.edu.au>

On 13/01/2021, at 21:16, matthias.suter--- via R-sig-mixed-models <r-sig-mixed-models using r-project.org<mailto:r-sig-mixed-models using r-project.org>> wrote:

When fitting a negative binomial model in glmmTMB() using "family=nbinom2", but without specifying the dispersion model, the summary() gives an estimate for the dispersion parameter as "Overdispersion parameter for nbinom2 family (): XX", which represents - as far I understand - the phi value described in the manual (also termed theta in other environments).

If a dispersion model is specified with "dispformula=~ ...", the summary() gives the estimates for the "Dispersion model". How do these relate to the phi value? I read in the manual that "phi=exp(eta) (where eta is the linear predictor from the dispersion model)". Does this indicate that these estimates of the Dispersion model appear on the log scale, and to get phi, they must be back-transformed?

[[alternative HTML version deleted]]

R-sig-mixed-models using r-project.org<mailto:R-sig-mixed-models using r-project.org> mailing list

	[[alternative HTML version deleted]]

More information about the R-sig-mixed-models mailing list