constEffect: Potential Outcomes With Constant Treatment Effects

View source: R/constEffect.R

constEffectR Documentation

Potential Outcomes With Constant Treatment Effects

Description

Calculates potential outcomes under modified assignments, according to the specified constant treatment effect(s).

Usage

constEffect(y, w, w_new, poOptions)

Arguments

y

a vector or matrix of outcomes.

w

a vector or matrix of assignments.

w_new

a vector or matrix of modified assignments.

poOptions

a list of options for calculating potential outcomes. poOptions$tau is a number or numeric vector denoting the constant treatment effect(s).

Value

A vector of potential outcomes under the modified assignments.

Author(s)

Joseph J. Lee and Tirthankar Dasgupta

See Also

zeroEffect

Examples

# 1 treatment factor with 2 levels
# Assignments
w <- c(0, 0, 0, 0, 0, 1, 1, 1, 1, 1)
# Modified Assignments
w_new <- c(1, 1, 1, 1, 1, 0, 0, 0, 0, 0)
# Outcomes
y <- c(4, 6, 5, 7, 4, 7, 11, 9, 8, 12)
constEffect(y, w, w_new, poOptions = list(tau = 2))

# 2 treatment factors, each with 2 levels
# Assignments
w1 <- c(0, 0, 0, 0, 0, 1, 1, 1, 1, 1)
w2 <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1)
w <- cbind(w1, w2)
# Modified assignments
w1_new <- c(1, 1, 1, 1, 1, 0, 0, 0, 0, 0)
w2_new <- c(1, 0, 1, 0, 1, 0, 1, 0, 1, 0)
w_new <- cbind(w1_new, w2_new)
# Outcomes
y <- c(4, 6, 5, 7, 4, 7, 11, 9, 8, 12)
constEffect(y, w, w_new, poOptions = list(tau = c(2, -1)))

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