NegativeBinomial.starting_mu()

statsmodels.genmod.families.family.NegativeBinomial.starting_mu NegativeBinomial.starting_mu(y) Starting value for mu in the IRLS algorithm. Parameters: y : array The untransformed response variable. Returns: mu_0 : array The first guess on the transformed response variable. Notes Only the Binomial family takes a different initial value.

NegativeBinomial.score_obs()

statsmodels.discrete.discrete_model.NegativeBinomial.score_obs NegativeBinomial.score_obs(params) [source]

NegativeBinomial.score()

statsmodels.discrete.discrete_model.NegativeBinomial.score NegativeBinomial.score(params) Score vector of model. The gradient of logL with respect to each parameter.

NegativeBinomial.resid_dev()

statsmodels.genmod.families.family.NegativeBinomial.resid_dev NegativeBinomial.resid_dev(endog, mu, scale=1.0) [source] Negative Binomial Deviance Residual Parameters: endog : array-like endog is the response variable mu : array-like mu is the fitted value of the model scale : float, optional An optional argument to divide the residuals by scale Returns: resid_dev : array The array of deviance residuals Notes resid_dev = sign(endog-mu) * sqrt(piecewise) where piecewise is defined

NegativeBinomial.resid_anscombe()

statsmodels.genmod.families.family.NegativeBinomial.resid_anscombe NegativeBinomial.resid_anscombe(endog, mu) [source] The Anscombe residuals for the negative binomial family Parameters: endog : array-like Endogenous response variable mu : array-like Fitted mean response variable Returns: resid_anscombe : array The Anscombe residuals as defined below. Notes resid_anscombe = (hyp2f1(-alpha*endog)-hyp2f1(-alpha*mu)+ 1.5*(endog**(2/3.)-mu**(2/3.)))/(mu+alpha*mu**2)**(1/6.) where hyp2f

NegativeBinomial.predict()

statsmodels.genmod.families.family.NegativeBinomial.predict NegativeBinomial.predict(mu) Linear predictors based on given mu values. Parameters: mu : array The mean response variables Returns: lin_pred : array Linear predictors based on the mean response variables. The value of the link function at the given mu.

NegativeBinomial.predict()

statsmodels.discrete.discrete_model.NegativeBinomial.predict NegativeBinomial.predict(params, exog=None, exposure=None, offset=None, linear=False) Predict response variable of a count model given exogenous variables. Notes If exposure is specified, then it will be logged by the method. The user does not need to log it first.

NegativeBinomial.pdf()

statsmodels.discrete.discrete_model.NegativeBinomial.pdf NegativeBinomial.pdf(X) The probability density (mass) function of the model.

NegativeBinomial.loglike()

statsmodels.genmod.families.family.NegativeBinomial.loglike NegativeBinomial.loglike(endog, lin_pred=None) [source] The loglikelihood function for the negative binomial family. Parameters: endog : array-like Endogenous response variable lin_pred : array-like The linear predictor of the model. This is dot(exog,params), plus the offset if present. Returns: llf : float The value of the loglikelihood function evaluated at (endog,mu,scale) as defined below. Notes sum(endog*log(alpha*exp

NegativeBinomial.loglike()

statsmodels.discrete.discrete_model.NegativeBinomial.loglike NegativeBinomial.loglike(params) [source] Loglikelihood for negative binomial model Parameters: params : array-like The parameters of the model. If loglike_method is nb1 or nb2, then the ancillary parameter is expected to be the last element. Returns: llf : float The loglikelihood value at params Notes Following notation in Greene (2008), with negative binomial heterogeneity parameter : where :math`Q=0` for NB2 and geome