Skip to content

Commit

Permalink
Merge pull request #1563 from he7d3r/master
Browse files Browse the repository at this point in the history
doc: fix typos
  • Loading branch information
CamDavidsonPilon committed Sep 30, 2023
2 parents ea569da + cca8eb7 commit 10c3538
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions docs/Survival Regression.rst
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ To make proper inferences, we should ask if our Cox model is appropriate for our
Stratification
-----------------------------------------------

Sometimes one or more covariates may not obey the proportional hazard assumption. In this case, we can allow the covariate(s) to still be including in the model without estimating its effect. This is called stratification. At a high level, think of it as splitting the dataset into *m* smaller datasets, partitioned by the unique values of the stratifying covariate(s). Each dataset has its own baseline hazard (the non-parametric part of the model), but they all share the regression parameters (the parametric part of the model). Since covariates are the same within each dataset, there is no regression parameter for the covariates stratified on, hence they will not show up in the output. However there will be *m* baseline hazards under :attr:`~lifelines.fitters.coxph_fitter.CoxPHFitter.baseline_cumulative_hazard_`.
Sometimes one or more covariates may not obey the proportional hazard assumption. In this case, we can allow the covariate(s) to still be included in the model without estimating its effect. This is called stratification. At a high level, think of it as splitting the dataset into *m* smaller datasets, partitioned by the unique values of the stratifying covariate(s). Each dataset has its own baseline hazard (the non-parametric part of the model), but they all share the regression parameters (the parametric part of the model). Since covariates are the same within each dataset, there is no regression parameter for the covariates stratified on, hence they will not show up in the output. However there will be *m* baseline hazards under :attr:`~lifelines.fitters.coxph_fitter.CoxPHFitter.baseline_cumulative_hazard_`.

To specify variables to be used in stratification, we define them in the call to :meth:`~lifelines.fitters.coxph_fitter.CoxPHFitter.fit`:

Expand Down Expand Up @@ -1018,13 +1018,13 @@ two individual columns: a *duration* column and a boolean *event occurred* colum

.. code:: python
df['T'] = data['duration']
df['E'] = data['observed']
data['T'] = data['duration']
data['E'] = data['observed']
.. code:: python
aaf.fit(df, 'T', event_col='E', formula='un_continent_name + regime + start_year')
aaf.fit(data, 'T', event_col='E', formula='un_continent_name + regime + start_year')
After fitting, the instance exposes a :attr:`~lifelines.fitters.aalen_additive_fitter.AalenAdditiveFitter.cumulative_hazards_` DataFrame
Expand Down Expand Up @@ -1073,7 +1073,7 @@ Prime Minister Stephen Harper.
.. code:: python
ix = (data['ctryname'] == 'Canada') & (data['start_year'] == 2006)
harper = df.loc[ix]
harper = data.loc[ix]
print("Harper's unique data point:")
print(harper)
Expand Down Expand Up @@ -1232,7 +1232,7 @@ Also, lifelines has wrappers for `compatibility with scikit learn`_ for making c
Model probability calibration
---------------------------------------------------

New in *lifelines* v0.24.11 is the :func:`~lifelines.calibration.survival_probability_calibration` function to measure your fitted survival model against observed frequencies of events. We follow the advice in "Graphical calibration curves and the integrated calibration index (ICI) for survival models" by P. Austin and co., and use create a smoothed calibration curve using a flexible spline regression model (this avoids the traditional problem of binning the continuous-valued probability, and handles censored data).
New in *lifelines* v0.24.11 is the :func:`~lifelines.calibration.survival_probability_calibration` function to measure your fitted survival model against observed frequencies of events. We follow the advice in "Graphical calibration curves and the integrated calibration index (ICI) for survival models" by P. Austin and co., and create a smoothed calibration curve using a flexible spline regression model (this avoids the traditional problem of binning the continuous-valued probability, and handles censored data).


