statsmodels.genmod.families.family.Family.deviance¶
-
Family.
deviance
(endog, mu, var_weights=1.0, freq_weights=1.0, scale=1.0)[source]¶ The deviance function evaluated at (endog, mu, var_weights, freq_weights, scale) for the distribution.
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.
- var_weights (array-like) – 1d array of variance (analytic) weights. The default is 1.
- 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 – The value of deviance function defined below.
Return type: array
Notes
Deviance is defined
D=2∑i(freq_weightsi∗var_weights∗(llf(endogi,endogi)−llf(endogi,μi)))where y is the endogenous variable. The deviance functions are analytically defined for each family.
Internally, we calculate deviance as:
D=∑ifreq_weightsi∗var_weights∗resid_devi/scale