ttest.explore: Explore the power using a t-test under different sample...

Description Usage Arguments Value See Also Examples

Description

ttest.explore computes (through simulation) the power of an experiment that will be analyzed using a t-test for a set of potential sample sizes. When two means are provided, function assumes a two-sample unpaired t-test, and n is interpreted as the sample size of each group (for a total sample size or 2n).

ttest.explore computes (through simulation) the power of an experiment that will be analyzed using a t-test for a set of potential sample sizes. When two means are provided, function assumes a two-sample unpaired t-test, and n is interpreted as the sample size of each group (for a total sample size or 2n).

Usage

1
2
3
4
5
6
7
ttest.explore(lown, topn, means, var, r = 10000,
  alternative = c("two.sided", "less", "greater"), mu = 0, alpha = 0.05,
  conf.level = 0.95, plotit = TRUE)

ttest.explore(lown, topn, means, var, r = 10000,
  alternative = c("two.sided", "less", "greater"), mu = 0, alpha = 0.05,
  conf.level = 0.95, plotit = TRUE)

Arguments

lown

smallest sample size to explore.

topn

largest sample size to explore.

means

either a list with two average values (computes a two-sample t-test) or a single value (computes a one-sample t-test).

var

expected variance in each group.

r

number of simulations to compute power.

alternative

type of alternative hypothesis in binomial test. Must be "two.sided" (default), "greater", or "less".

mu

mean value according to null hypothesis (default = 0). Only used in one sample t-tests.

alpha

significance threshhold.

plotit

logical (default=TRUE) value. Function generates a plot when TRUE and returns a data frame otherwise.

lown

smallest sample size to explore.

topn

largest sample size to explore.

plotit

logical (default=TRUE) value. Function generates a plot when TRUE and returns a data frame otherwise.

Value

The probability of finding p < α with the experiment description.

See Also

ttest.pow, ttest.ppow, ttest.explore, and ttest.pexplore.

Examples

1
2
3
4
5
6
ttest.explore(lown=10, topn=15, means=c(5, 10), var=10) # two-sample t-test. Effective sample sizes are 20 to 30 (10 to 15 per group)
ttest.explore(lown=10, topn=15, means=20, var=10) # one-sample t-test. Comparing if average is different from 0.
ttest.explore(lown=10, topn=15, means=20, var=10, mu=10, alternative="higher") # one-sample t-test. Comparing if average is higher than 10.
ttest.explore(lown=10, topn=15, means=c(5, 10), var=10) # two-sample t-test. Effective sample sizes are 20 to 30 (10 to 15 per group)
ttest.explore(lown=10, topn=15, means=20, var=10) # one-sample t-test. Comparing if average is different from 0.
ttest.explore(lown=10, topn=15, means=20, var=10, mu=10, alternative="higher") # one-sample t-test. Comparing if average is higher than 10.

julianje/mcpa documentation built on May 13, 2019, 6:14 p.m.