old.vars <- c("tx.type", "age.rec", "hla.match", "age.donor", "year")
@@ -2711,7 +2711,7 @@ n= 9433, number of events= 9433
-
+
@@ -2766,6 +2766,15 @@ n= 9433, number of events= 9433
diff --git a/slides.Rmd b/slides.Rmd index 75017a5..0bd31f6 100644 --- a/slides.Rmd +++ b/slides.Rmd @@ -590,7 +590,7 @@ test.new.var(old.vars, "year", 5) `year` has the smallest $p$-value -## `tx.type` + `age.rec` + `hla.match` + `age.donor` + `year` +## `tx.type` + `age.rec` + `hla.match` + `age.donor` + `year` + ? ```{r, echo=TRUE} old.vars <- c("tx.type", "age.rec", "hla.match", "age.donor", "year") @@ -613,7 +613,7 @@ cox.full <- coxph(surv.full, data = dat, method = "breslow") cox.full ``` -```{r, fig.width=7, fig.height=5} +```{r, fig.width=6, fig.height=6} tidy(cox.full, exponentiate = TRUE, conf.int = TRUE) |> mutate( term = recode( @@ -635,7 +635,7 @@ tidy(cox.full, exponentiate = TRUE, conf.int = TRUE) |> geom_point(size = 2) + labs( title = "Hazard Ratios from Full Cox Model", - x = "Hazard Ratio", + x = "Log Hazard Ratio", y = NULL ) + my.theme @@ -696,6 +696,59 @@ tidy(cox.full.1, exponentiate = TRUE, conf.int = TRUE) |> ``` +```{r, fig.width=6, fig.height=6} +hr.full <- tidy(cox.full, exponentiate = TRUE, conf.int = TRUE) +hr.full.1 <- tidy(cox.full.1, exponentiate = TRUE, conf.int = TRUE) +hr.compare <- bind_rows( + hr.full |> + mutate(model = "Full model with year"), + hr.full.1 |> + mutate(model = "Model without year") +) |> + mutate( + term = recode( + term, + "tx.typeLiving" = "Living donor", + "age.rec" = "Recipient age", + "hla.match" = "HLA match", + "age.donor" = "Donor age", + "year" = "Transplant year" + ), + term = factor( + term, + levels = c( + "Transplant year", + "Living donor", + "Recipient age", + "Donor age", + "HLA match" + ) + ) + ) +ggplot(hr.compare, aes(x = estimate, y = term, color = model)) + + geom_vline(xintercept = 1, linetype = "dashed") + + geom_errorbarh( + aes(xmin = conf.low, xmax = conf.high), + height = 0.2, + position = position_dodge(width = 0.6) + ) + + geom_point( + size = 2.5, + position = position_dodge(width = 0.6) + ) + + scale_x_log10() + + labs( + title = "Hazard Ratios from Cox Models", + x = "Log Hazard Ratio", + y = NULL, + color = NULL + ) + + my.theme +``` + + + + diff --git a/slides.html b/slides.html index 1cc2c98..b374ce6 100644 --- a/slides.html +++ b/slides.html @@ -2637,7 +2637,7 @@ n= 9433, number of events= 449
year has the smallest \(p\)-value
tx.type + age.rec + hla.match + age.donor + yeartx.type + age.rec + hla.match + age.donor + year + ?old.vars <- c("tx.type", "age.rec", "hla.match", "age.donor", "year")
@@ -2711,7 +2711,7 @@ n= 9433, number of events= 9433
-
+
@@ -2766,6 +2766,15 @@ n= 9433, number of events= 9433

TODO: write a more generic function (UPDATE: FAILED)




























cold.isc


tx.type























