summaryPSM | R Documentation |
Extract information about fitted parametric survival models
summaryPSM( x, types = c("mean", "survival", "hazard", "cumhaz", "median", "rmst"), t = NULL, ci = FALSE, se = FALSE )
x |
An object created by calling |
types |
A list of statistics to extract - see |
t |
The time points to be used - see |
ci |
Should a confidence interval be returned - see |
se |
Should a standard error be returned - see |
A data frame containing the following values
Model - The Model as specified in runPSM
model.type
ModelF - an ordered factor of Model
Dist - The distribution
DistF - an ordered factor of Dist
distr - as specified in runPSM
distr
Strata - Either Intervention or Reference
StrataName - As specified by int_name and ref_name respectively in runPSM
type - as defined by the types parameter see summary.flexsurvreg
for details
variable - "est", "lcl", "ucl", "se" respectively
time - either NA or the time the statistic is evaluated at
value - estimated value
require(dplyr) require(ggplot2) PFS_data <- sim_adtte(seed = 2020, rho = 0.6) %>% filter(PARAMCD=="PFS") %>% transmute(USUBJID, ARMCD, PFS_days = AVAL, PFS_event = 1- CNSR ) psm_pfs <- runPSM( data = PFS_data, time_var = "PFS_days", event_var = "PFS_event", strata_var = "ARMCD", int_name = "A", ref_name = "B") summaryPSM(psm_pfs, types = c("mean","rmst"), t = c(100,2000)) %>% filter(Dist == "Generalized Gamma", Strata == "Intervention") summaryPSM(psm_pfs, types = "survival", t = seq(0,2000,100)) %>% ggplot(aes(x=time, y = value, color = StrataName, linetype = Model)) + geom_line()+ facet_grid(~Dist) summaryPSM(psm_pfs, types = "hazard", t = seq(0,5000,100)) %>% ggplot(aes(x=time, y = value, color = StrataName, linetype = Model)) + geom_line()+ facet_grid(~Dist) + coord_cartesian(ylim = c(0,0.02)) summaryPSM(psm_pfs, types = "cumhaz", t = seq(0,5000,100)) %>% ggplot(aes(x=time, y = value, color = StrataName, linetype = Model)) + geom_line()+ facet_grid(~Dist) + coord_cartesian(ylim = c(0,100))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.