Statsmodels Examples

Statsmodels Examples This page provides a series of examples, tutorials and recipes to help you get started with statsmodels. Each of the examples shown here is made available as an IPython Notebook and as a plain python script on the statsmodels github repository. If you are not comfortable with git, we also encourage users to submit their own examples, tutorials or cool statsmodels tricks to the Examples wiki page. Topics Linear Regression Models Plotting Discrete Choice Models Nonparamet

stats.sandwich_covariance.cov_hc1()

statsmodels.stats.sandwich_covariance.cov_hc1 statsmodels.stats.sandwich_covariance.cov_hc1(results) [source] See statsmodels.RegressionResults

static PHRegResults.weighted_covariate_averages()

statsmodels.duration.hazard_regression.PHRegResults.weighted_covariate_averages static PHRegResults.weighted_covariate_averages() [source] The average covariate values within the at-risk set at each event time point, weighted by hazard.

Summary.add_text()

statsmodels.iolib.summary2.Summary.add_text Summary.add_text(string) [source] Append a note to the bottom of the summary table. In ASCII tables, the note will be wrapped to table width. Notes are not indendented.

GLM.hessian()

statsmodels.genmod.generalized_linear_model.GLM.hessian GLM.hessian(params, scale=None, observed=True) [source] Hessian, second derivative of loglikelihood function Parameters: params : ndarray parameter at which Hessian is evaluated scale : None or float If scale is None, then the default scale will be calculated. Default scale is defined by self.scaletype and set in fit. If scale is not None, then it is used as a fixed scale. observed : bool If True, then the observed Hessian is retu

static MultinomialResults.prsquared()

statsmodels.discrete.discrete_model.MultinomialResults.prsquared static MultinomialResults.prsquared()

TrimmedMean.psi_deriv()

statsmodels.robust.norms.TrimmedMean.psi_deriv TrimmedMean.psi_deriv(z) [source] The derivative of least trimmed mean psi function Notes Used to estimate the robust covariance matrix.

TransfTwo_gen.freeze()

statsmodels.sandbox.distributions.transformed.TransfTwo_gen.freeze TransfTwo_gen.freeze(*args, **kwds) Freeze the distribution for the given arguments. Parameters: arg1, arg2, arg3,... : array_like The shape parameter(s) for the distribution. Should include all the non-optional arguments, may include loc and scale. Returns: rv_frozen : rv_frozen instance The frozen distribution.

RLMResults.t_test()

statsmodels.robust.robust_linear_model.RLMResults.t_test RLMResults.t_test(r_matrix, cov_p=None, scale=None, use_t=None) Compute a t-test for a each linear hypothesis of the form Rb = q Parameters: r_matrix : array-like, str, tuple array : If an array is given, a p x k 2d array or length k 1d array specifying the linear restrictions. It is assumed that the linear combination is equal to zero. str : The full hypotheses to test can be given as a string. See the examples. tuple : A tuple of a

MNLogit.predict()

statsmodels.discrete.discrete_model.MNLogit.predict MNLogit.predict(params, exog=None, linear=False) Predict response variable of a model given exogenous variables. Parameters: params : array-like 2d array of fitted parameters of the model. Should be in the order returned from the model. exog : array-like 1d or 2d array of exogenous values. If not supplied, the whole exog attribute of the model is used. If a 1d array is given it assumed to be 1 row of exogenous variables. If you only hav