Do you know how to plot a case-cohort study where we perform a Cox regression to estimate HR of different covariates, in which I am specially interested in potential molecular biomarkers and its prognostic efficiency. The thing is I tried the available functions in the package 'survminer'. It requires an object class "survfit" which doesn't seem to support 'cch'objects.
As I mentioned I wuld like to assess the prognostic value of several variables. The object comes from a databse with 189 controls and 55 cases. I assess multiple molecular markers, but I will paste the object of one particular and the generic formula applied
Thank you so much as always!
#case-cohort: cch function from the survival package
library(survival)
result <- cch(Surv(timetoevent, event) ~ age+ sex+ smoke+ box + weight + cholesterol+ cholesterol_HDL + molecular_marker, data = dat, subcoh = ~ casecohort2, id = ~parti, cohort.size = 5404, method = "LinYing", robust = TRUE)
The object "cch" in example
1 Answer 1
You can get the coefficient table from calling summary on the object. Then, simply convert this to a data frame and plot as you would with any other data frame using ggplot:
library(tidyverse)
summary(example)$coefficients %>%
as.data.frame() %>%
rownames_to_column('Variable') %>%
ggplot(aes(Variable, Value, color = p < 0.05)) +
geom_hline(yintercept = 0, alpha = 0.1) +
geom_point(size = 1) +
geom_errorbar(aes(ymin = Value - 1.96 * SE, ymax = Value + 1.96 * SE),
width = 0.2) +
scale_color_manual(values = c('gray50', 'black'), guide = 'none') +
coord_cartesian(ylim = c(-5, 5)) +
theme_classic(base_size = 16) +
theme(axis.line.x = element_blank(),
axis.ticks.length.x = unit(0, 'mm'),
panel.grid.major.x = element_line(color = 'gray96'))
6 Comments
survminer::ggadjustedcurves, which should give you exactly what you are looking for if you give it the Cox model.Explore related questions
See similar questions with these tags.