statsmodels.duration.hazard_regression.PHReg.from_formula

classmethod PHReg.from_formula(formula, data, status=None, entry=None, strata=None, offset=None, subset=None, ties='breslow', missing='drop', *args, **kwargs) [source]

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

Parameters:
  • formula (str or generic Formula object) – The formula specifying the model
  • data (array-like) – The data for the model. See Notes.
  • status (array-like) – The censoring status values; status=1 indicates that an event occured (e.g. failure or death), status=0 indicates that the observation was right censored. If None, defaults to status=1 for all cases.
  • entry (array-like) – The entry times, if left truncation occurs
  • strata (array-like) – Stratum labels. If None, all observations are taken to be in a single stratum.
  • offset (array-like) – Array of offset values
  • subset (array-like) – An array-like object of booleans, integers, or index values that indicate the subset of df to use in the model. Assumes df is a pandas.DataFrame
  • ties (string) – The method used to handle tied times, must be either ‘breslow’ or ‘efron’.
  • missing (string) – The method used to handle missing data
  • args (extra arguments) – These are passed to the model
  • kwargs (extra keyword arguments) – These are passed to the model with one exception. The eval_env keyword is passed to patsy. It can be either a patsy.EvalEnvironment object or an integer indicating the depth of the namespace to use. For example, the default eval_env=0 uses the calling namespace. If you wish to use a “clean” environment set eval_env=-1.
Returns:

model

Return type:

PHReg model instance

© 2009–2012 Statsmodels Developers
© 2006–2008 Scipy Developers
© 2006 Jonathan E. Taylor
Licensed under the 3-clause BSD License.
http://www.statsmodels.org/stable/generated/statsmodels.duration.hazard_regression.PHReg.from_formula.html