Skip to content

Commit

Permalink
title case
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasSchmidtblaicherQC committed Nov 1, 2024
1 parent ea9580b commit c338a4b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/tutorials/cox_model/cox_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
"\n",
"**Intro**\n",
"\n",
"This tutorial shows how the Cox proportional hazards model (from now on: Cox model) which cannot be represented as an Exponential Dispersion Model (EDM), can still be estimated in glum by a standard Poisson regression after a simple data transformation. The exposition here is mostly based on [1], but the approach has also been described elsewhere [2, 3].\n",
"This tutorial shows how the Cox proportional hazards model (from now on: Cox model) which cannot be represented as an Exponential Dispersion Model (EDM), can still be estimated in glum by a standard Poisson regression after a simple data transformation. The exposition is mostly based on [1], but the approach has also been described elsewhere [2, 3].\n",
"\n",
"## Table of Contents\n",
"* [1. Equivalence between the Cox likelihood and a profile Poisson likelihood](#1. Equivalence-between-the-Cox-likelihood-and-a-profile-Poisson-likelihood)\n",
"* [2. Estimating a Cox model in glum](#2.-Estimating-a-Cox-model-in-glum)\n",
"* [3. Benchmarking estimation speed](#3.-Benchmarking-estimation-speed)\n",
"* [1. Equivalence Between the Cox Likelihood and a Profile Poisson Likelihood](#1.-Equivalence-Between-the-Cox-Likelihood-and-a-Profile-Poisson-Likelihood)\n",
"* [2. Estimating a Cox Model in Glum](#2.-Estimating-a-Cox-Model-in-Glum)\n",
"* [3. Speed Considerations](#3.-Speed-Considerations)\n",
"\n",
"## 1. Equivalence between the Cox likelihood and a profile Poisson likelihood<a class=\"anchor\"></a>\n",
"## 1. Equivalence Between the Cox Likelihood and a Profile Poisson Likelihood<a class=\"anchor\"></a>\n",
"\n",
"In the Cox model, the rate of event occurrence, $\\lambda(t,x_i)$, factorizes nicely into a linear predictor $\\eta_i=\\sum_k \\beta_k x_{ik}$ that depends on individual $i$'s characteristics but not on time $t$ and a baseline hazard $\\lambda_0$ that depends only on time, $\\lambda(t,x_i)=\\lambda_0(t)\\exp(\\eta_i)$. The partial log-likelihood of $\\eta_i$ is\n",
"$$\n",
Expand All @@ -35,7 +35,7 @@
"$$\n",
"which is the same as the partial likelihood in the Cox model, apart from the -1 which drops out in estimation. In short, the Cox partial log likelihood is equivalent to a Poisson log likelihood with the estimate for time period effects fed back in (\"profiled out\"). This means that, to estimate the parameters of the Cox model, one can simply run a Poisson regression with time fixed effects $\\alpha_t$.\n",
"\n",
"## 2. Estimating a Cox model in glum<a class=\"anchor\"></a>\n",
"## 2. Estimating a Cox Model in Glum<a class=\"anchor\"></a>\n",
"\n",
"We now show that a Poisson model in `glum` yields the same parameter estimates as a Cox model. For the latter, we use the awesome [lifelines](https://github.com/CamDavidsonPilon/lifelines) library. We also take the dataset from lifelines, which is from an RCT on recidivism for 432 convicts released from Maryland state prisons with first arrest after release as event. We first load imports and the dataset:"
]
Expand Down Expand Up @@ -778,7 +778,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3. Benchmarking estimation speed<a class=\"anchor\"></a>\n",
"## 3. Speed Considerations<a class=\"anchor\"></a>\n",
"\n",
"Given that the Poisson model estimates many more parameters than the Cox model, one might wonder if the Poisson approach is competitive in estimation time. The Poisson approach, including the data transformation by `survival_split`, turns out to be faster for the dataset here. This is likely aided by tabmat's optimizations for the high-dimensional `week` categorical."
]
Expand Down

0 comments on commit c338a4b

Please sign in to comment.