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 -2.log(L-hat) + 2.log(L_sat), where L-hat 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-over-w ( n_w log (n_w / n) - log (n_w !)))

Full likelihood, Poisson n -

L_sat = nlog(n) - n + sum-over-w [n_w log (n_w / n) - log (n_w !)]

Full likelihood, binomial n -

L_sat = nlog(n/N) + (N-n)log((N-n)/N) + log(N!/(N-n)!) + sum-over-w [n_w log (n_w/n) - log (n_w!)]

n is the number of individuals observed at least once, n_w is the number of distinct histories, and N is the number in a chosen area A that we estimate by N-hat = D-hat.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-square with n_w - 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



Want to suggest features or report bugs for Use the GitHub issue tracker. Vote for new features on Trello.

comments powered by Disqus