MultinomialModel.hessian()

statsmodels.discrete.discrete_model.MultinomialModel.hessian MultinomialModel.hessian(params) The Hessian matrix of the model

MultinomialModel.fit()

statsmodels.discrete.discrete_model.MultinomialModel.fit MultinomialModel.fit(start_params=None, method='newton', maxiter=35, full_output=1, disp=1, callback=None, **kwargs) [source] Fit the model using maximum likelihood. The rest of the docstring is from statsmodels.base.model.LikelihoodModel.fit Fit method for likelihood based models Parameters: start_params : array-like, optional Initial guess of the solution for the loglikelihood maximization. The default is an array of zeros. method

MultinomialModel.fit_regularized()

statsmodels.discrete.discrete_model.MultinomialModel.fit_regularized MultinomialModel.fit_regularized(start_params=None, method='l1', maxiter='defined_by_method', full_output=1, disp=1, callback=None, alpha=0, trim_mode='auto', auto_trim_tol=0.01, size_trim_tol=0.0001, qc_tol=0.03, **kwargs) [source] Fit the model using a regularized maximum likelihood. The regularization method AND the solver used is determined by the argument method. Parameters: start_params : array-like, optional Initia

MultinomialModel.cov_params_func_l1()

statsmodels.discrete.discrete_model.MultinomialModel.cov_params_func_l1 MultinomialModel.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.

MultinomialModel.cdf()

statsmodels.discrete.discrete_model.MultinomialModel.cdf MultinomialModel.cdf(X) The cumulative distribution function of the model.

MultiComparison.tukeyhsd()

statsmodels.sandbox.stats.multicomp.MultiComparison.tukeyhsd MultiComparison.tukeyhsd(alpha=0.05) [source] Tukey?s range test to compare means of all pairs of groups Parameters: alpha : float, optional Value of FWER at which to calculate HSD. Returns: results : TukeyHSDResults instance A results class containing relevant data and some post-hoc calculations

MultiComparison.allpairtest()

statsmodels.sandbox.stats.multicomp.MultiComparison.allpairtest MultiComparison.allpairtest(testfunc, alpha=0.05, method='bonf', pvalidx=1) [source] run a pairwise test on all pairs with multiple test correction The statistical test given in testfunc is calculated for all pairs and the p-values are adjusted by methods in multipletests. The p-value correction is generic and based only on the p-values, and does not take any special structure of the hypotheses into account. Parameters: testfun

MultiComparison.getranks()

statsmodels.sandbox.stats.multicomp.MultiComparison.getranks MultiComparison.getranks() [source] convert data to rankdata and attach This creates rankdata as it is used for non-parametric tests, where in the case of ties the average rank is assigned.

MultiComparison.kruskal()

statsmodels.sandbox.stats.multicomp.MultiComparison.kruskal MultiComparison.kruskal(pairs=None, multimethod='T') [source] pairwise comparison for kruskal-wallis test This is just a reimplementation of scipy.stats.kruskal and does not yet use a multiple comparison correction.

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