Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions R/survival.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ survminer::surv_pvalue(fit.km.str, data = dat)

### Stratified Cox PH model

NOTE: if using {survival} package version 3.8.0 the below code works correctly (specifically with using survival::strata), however see [news](https://cran.r-project.org/web/packages/survival/news.html), changes were made to version 3.7-3 and 3.8.0 to ensure survival::strata() works the same as strata(). If using a {survival} package version prior to 3.8.0 **NEVER** use survival::strata() (instead use just strata(), otherwise the stratification variable isn't fitted as you expect. You can see this as it appears as a covariate in the output with hazard ratio estimated. Whereas, when fitted as a strata, it should not.

```{r}
fit.cox.str <- survival::coxph(
survival::Surv(LENFOLY, FSTAT) ~ AFB + survival::strata(GENDER),
Expand Down