ttest.pexplore: Explore power as a function of sample sie using a one- or...

Description Usage Arguments Value See Also Examples

Description

ttest.pexplore computes (via simulation) the power of an experiment that will be analyzed using a t-test for a range of sample sizes. Rather than taking a theoretical distribution, this function takes empirical data and bootstraps them to calculate the power. For an equivalent function that does not rely on pilot data see ttestpower.

ttest.pexplore computes (via simulation) the power of an experiment that will be analyzed using a t-test for a range of sample sizes. Rather than taking a theoretical distribution, this function takes empirical data and bootstraps them to calculate the power. For an equivalent function that does not rely on pilot data see ttestpower.

Usage

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

ttest.pexplore(x, y = NULL, lown, topn, r = 10000,
  alternative = c("two.sided", "less", "greater"), mu = NULL,
  alpha = 0.05, conf.level = 0.95, plotit = TRUE)

Arguments

lown

smallest sample size to explore.

topn

largest sample size to explore.

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.

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.pexplore(x=c(0, 5, 10), lown=16, topn=24) # Power for a one-sample t-test with n in 16-24. Pilot data consists of three data points.
ttest.pexplore(x=c(0, 5, 10), lown=16, topn=24,mu = -5) # Same as above, changing the avarege under the null to -5.
ttest.pexplore(x=c(0, 5, 10), lown=16, topn=24, y=c(9, 3, 2, 1)) # Power for a two-sample t-test with n=16-24 (per condition) using unbalanced pilot data.
ttest.pexplore(x=c(0, 5, 10), lown=16, topn=24) # Power for a one-sample t-test with n in 16-24. Pilot data consists of three data points.
ttest.pexplore(x=c(0, 5, 10), lown=16, topn=24,mu = -5) # Same as above, changing the avarege under the null to -5.
ttest.pexplore(x=c(0, 5, 10), lown=16, topn=24, y=c(9, 3, 2, 1)) # Power for a two-sample t-test with n=16-24 (per condition) using unbalanced pilot data.

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