PHReg.efron_hessian()

statsmodels.duration.hazard_regression.PHReg.efron_hessian PHReg.efron_hessian(params) [source] Returns the Hessian matrix of the partial log-likelihood evaluated at params, using the Efron method to handle tied times.

PHReg.breslow_hessian()

statsmodels.duration.hazard_regression.PHReg.breslow_hessian PHReg.breslow_hessian(params) [source] Returns the Hessian of the log partial likelihood evaluated at params, using the Breslow method to handle tied times.

PHReg.breslow_loglike()

statsmodels.duration.hazard_regression.PHReg.breslow_loglike PHReg.breslow_loglike(params) [source] Returns the value of the log partial likelihood function evaluated at params, using the Breslow method to handle tied times.

PHReg.efron_gradient()

statsmodels.duration.hazard_regression.PHReg.efron_gradient PHReg.efron_gradient(params) [source] Returns the gradient of the log partial likelihood evaluated at params, using the Efron method to handle tied times.

PHReg.breslow_gradient()

statsmodels.duration.hazard_regression.PHReg.breslow_gradient PHReg.breslow_gradient(params) [source] Returns the gradient of the log partial likelihood, using the Breslow method to handle tied times.

PHReg.baseline_cumulative_hazard()

statsmodels.duration.hazard_regression.PHReg.baseline_cumulative_hazard PHReg.baseline_cumulative_hazard(params) [source] Estimate the baseline cumulative hazard and survival functions. Parameters: params : ndarray The model parameters. Returns: A list of triples (time, hazard, survival) containing the time : values and corresponding cumulative hazard and survival : function values for each stratum. : Notes Uses the Nelson-Aalen estimator.

PHReg.baseline_cumulative_hazard_function()

statsmodels.duration.hazard_regression.PHReg.baseline_cumulative_hazard_function PHReg.baseline_cumulative_hazard_function(params) [source] Returns a function that calculates the baseline cumulative hazard function for each stratum. Parameters: params : ndarray The model parameters. Returns: A dict mapping stratum names to the estimated baseline : cumulative hazard function. :

Other Models miscmodels

Other Models miscmodels statsmodels.miscmodels contains model classes and that do not yet fit into any other category, or are basic implementations that are not yet polished and will most likely still change. Some of these models were written as examples for the generic maximum likelihood framework, and there will be others that might be based on general method of moments. The models in this category have been checked for basic cases, but might be more exposed to numerical problems than the com

Patsy: Contrast Coding Systems for categorical variables

Patsy: Contrast Coding Systems for categorical variables Note This document is based heavily on this excellent resource from UCLA. A categorical variable of K categories, or levels, usually enters a regression as a sequence of K-1 dummy variables. This amounts to a linear hypothesis on the level means. That is, each test statistic for these variables amounts to testing whether the mean for that level is statistically significantly different from the mean of the base category. This dummy codin

Ordinary Least Squares

Ordinary Least Squares Link to Notebook GitHub In [1]: from __future__ import print_function import numpy as np import statsmodels.api as sm import matplotlib.pyplot as plt from statsmodels.sandbox.regression.predstd import wls_prediction_std np.random.seed(9876789) OLS estimation Artificial data: In [2]: nsample = 100 x = np.linspace(0, 10, 100) X = np.column_stack((x, x**2)) beta = np.array([1, 0.1, 10]) e = np.random.normal(size=nsample) Our model needs an i