View source: R/diffMeansVector.R
| diffMeansVector | R Documentation |
Calculates the differences of mean observed outcomes for multiple specified treatment factors and specified pairs of comparison levels.
diffMeansVector(y, w, calcOptions)
y |
a vector or matrix of outcomes. |
w |
a vector or matrix of assignments. |
calcOptions |
a list of options for calculating the vector of differences of mean outcomes.
|
If unspecified, calcOptions$pairs defaults to c(0,1).
If calcOptions$factors is specified, its length must equal the number of rows specified in calcOptions$pairs.
If unspecified, calcOptions$factors defaults to an appropriately-sized vector of 1's.
A vector of differences of mean observed outcomes.
Joseph J. Lee and Tirthankar Dasgupta
diffMeans
# 2 treatment factors, each with 3 levels
# Assignments, outcomes, and desired pairs
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)
diffMeansVector(
y,
w,
calcOptions = list(
factors = c(1, 1, 2),
pairs = rbind(c(1, 2), c(2, 3), c(1, 3))
)
) # Equals c(-1, 1, 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.