IVGMMResults.predict()

statsmodels.sandbox.regression.gmm.IVGMMResults.predict IVGMMResults.predict(exog=None, transform=True, *args, **kwargs) Call self.model.predict with self.params as the first argument. Parameters: exog : array-like, optional The values for which you want to predict. transform : bool, optional If the model was fit via a formula, do you want to pass exog through the formula. Default is True. E.g., if you fit a model y ~ log(x1) + log(x2), and transform is True, then you can pass a data str

OLSResults.remove_data()

statsmodels.regression.linear_model.OLSResults.remove_data OLSResults.remove_data() remove data arrays, all nobs arrays from result and model This reduces the size of the instance, so it can be pickled with less memory. Currently tested for use with predict from an unpickled results and model instance. Warning Since data and some intermediate results have been removed calculating new statistics that require them will raise exceptions. The exception will occur the first time an attribute is

DescrStatsW.var_ddof()

statsmodels.stats.weightstats.DescrStatsW.var_ddof DescrStatsW.var_ddof(ddof=0) [source] variance of data given ddof Parameters: ddof : int, float degrees of freedom correction, independent of attribute ddof Returns: var : float, ndarray variance with denominator sum_weights - ddof

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

NonlinearIVGMM.fitgmm()

statsmodels.sandbox.regression.gmm.NonlinearIVGMM.fitgmm NonlinearIVGMM.fitgmm(start, weights=None, optim_method='bfgs', optim_args=None) estimate parameters using GMM Parameters: start : array_like starting values for minimization weights : array weighting matrix for moment conditions. If weights is None, then the identity matrix is used Returns: paramest : array estimated parameters Notes todo: add fixed parameter option, not here ??? uses scipy.optimize.fmin

graphics.functional.rainbowplot()

statsmodels.graphics.functional.rainbowplot statsmodels.graphics.functional.rainbowplot(data, xdata=None, depth=None, method='MBD', ax=None, cmap=None) [source] Create a rainbow plot for a set of curves. A rainbow plot contains line plots of all curves in the dataset, colored in order of functional depth. The median curve is shown in black. Parameters: data : sequence of ndarrays or 2-D ndarray The vectors of functions to create a functional boxplot from. If a sequence of 1-D arrays, these

PHRegResults.predict()

statsmodels.duration.hazard_regression.PHRegResults.predict PHRegResults.predict(endog=None, exog=None, strata=None, offset=None, pred_type='lhr') [source] Returns predicted values from the fitted proportional hazards regression model. Parameters: params : array-;like The proportional hazards model parameters. endog : array-like Duration (time) values at which the predictions are made. Only used if pred_type is either ?cumhaz? or ?surv?. If using model exog, defaults to model endog (time

NegativeBinomialResults.summary()

statsmodels.discrete.discrete_model.NegativeBinomialResults.summary NegativeBinomialResults.summary(yname=None, xname=None, title=None, alpha=0.05, yname_list=None) Summarize the Regression Results Parameters: yname : string, optional Default is y xname : list of strings, optional Default is var_## for ## in p the number of regressors title : string, optional Title for the top table. If not None, then this replaces the default title alpha : float significance level for the confidence

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.