statsmodels.genmod.families.family.Binomial.loglike_obs¶
-
Binomial.loglike_obs(endog, mu, var_weights=
1.0
, scale=1.0
)[source]¶ The log-likelihood function for each observation in terms of the fitted mean response for the Binomial distribution.
- Parameters:¶
- endog
ndarray
Usually the endogenous response variable.
- mu
ndarray
Usually but not always the fitted mean response variable.
- var_weightsarray_like
1d array of variance (analytic) weights. The default is 1.
- scale
float
The scale parameter. The default is 1.
- endog
- Returns:¶
- ll_i
float
The value of the loglikelihood evaluated at (endog, mu, var_weights, scale) as defined below.
- ll_i
Notes
If the endogenous variable is binary:
\[ll_i = \sum_i (y_i * \log(\mu_i/(1-\mu_i)) + \log(1-\mu_i)) * var\_weights_i\]If the endogenous variable is binomial:
\[ll_i = \sum_i var\_weights_i * (\ln \Gamma(n+1) - \ln \Gamma(y_i + 1) - \ln \Gamma(n_i - y_i +1) + y_i * \log(\mu_i / (n_i - \mu_i)) + n * \log(1 - \mu_i/n_i))\]where \(y_i = Y_i * n_i\) with \(Y_i\) and \(n_i\) as defined in Binomial initialize. This simply makes \(y_i\) the original number of successes.
Last update:
Nov 14, 2024