maaftbystrata: Calculate Model Averaged AFT Fits Within Strata

View source: R/bystrataCoreFuns.R

maaftbystrataR Documentation

Calculate Model Averaged AFT Fits Within Strata

Description

Fits parametric AFT models within each formed stratum, then performs model averaging to get a stratum-level estimate of time ratio with corresponding estimated variance, confidence interval, and probability the time ratio is > 0

Usage

maaftbystrata(time, status, arm, treeStrata, termNodes = NULL,
  distList = c("loglogistic", "lognormal", "weibull"), ucvar = 1,
  alternative = "greater", cilevel = 0.025, verbose = 0,
  plot = FALSE, treetype = "final", timeunit = NULL,
  shading = TRUE)

Arguments

time

Vector of follow-up times for right-censored data

status

Vector of status indicators, 1=event, 0=censored

arm

Vector of treatment indicators, 1 = test treatment, 0 = control

treeStrata

Vector of strata membership, as defined by ctree strata

termNodes

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

distList

Vector of models (survival distributions for parametric AFT fit) to include in model averaging; Each element must be the name of an element from survreg.distributions (see also survreg); default is c("loglogistic","lognormal","weibull")

ucvar

Estimator for the unconditional variance of the model averaging estimate to use. 1 uses Buckland et al. (1997) analytical estimator, and 2 uses the more conservative estimator of Burnham and Anderson (2002) related to Bayesian model averaging. For more details see Turek 2013. Default is "1".

alternative

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

cilevel

Confidence level alpha for within-stratum confidence intervals (i.e., produces (1-cilevel)x100% CIs when alternative="two.sided" and (1-2*cilevel)x100% CIs otherwise)

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 Kaplan-Meier plots

treetype

String, whether trees input are "preliminary" (e.g., from step 3A) or "final" (e.g., from step 3B). Used only in plotting; ignored when plot == FALSE

timeunit

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

shading

Logical variable; whether or not to show confidence bands around Kaplan-Meier curves; ignored when plot != TRUE

Value

  • fitsummary: summary of estimated model averaged AFT time ratio estimate, variance, CI, and Pr(TR > 1) within each strata, as well as corresponding exponeniated estimates, within-stratum test statistic and p-value, and weights/AIC information for each model being averaged

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

  • aftfits: list of each AFT model fit for each stratum

  • bystrataKM: Kaplan-Meier survival curve plots within each strata, returned if plot == TRUE

  • betweenstrataKM: Kaplan-Meier survival curve plots from pooled treatment assignment data from each strata, returned if plot == TRUE


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