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) + year + mgus",
                data, status=status, ties="efron")
rslt = mod.fit()
print(rslt.summary())

Detailed examples can be found here:

There are some notebook examples on the Wiki: Wiki notebooks for PHReg and Survival Analysis

References

References for Cox proportional hazards regression model:

T Therneau (1996). Extending the Cox model. Technical report.
http://www.mayo.edu/research/documents/biostat-58pdf/DOC-10027288

G Rodriguez (2005). Non-parametric estimation in survival models.
http://data.princeton.edu/pop509/NonParametricSurvival.pdf

B Gillespie (2006). Checking the assumptions in the Cox proportional
hazards model.
http://www.mwsug.org/proceedings/2006/stats/MWSUG-2006-SD08.pdf

Module Reference

The model class is:

PHReg(endog, exog[, status, entry, strata, ...]) Fit the Cox proportional hazards regression model for right censored data.

The result class is:

PHRegResults(model, params, cov_params[, ...]) Class to contain results of fitting a Cox proportional hazards survival model.
doc_statsmodels
2017-01-18 16:12:23
Comments
Leave a Comment

Please login to continue.