Learn R Programming

Surrogate (version 3.4.4)

prepare_longitudinal_surrogate_data: Prepare data for longitudinal surrogate modeling

Description

This function standardizes a long-format data set to the internal variables used by the longitudinal model-fitting functions.

Usage

prepare_longitudinal_surrogate_data(
  data,
  id,
  treatment,
  time,
  endpoint,
  outcome,
  surrogate_label,
  true_label,
  treatment_levels = c(0, 1),
  covariates = character(0)
)

Value

A standardized data.frame.

Arguments

data

A data.frame in long format.

id

Character name of the subject identifier column.

treatment

Character name of the treatment column.

time

Character name of the measurement-time column.

endpoint

Character name of the endpoint-label column.

outcome

Character name of the observed outcome column.

surrogate_label

Label identifying the surrogate endpoint.

true_label

Label identifying the true endpoint.

treatment_levels

Two treatment values, ordered as control then active.

covariates

Optional character vector of additional baseline covariates.

Details

Baseline responses must be supplied as ordinary outcome rows with time = 0. Post-randomization observations must have strictly positive times. This single convention allows baseline outcomes to contribute to estimation of the augmented treatment-arm marginal models, while the longitudinal ICA is evaluated only at positive times.

Examples

Run this code
data(Schizo_PANSS_BPRS)
dat <- prepare_longitudinal_surrogate_data(
       data = Schizo_PANSS_BPRS,
       id = "Id",
       treatment = "Treat",
       time = "Time_cont",
       endpoint = "Endpoint",
       outcome = "Response_log",
       surrogate_label = "BPRS",
       true_label = "PANSS",
       treatment_levels = c(0, 1))

Run the code above in your browser using DataLab