summaryPSM: Extract information about fitted parametric survival models

View source: R/summaryPSM.R

summaryPSMR Documentation

Extract information about fitted parametric survival models

Description

Extract information about fitted parametric survival models

Usage

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

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


iain-t-bennett-roche/flexsurvPlus documentation built on Aug. 1, 2022, 10:10 a.m.