rmstbystrata: Calculate RMST Within Strata

View source: R/bystrataCoreFuns.R

rmstbystrataR Documentation

Calculate RMST Within Strata

Description

Calculates the restricted mean survival time for each arm and corresponding difference in RMST within each strata

Usage

rmstbystrata(time, status, arm, tau = NULL, treeStrata,
  termNodes = NULL, treetype = "final", alternative = "two.sided",
  cilevel = 0.05, verbose = 0, plot = FALSE, timeunit = NULL)

Arguments

time

Vector of follow-up times for right-censored data

status

Status indicator vector, 1=event, 0=censored

arm

Treatment indicator vector, 1 = test treatment, 0 = control

tau

End time for RMST calculation; if not specified, the minimum of maximum observed times for each arm is used (calculated separately for each stratum); see also rmst2

treeStrata

Vector of strata membership, as defined by ctree strata

termNodes

Vector of names for each tree strata formed (e.g., number of strata or covariate definition)

treetype

String, whether trees input are "preliminary" (e.g., from step 3A) or "final" (e.g., from step 3B)

alternative

For tests, whether alternative hypothesis is "less", "greater", or "two.sided"

cilevel

Confidence level alpha for overall result and confidence intervals (i.e., produces (1-cilevel)x100% CIs)

verbose

Numeric variable indicating amount of information to print to the terminal (0 = nothing, 1 = notes only, 2 = notes and intermediate output)

plot

Logical, whether to create within strata and pooled between strata KM plots; CURRENTLY IGNORED (i.e., no plots are produced)

timeunit

Optional argument, time unit for survival data (e.g., Months, Years,..); currently only used for plots and ignored if plot is FALSE

Value

  • fitsummary: summary of estimated RMST differences within each strata (est RMST difference, variance, (1-cilevel)x100% confidence interval, test statistic, p-value, tau used, and Pr(RMST>0) for each stratum)

  • stratafit: a survfit object containing pooled-by-treatment survival information for each strata

  • weights: Sample size weights


rmarceauwest/fiveSTAR documentation built on June 30, 2023, 7:38 a.m.