-
Book Overview & Buying
-
Table Of Contents
Causal Inference with Bayesian Networks
By :
In this method, first we fit a survival regression model. This model can predict hazard as a function of covariate features (X) and the treatment variable (A). The Cox proportional hazards model is one of the most widely used models in survival analysis. This model is defined as follows:
(13.5)
Here
is the hazard of a participant at time t given all the covariates
and treatment A, and h0(t) is the baseline hazard function (hazard when the treatment and all covariates are zero). Finally,
are the model parameters. Once this model is trained on the dataset, it can predict the hazard at time t for each participant. The following code fits a Cox model to our dataset using the CoxPHFitter() class in lifelines package. After creating an object from this class, we can call its fit() method to train the model. It takes the dataset and the name of the time-to-event and outcome columns in that.
cph = CoxPHFitter()
cph.fit(nhefs, duration_col=...