deviance.secr: Deviance of fitted secr model and residual degrees of freedom

devianceR Documentation

Deviance of fitted secr model and residual degrees of freedom


Compute the deviance or residual degrees of freedom of a fitted secr model, treating multiple sessions and groups as independent. The likelihood of the saturated model depends on whether the ‘conditional’ or ‘full’ form was used, and on the distribution chosen for the number of individuals observed (Poisson or binomial).


## S3 method for class 'secr'
deviance(object, ...)
## S3 method for class 'secr'
df.residual(object, ...)



secr object from


other arguments (not used)


The deviance is -2log(\hat{L}) + 2log(L_{sat}), where \hat{L} is the value of the log-likelihood evaluated at its maximum, and L_{sat} is the log-likelihood of the saturated model, calculated thus:

Likelihood conditional on n -

L_{sat} = \log(n!) + \sum\limits _{\omega} [n_\omega \log (\frac{n_\omega}{n}) - \log (n_\omega !)]

Full likelihood, Poisson n -

L_{sat} = n\log(n) - n + \sum\limits _{\omega} [n_\omega \log (\frac{n_\omega}{n}) - \log (n_\omega !)]

Full likelihood, binomial n -

L_{sat} = n\log(\frac{n}{N}) + (N-n)\log(\frac{N-n}{N}) + \log (\frac{N!}{(N-n)!}) + \sum\limits _{\omega} [n_\omega \log (\frac{n_\omega}{n}) - \log (n_\omega !)]

n is the number of individuals observed at least once, n_\omega is the number of distinct histories, and N is the number in a chosen area A that we estimate by \hat{N} = \hat{D}A.

The residual degrees of freedom is the number of distinct detection histories minus the number of parameters estimated. The detection histories of two animals are always considered distinct if they belong to different groups.

When samples are (very) large the deviance is expected to be distributed as \chi^2 with n_\omega - p degrees of freedom when p parameters are estimated. In reality, simulation is needed to assess whether a given value of the deviance indicates a satisfactory fit, or to estimate the overdispersion parameter c. sim.secr is a convenient tool.


The scalar numeric value of the deviance or the residual degress of freedom extracted from the fitted model.


Borchers, D. L. and Efford, M. G. (2008) Spatially explicit maximum likelihood methods for capture–recapture studies. Biometrics 64, 377–385.

See Also, sim.secr



secr documentation built on Oct. 18, 2023, 1:07 a.m.