coxbystrata: Fit CoxPH Model Within Strata

View source: R/bystrataCoreFuns.R

coxbystrataR Documentation

Fit CoxPH Model Within Strata

Description

Fits a Cox proportional hazards model within each formed strata, providing estimate of log hazard ratio and test of PH within each strata

Usage

coxbystrata(time, status, arm, treeStrata, termNodes = NULL,
  treetype = "final", alternative = "less", cilevel = 0.025,
  inclfrailty = FALSE, verbose = 0, plot = TRUE, timeunit = NULL,
  shading = TRUE)

Arguments

time

Follow-up time for right-censored data

status

Status indicator, 1=event, 0=censored

arm

Treatment indicator, 1 = test treatment, 0 = control

treeStrata

Vector of strata membership for each subject (where 1 indicates belonging to the highest risk stratum, and the largest number indicates belonging to the lowest risk stratum)

termNodes

Vector of names for each tree strata formed (terminal nodes from ctree, representing strata definition in terms of covariates)

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

alternative

For tests, whether alternative hypothesis is "less", "greater", or "two.sided" (default = "less")

cilevel

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

inclfrailty

A logical variable - whether or not to include a frailty term to each within-strata Cox PH model fit for added robustness against unexplained heterogeneity

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

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 cox fits within each strata (estimated log hazard ratio, variance, (1-cilevel)x100% CI, and corresponding exponentiated estimates), along with test statistic and p-value for test that logHR = 0 and Pr(logHR<0) for each stratum, Grambsch-Therneau (GT) tests for PH within each strata, and sample size and inverse variance weights for each stratum

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

  • table: Summary of amalgamated (sample-size weighted) hazard ratio estimate, variance, (1-cilevel)x100% confidence interval, test statistic, and p-value

  • weights: Sample size weights used to construct estimate

  • 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.