statsmodels.genmod.families.family.Family.deviance

Family.deviance(endog, mu, freq_weights=1.0, scale=1.0)[source]

The deviance function evaluated at (endog,mu,freq_weights,mu).

Deviance is usually defined as twice the loglikelihood ratio.

Parameters:

endog : array-like

The endogenous response variable

mu : array-like

The inverse of the link function at the linear predicted values.

freq_weights : array-like

1d array of frequency weights. The default is 1.

scale : float, optional

An optional scale argument. The default is 1.

Returns:

Deviance : array

The value of deviance function defined below.

Notes

Deviance is defined

D = \sum_i (2 * freq\_weights_i * llf(Y_i, Y_i) - 2 *
    llf(Y_i, \mu_i)) / scale

where y is the endogenous variable. The deviance functions are analytically defined for each family.