diffMeans: Single Pairwise Difference of Mean Outcomes

View source: R/diffMeans.R

diffMeansR Documentation

Single Pairwise Difference of Mean Outcomes

Description

Calculates the difference of mean observed outcomes for a specified treatment factor and specified pair of comparison levels.

Usage

diffMeans(y, w, calcOptions = NULL)

Arguments

y

a vector or matrix of outcomes.

w

a vector or matrix of assignments.

calcOptions

a list of options for calculating the difference of mean outcomes (if necessary). calcOptions$factor is a number denoting the treatment factor of interest (defaults to 1). calcOptions$pair is a vector (of length 2) denoting the pair of levels for comparison (defaults to c(0,1)). If calcOptions is NULL, then calcOptions$factor and calcOptions$pair take on their default values.

Value

The difference of mean observed outcomes.

Author(s)

Joseph J. Lee and Tirthankar Dasgupta

See Also

diffMeansVector

Examples

# 1 treatment factor with 2 levels
# Assignments and outcomes
w <- c(0, 0, 0, 0, 0, 1, 1, 1, 1, 1)
y <- c(4, 6, 5, 6, 4, 11, 11, 9, 10, 9)
diffMeans(y, w) # Equals 5

# 2 treatment factors, each with 3 levels
# Assignments and outcomes
w1 <- c(1, 2, 3, 1, 2, 3, 1, 2, 3)
w2 <- c(1, 2, 3, 2, 3, 1, 3, 1, 2)
w <- cbind(w1, w2)
y <- c(4, 6, 5, 7, 4, 7, 11, 9, 10)
diffMeans(
  y,
  w,
  calcOptions = list(factor = 2, pair = c(1, 3))
) # Equals 0

randomizationInference documentation built on May 18, 2022, 1:06 a.m.