rmst {simtrial}R Documentation

RMST difference of 2 arms

Description

RMST difference of 2 arms

Usage

rmst(
  data,
  tau = 10,
  var_label_tte = "tte",
  var_label_event = "event",
  var_label_group = "treatment",
  formula = NULL,
  reference = "control",
  alpha = 0.05
)

Arguments

data

A time-to-event dataset with a column tte indicating the survival time and a column of event indicating whether it is event or censor.

tau

RMST analysis time.

var_label_tte

Column name of the TTE variable.

var_label_event

Column name of the event variable.

var_label_group

Column name of the grouping variable.

formula

(default: NULL) A formula that indicates the TTE, event, and group variables (in that exact order; see Details below). This is an alternative to specifying the variables as strings. If a formula is provided, the values passed to var_label_tte, var_label_event, and var_label_group are ignored.

reference

A group label indicating the reference group.

alpha

Type I error.

Details

The argument formula is provided as a convenience to easily specify the TTE, event, and grouping variables. Note however that only the order of the three variables is actually used by the underlying function. Any functions applied in the formula are ignored, and thus should only be used for documenting your intent. For example, you can use the syntax from the survival package Surv(tte | event) ~ group to highlight the relation between the TTE and event variables, but the function Surv() is never actually executed. Importantly, you shouldn't apply any transformation functions such as log() since these will also be ignored.

Value

The z statistics.

Examples

data(ex1_delayed_effect)
rmst(
  data = ex1_delayed_effect,
  var_label_tte = "month",
  var_label_event = "evntd",
  var_label_group = "trt",
  tau = 10,
  reference = "0"
)

# Formula interface
library("survival")

rmst(
  data = ex1_delayed_effect,
  formula = Surv(month | evntd) ~ trt,
  tau = 10,
  reference = "0"
)

# alternative
rmst(
  data = ex1_delayed_effect,
  formula = ~ Surv(month, evntd, trt),
  tau = 10,
  reference = "0"
)

# This example doesn't make statistical sense, but demonstrates that only the
# order of the 3 variables actually matters
rmst(
  data = ex1_delayed_effect,
  formula = month ~ evntd + trt,
  tau = 10,
  reference = "0"
)

[Package simtrial version 0.4.1 Index]