statsmodels.duration.hazard_regression.PHReg

class statsmodels.duration.hazard_regression.PHReg(endog, exog, status=None, entry=None, strata=None, offset=None, ties='breslow', missing='drop', **kwargs)[source]

Cox Proportional Hazards Regression Model

The Cox PH Model is for right censored data.

Parameters
endogarray_like

The observed times (event or censoring)

exog2D array_like

The covariates or exogeneous variables

statusarray_like

The censoring status values; status=1 indicates that an event occurred (e.g. failure or death), status=0 indicates that the observation was right censored. If None, defaults to status=1 for all cases.

entryarray_like

The entry times, if left truncation occurs

strataarray_like

Stratum labels. If None, all observations are taken to be in a single stratum.

tiesstr

The method used to handle tied times, must be either ‘breslow’ or ‘efron’.

offsetarray_like

Array of offset values

missingstr

The method used to handle missing data

Notes

Proportional hazards regression models should not include an explicit or implicit intercept. The effect of an intercept is not identified using the partial likelihood approach.

endog, event, strata, entry, and the first dimension of exog all must have the same length

Methods

baseline_cumulative_hazard(params)

Estimate the baseline cumulative hazard and survival functions.

baseline_cumulative_hazard_function(params)

Returns a function that calculates the baseline cumulative hazard function for each stratum.

breslow_gradient(params)

Returns the gradient of the log partial likelihood, using the Breslow method to handle tied times.

breslow_hessian(params)

Returns the Hessian of the log partial likelihood evaluated at params, using the Breslow method to handle tied times.

breslow_loglike(params)

Returns the value of the log partial likelihood function evaluated at params, using the Breslow method to handle tied times.

efron_gradient(params)

Returns the gradient of the log partial likelihood evaluated at params, using the Efron method to handle tied times.

efron_hessian(params)

Returns the Hessian matrix of the partial log-likelihood evaluated at params, using the Efron method to handle tied times.

efron_loglike(params)

Returns the value of the log partial likelihood function evaluated at params, using the Efron method to handle tied times.

fit([groups])

Fit a proportional hazards regression model.

fit_regularized([method, alpha, …])

Return a regularized fit to a linear regression model.

from_formula(formula, data[, status, entry, …])

Create a proportional hazards regression model from a formula and dataframe.

get_distribution(params)

Returns a scipy distribution object corresponding to the distribution of uncensored endog (duration) values for each case.

hessian(params)

Returns the Hessian matrix of the log partial likelihood function evaluated at params.

information(params)

Fisher information matrix of model.

initialize()

Initialize (possibly re-initialize) a Model instance.

loglike(params)

Returns the log partial likelihood function evaluated at params.

predict(params[, exog, cov_params, endog, …])

Returns predicted values from the proportional hazards regression model.

robust_covariance(params)

Returns a covariance matrix for the proportional hazards model regresion coefficient estimates that is robust to certain forms of model misspecification.

score(params)

Returns the score function evaluated at params.

score_residuals(params)

Returns the score residuals calculated at a given vector of parameters.

weighted_covariate_averages(params)

Returns the hazard-weighted average of covariate values for subjects who are at-risk at a particular time.

Properties

endog_names

Names of endogenous variables.

exog_names

Names of exogenous variables.