Extract information about fitted parametric survival models

summaryPSM(
  x,
  types = c("mean", "survival", "hazard", "cumhaz", "median", "rmst"),
  t = NULL,
  ci = FALSE,
  se = FALSE
)

Arguments

x

An object created by calling runPSM

types

A list of statistics to extract - see summary.flexsurvreg for details

t

The time points to be used - see summary.flexsurvreg for details

ci

Should a confidence interval be returned - see summary.flexsurvreg for details

se

Should a standard error be returned - see summary.flexsurvreg for details

Value

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

Examples


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")
#> Fitting common shape models
#> Fitting model exp
#> Fitting model weibull
#> Fitting model gompertz
#> Fitting model lnorm
#> Fitting model llogis
#> Fitting model gengamma
#> Fitting model gamma
#> Fitting model genf
#> Fitting separate shape models - intervention arm
#> Fitting model exp
#> Fitting model weibull
#> Fitting model gompertz
#> Fitting model lnorm
#> Fitting model llogis
#> Fitting model gengamma
#> Fitting model gamma
#> Fitting model genf
#> Fitting separate shape models - reference arm
#> Fitting model exp
#> Fitting model weibull
#> Fitting model gompertz
#> Fitting model lnorm
#> Fitting model llogis
#> Fitting model gengamma
#> Fitting model gamma
#> Fitting model genf
#> Fitting independant shape models
#> Fitting model exp
#> Fitting model weibull
#> Fitting model gompertz
#> Fitting model llogis
#> Fitting model gamma
#> Fitting model lnorm
#> Fitting model gengamma
#> Fitting model genf

summaryPSM(psm_pfs, types = c("mean","rmst"), t = c(100,2000)) %>%
   filter(Dist == "Generalized Gamma", Strata == "Intervention")
#> # A tibble: 9 × 11
#>   Model    ModelF Dist  DistF distr Strata StrataName type  variable  time value
#>   <chr>    <ord>  <chr> <ord> <chr> <chr>  <chr>      <chr> <chr>    <dbl> <dbl>
#> 1 Separat… Separ… Gene… Gene… geng… Inter… A          mean  est         NA 206. 
#> 2 Common … Commo… Gene… Gene… geng… Inter… A          mean  est         NA 206. 
#> 3 Indepen… Indep… Gene… Gene… geng… Inter… A          mean  est         NA 206. 
#> 4 Separat… Separ… Gene… Gene… geng… Inter… A          rmst  est        100  88.0
#> 5 Separat… Separ… Gene… Gene… geng… Inter… A          rmst  est       2000 206. 
#> 6 Common … Commo… Gene… Gene… geng… Inter… A          rmst  est        100  87.8
#> 7 Common … Commo… Gene… Gene… geng… Inter… A          rmst  est       2000 206. 
#> 8 Indepen… Indep… Gene… Gene… geng… Inter… A          rmst  est        100  88.0
#> 9 Indepen… Indep… Gene… Gene… geng… Inter… A          rmst  est       2000 206. 

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))