PSContrast: Contrast of potential outcome for principal stratification...

View source: R/PSContrast.R

PSContrastR Documentation

Contrast of potential outcome for principal stratification analysis

Description

Create an object that represents contrast of potential outcomes by treatment arms, strata or time points.

Usage

PSContrast(
  outcome,
  S = NULL,
  Z = NULL,
  T = NULL,
  type = c("all", "sequential", "cycle")
)

Arguments

outcome

an object of class PSoutcome or PSContrast

S

a vector denoting which strata to take contrasts. Default is NULL indicating no contrasts are taken. Set to 'TRUE' to take contrasts between all strata.

Z

a vector denoting which treatment arms to take contrasts. Default is NULL indicating no contrasts are taken. Set to 'TRUE' to take contrasts between all treatment arms.

T

a vector denoting which time points to take contrasts. Default is NULL indicating no contrasts are taken. Set to 'TRUE' to take contrasts between all time points. This is used only when 'object' is obtained under survival outcome.

type

Either "all" (default), "sequential" or "cycle". If "all", every pairwise contrasts are taken. If "sequential", contrasts are taken over every consecutive pairs. If "cycle", contrasts are taken over every consecutive pairs and also between the first and the last levels.

Value

An S3 object of class PSContrast and PSOutcome, containing

outcome_array

A num_strata * num_treatment * num_iter array of contrast if the outcome type is non-survival or a num_strata * num_treatment * num_time_points * num_iter array of contrast if the outcome type is survival.

is.survival

A boolean value, whether the outcome type is survival.

time_points

The time points at which the outcome is evaluated, if the outcome type is survival.

The S3 method summary and plot can be applied to the returned object.


PStrata documentation built on May 29, 2024, 8:17 a.m.