Skip to contents

Calculate power for testing various contrasts.

Usage

pwr.contrast(
  object,
  which,
  by = NULL,
  contrast = c("pairwise", "poly", "trt.vs.ctrl"),
  sig.level = 0.05,
  p.adj = FALSE,
  alternative = c("two.sided", "one.sided"),
  strict = TRUE
)

Arguments

object

design object created in pwr4exp

which

the factor of interest

by

the variable to condition on

contrast

contrast method, include "pairwise", "poly", and "trt.vs.ctrl", or any manually defined contrast vector

sig.level

significance level, default 0.05

p.adj

whether the sig.level should be adjusted using the Bonferroni method, default FALSE

alternative

one- or two-sided test. Can be abbreviated.

strict

use strict interpretation in two-sided case

Value

a data frame or a list of data frame separated by conditions.

Examples

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
)
pwr.contrast(rcbd, which = "facA", by = "facB")
#> $`facB = 1`
#>               effect df sig.level     power alternative
#> facA1 - facA2     -3 33      0.05 0.8293757   two.sided
#> 
#> $`facB = 2`
#>               effect df sig.level     power alternative
#> facA1 - facA2     -7 33      0.05 0.9999993   two.sided
#>