powerMCTests: Power Simulation for One-Factorial All-Pairs and Many-To-One...

View source: R/powerMCTests.R

powerMCTestsR Documentation

Power Simulation for One-Factorial All-Pairs and Many-To-One Comparison Tests

Description

Performs power simulation for one-factorial all-pairs and Many-To-One comparison tests.

Usage

powerMCTests(
  mu,
  n = 10,
  errfn = c("Normal", "Lognormal", "Exponential", "Chisquare", "TDist", "Cauchy",
    "Weibull"),
  parms = list(mean = 0, sd = 1),
  test = c("kwManyOneConoverTest", "kwManyOneDunnTest", "kwManyOneNdwTest",
    "vanWaerdenManyOneTest", "normalScoresManyOneTest", "dunnettTest",
    "tamhaneDunnettTest", "ManyOneUTest", "chenTest", "kwAllPairsNemenyiTest",
    "kwAllPairsDunnTest", "kwAllPairsConoverTest", "normalScoresAllPairsTest",
    "vanWaerdenAllPairsTest", "dscfAllPairsTest", "gamesHowellTest", "lsdTest",
    "scheffeTest", "tamhaneT2Test", "tukeyTest", "dunnettT3Test", "pairwise.t.test",
    "pairwise.wilcox.test", "adManyOneTest", "adAllPairsTest", "bwsManyOneTest", 
    
    "bwsAllPairsTest", "welchManyOneTTest"),
  alternative = c("two.sided", "greater", "less"),
  p.adjust.method = c("single-step", p.adjust.methods),
  alpha = 0.05,
  FWER = TRUE,
  replicates = 1000
)

Arguments

mu

numeric vector of group means.

n

number of replicates per group. If n is a scalar, then a balanced design is assumed. Otherwise, n must be a vector of same length as mu.

errfn

the error function. Defaults to "Normal".

parms

a list that denotes the arguments for the error function. Defaults to list(mean=0, sd=1).

test

the multiple comparison test for which the power analysis is to be performed. Defaults to "kwManyOneConoverTest".

alternative

the alternative hypothesis. Defaults to "two.sided", ignored if the selected error function does not use this argument.

p.adjust.method

method for adjusting p values (see p.adjust).

alpha

the nominal level of Type I Error.

FWER

logical, indicates whether the family-wise error should be computed. Defaults to TRUE.

replicates

the number of Monte Carlo replicates or runs. Defaults to 1000.

Details

The linear model of a one-way ANOVA can be written as:

X_{ij} = \mu_i + \epsilon_{ij}

For each Monte Carlo run, the function simulates \epsilon_{ij} based on the given error function and the corresponding parameters. Then the specified all-pairs or many-to-one comparison test is performed. Finally, several effect sizes (Cohen's f ans R-squared), error rates (per comparison error rate, false discovery rate and familywise error rate) and test powers (any-pair power, average per-pair power and all-pairs power) are calculated.

Value

An object with class powerPMCMR.

Examples

## Not run: 
mu <- c(0, 0, 1, 2)
n <- c(5, 4, 5, 5)
set.seed(100)
powerMCTests(mu, n, errfn="Normal",
 parms=list(mean=0, sd=1),
 test="dunnettTest", replicates=1E4)

powerMCTests(mu, n, errfn="Normal",
 parms=list(mean=0, sd=1),
 test="kwManyOneDunnTest", p.adjust.method = "bonferroni",
 replicates=1E4)


## End(Not run)


PMCMRplus documentation built on May 29, 2024, 8:34 a.m.