rcbd <- designRCBD(
treatments = c(2, 2),
label = list(facA = c("1", "2"), facB = c("1", "2")),
blocks = 12,
formula = ~ facA*facB + (1|block),
means = c(32, 35, 30, 37),
vcomp = 4,
sigma2 = 6
)
# If contrast is not specified, pairwise comparisons are conducted
pwr.contrast(rcbd, which = "facA") # Marginal effect of facA
pwr.contrast(rcbd, which = "facA", by = "facB") # Conditional effect of facA within levels of facB
# Custom contrast vector, identical to pairwise comparison
pwr.contrast(rcbd, which = "facA", contrast = c(1, -1))
pwr.contrast(rcbd, which = "facA", by = "facB", contrast = c(1, -1))
# A single factor combining two factors
pwr.contrast(
rcbd,
which = "facA*facB",
contrast = list(
A1B1vs.A2B1 = c(1, -1, 0, 0),
A1B1vs.A2B2 = c(1, 0, 0, -1)
)
)
Run the code above in your browser using DataLab