statsmodels.base.model.GenericLikelihoodModel¶

class statsmodels.base.model.GenericLikelihoodModel(endog, exog=None, loglike=None, score=None, hessian=None, missing='none', extra_params_names=None, **kwds)[source]

Allows the fitting of any likelihood function via maximum likelihood.

A subclass needs to specify at least the log-likelihood If the log-likelihood is specified for each observation, then results that require the Jacobian will be available. (The other case is not tested yet.)

Notes

Optimization methods that require only a likelihood function are ‘nm’ and ‘powell’

Optimization methods that require a likelihood function and a score/gradient are ‘bfgs’, ‘cg’, and ‘ncg’. A function to compute the Hessian is optional for ‘ncg’.

Optimization method that require a likelihood function, a score/gradient, and a Hessian is ‘newton’

If they are not overwritten by a subclass, then numerical gradient, Jacobian and Hessian of the log-likelihood are caclulated by numerical forward differentiation. This might results in some cases in precision problems, and the Hessian might not be positive definite. Even if the Hessian is not positive definite the covariance matrix of the parameter estimates based on the outer product of the Jacobian might still be valid.

Examples

 expandparams(params) expand to full parameter array when some parameters are fixed fit([start_params, method, maxiter, …]) Fit the model using maximum likelihood. from_formula(formula, data[, subset, drop_cols]) Create a Model from a formula and dataframe. hessian(params) Hessian of log-likelihood evaluated at params hessian_factor(params[, scale, observed]) Weights for calculating Hessian information(params) Fisher information matrix of model initialize() Initialize (possibly re-initialize) a Model instance. loglike(params) Log-likelihood of model. loglikeobs(params) nloglike(params) predict(params[, exog]) After a model has been fit predict returns the fitted values. reduceparams(params) score(params) Gradient of log-likelihood evaluated at params score_obs(params, **kwds) Jacobian/Gradient of log-likelihood evaluated at params for each observation.
 endog_names Names of endogenous variables exog_names Names of exogenous variables