.. code:: python
Expand Down
2 changes: 1 addition & 1 deletion docs/jupyter_notebooks/Custom Regression Models.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@
"\n",
"Suppose in our population we have a subpopulation that will never experience the event of interest. Or, for some subjects the event will occur so far in the future that it's essentially at time infinity. In this case, the survival function for an individual should not asymptically approach zero, but _some positive value_. Models that describe this are sometimes called cure models (i.e. the subject is \"cured\" of death and hence no longer susceptible) or time-lagged conversion models. \n",
"\n",
"It would be nice to be able to use common survival models _and_ have some \"cure\" component. Let's suppose that for individuals that will experience the event of interest, their survival distrubtion is a Weibull, denoted $S_W(t)$. For a random selected individual in the population, thier survival curve, $S(t)$, is:\n",
"It would be nice to be able to use common survival models _and_ have some \"cure\" component. Let's suppose that for individuals that will experience the event of interest, their survival distribution is a Weibull, denoted $S_W(t)$. For a random selected individual in the population, thier survival curve, $S(t)$, is:\n",
"\n",
"$$ \n",
"\\begin{align*}\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"## Time-lagged conversion rates and cure models\n",
"\n",
"Suppose in our population we have a subpopulation that will never experience the event of interest. Or, for some subjects the event will occur so far in the future that it's essentially at time infinity. The survival function should not asymptically approach zero, but _some positive value_. Models that describe this are sometimes called cure models (i.e. the subject is \"cured\" of death and hence no longer susceptible) or time-lagged conversion models. \n",
"Suppose in our population we have a subpopulation that will never experience the event of interest. Or, for some subjects the event will occur so far in the future that it's essentially at time infinity. The survival function should not asymptotically approach zero, but _some positive value_. Models that describe this are sometimes called cure models (i.e. the subject is \"cured\" of death and hence no longer susceptible) or time-lagged conversion models. \n",
"\n",
"There's a serious fault in using parametric models for these types of problems that non-parametric models don't have. The most common parametric models like Weibull, Log-Normal, etc. all have strictly increasing cumulative hazard functions, which means the corresponding survival function will always converge to 0. \n",
"\n",
Expand Down Expand Up @@ -1069,7 +1069,7 @@
"source": [
"### Probabilistic cure models\n",
"\n",
"The models above are good at fitting to the data, but they offer less common interpretation of survival models. It would be nice to be able to use common survival models _and_ have some \"cure\" component. Let's suppose that for individuals that will experience the event of interest, their survival distrubtion is a Weibull, denoted $S_W(t)$. For a random selected individual in the population, thier survival curve, $S(t)$, is:\n",
"The models above are good at fitting to the data, but they offer less common interpretation of survival models. It would be nice to be able to use common survival models _and_ have some \"cure\" component. Let's suppose that for individuals that will experience the event of interest, their survival distribution is a Weibull, denoted $S_W(t)$. For a random selected individual in the population, thier survival curve, $S(t)$, is:\n",
"\n",
"$$ \n",
"\\begin{align*}\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/Custom Regression Models.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -877,9 +877,9 @@
"source": [
"### Cure models\n",
"\n",
"Suppose in our population we have a subpopulation that will never experience the event of interest. Or, for some subjects the event will occur so far in the future that it's essentially at time infinity. In this case, the survival function for an individual should not asymptically approach zero, but _some positive value_. Models that describe this are sometimes called cure models (i.e. the subject is \"cured\" of death and hence no longer susceptible) or time-lagged conversion models. \n",
"Suppose in our population we have a subpopulation that will never experience the event of interest. Or, for some subjects the event will occur so far in the future that it's essentially at time infinity. In this case, the survival function for an individual should not asymptotically approach zero, but _some positive value_. Models that describe this are sometimes called cure models (i.e. the subject is \"cured\" of death and hence no longer susceptible) or time-lagged conversion models. \n",
"\n",
"It would be nice to be able to use common survival models _and_ have some \"cure\" component. Let's suppose that for individuals that will experience the event of interest, their survival distrubtion is a Weibull, denoted $S_W(t)$. For a random selected individual in the population, thier survival curve, $S(t)$, is:\n",
"It would be nice to be able to use common survival models _and_ have some \"cure\" component. Let's suppose that for individuals that will experience the event of interest, their survival distribution is a Weibull, denoted $S_W(t)$. For a random selected individual in the population, thier survival curve, $S(t)$, is:\n",
"\n",
"$$ \n",
"\\begin{align*}\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/Modelling time-lagged conversion rates.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"## Time-lagged conversion rates and cure models\n",
"\n",
"Suppose in our population we have a subpopulation that will never experience the event of interest. Or, for some subjects the event will occur so far in the future that it's essentially at time infinity. The survival function should not asymptically approach zero, but _some positive value_. Models that describe this are sometimes called cure models (i.e. the subject is \"cured\" of death and hence no longer susceptible) or time-lagged conversion models. \n",
"Suppose in our population we have a subpopulation that will never experience the event of interest. Or, for some subjects the event will occur so far in the future that it's essentially at time infinity. The survival function should not asymptotically approach zero, but _some positive value_. Models that describe this are sometimes called cure models (i.e. the subject is \"cured\" of death and hence no longer susceptible) or time-lagged conversion models. \n",
"\n",
"There's a serious fault in using parametric models for these types of problems that non-parametric models don't have. The most common parametric models like Weibull, Log-Normal, etc. all have strictly increasing cumulative hazard functions, which means the corresponding survival function will always converge to 0. \n",
"\n",
Expand Down Expand Up @@ -1069,7 +1069,7 @@
"source": [
"### Probabilistic cure models\n",
"\n",
"The models above are good at fitting to the data, but they offer less common interpretation of survival models. It would be nice to be able to use common survival models _and_ have some \"cure\" component. Let's suppose that for individuals that will experience the event of interest, their survival distrubtion is a Weibull, denoted $S_W(t)$. For a random selected individual in the population, thier survival curve, $S(t)$, is:\n",
"The models above are good at fitting to the data, but they offer less common interpretation of survival models. It would be nice to be able to use common survival models _and_ have some \"cure\" component. Let's suppose that for individuals that will experience the event of interest, their survival distribution is a Weibull, denoted $S_W(t)$. For a random selected individual in the population, thier survival curve, $S(t)$, is:\n",
"\n",
"$$ \n",
"\\begin{align*}\n",
Expand Down

0 comments on commit 10c3538

Please sign in to comment.