Tweedie.deviance(endog, mu, var_weights=1.0, freq_weights=1.0, scale=1.0)

The deviance function evaluated at (endog, mu, var_weights, freq_weights, scale) for the distribution.

Deviance is usually defined as twice the loglikelihood ratio.

  • 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.

Deviance – The value of deviance function defined below.

Return type:



Deviance is defined

\[D = 2\sum_i (freq\_weights_i * var\_weights * (llf(endog_i, endog_i) - llf(endog_i, \mu_i)))\]

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

Internally, we calculate deviance as:

\[D = \sum_i freq\_weights_i * var\_weights * resid\_dev_i / scale\]