LinearIVGMM.calc_weightmatrix()

statsmodels.sandbox.regression.gmm.LinearIVGMM.calc_weightmatrix LinearIVGMM.calc_weightmatrix(moms, weights_method='cov', wargs=(), params=None) calculate omega or the weighting matrix Parameters: moms : array, (nobs, nmoms) moment conditions for all observations evaluated at a parameter value weights_method : string ?cov? If method=?cov? is cov then the matrix is calculated as simple covariance of the moment conditions. see fit method for available aoptions for the weight and covarianc

Models for Survival and Duration Analysis

Models for Survival and Duration Analysis Examples import statsmodels.api as sm import statsmodels.formula.api as smf data = sm.datasets.get_rdataset("flchain", "survival").data del data["chapter"] data = data.dropna() data["lam"] = data["lambda"] data["female"] = (data["sex"] == "F").astype(int) data["year"] = data["sample.yr"] - min(data["sample.yr"]) status = data["death"].values mod = smf.phreg("futime ~ 0 + age + female + creatinine + " "np.sqrt(kappa) + np.sqrt(lam) + y

InverseGaussian.predict()

statsmodels.genmod.families.family.InverseGaussian.predict InverseGaussian.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.

Maximum Likelihood Estimation (Generic models)

Maximum Likelihood Estimation (Generic models) Link to Notebook GitHub This tutorial explains how to quickly implement new maximum likelihood models in statsmodels. We give two examples: Probit model for binary dependent variables Negative binomial model for count data The GenericLikelihoodModel class eases the process by providing tools such as automatic numeric differentiation and a unified interface to scipy optimization functions. Using statsmodels, users can fit new MLE models simply

IVGMM.gradient_momcond()

statsmodels.sandbox.regression.gmm.IVGMM.gradient_momcond IVGMM.gradient_momcond(params, epsilon=0.0001, centered=True) gradient of moment conditions Parameters: params : ndarray parameter at which the moment conditions are evaluated epsilon : float stepsize for finite difference calculation centered : bool This refers to the finite difference calculation. If centered is true, then the centered finite difference calculation is used. Otherwise the one-sided forward differences are used.

genmod.cov_struct.Exchangeable

statsmodels.genmod.cov_struct.Exchangeable class statsmodels.genmod.cov_struct.Exchangeable [source] An exchangeable working dependence structure. Methods covariance_matrix(expval, index) Returns the working covariance or correlation matrix for a given cluster of data. covariance_matrix_solve(expval, index, ...) Solves matrix equations of the form covmat * soln = rhs and returns the values of soln, where covmat is the covariance matrix represented by this class. initialize(model) Called b

NegativeBinomialResults.initialize()

statsmodels.discrete.discrete_model.NegativeBinomialResults.initialize NegativeBinomialResults.initialize(model, params, **kwd)

static ProbPlot.sample_percentiles()

statsmodels.graphics.gofplots.ProbPlot.sample_percentiles static ProbPlot.sample_percentiles() [source]

Poisson.predict()

statsmodels.genmod.families.family.Poisson.predict Poisson.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.

Probit.cov_params_func_l1()

statsmodels.discrete.discrete_model.Probit.cov_params_func_l1 Probit.cov_params_func_l1(likelihood_model, xopt, retvals) Computes cov_params on a reduced parameter space corresponding to the nonzero parameters resulting from the l1 regularized fit. Returns a full cov_params matrix, with entries corresponding to zero?d values set to np.nan.