emp_power: Empirical power of a t-test

Description Usage Arguments Value See Also

Description

This function takes a reference mean value, sample size, mean, standard deviation, significance level and computes the empirical power of R randomly drawn normally distributed samples with mean mu, standard deviation sd and sample size n. The function can compute the power of one-sample t-tests and two-sample t-tests (variance is always assumed to be equal). This function will always return the data it generates internally because its focus is not on efficiency but rather reproducibility

Usage

1
2
emp_power(n, mu, mu0, sd, alpha = 0.05, R = 1000, type = c("one_sample",
  "two_sample"), ...)

Arguments

n

numeric. sample size

mu

mean value used to draw random normal samples. See ?rnorm() for more information

mu0

numeric. mean of control group if running a two-sample t-test or, if type = "one_sample", a value indicating the true value of the mean (or difference in means if you are performing a one sample test). See ?t.test() for more information

sd

standard deviation used to draw random normal samples

alpha

significance level

R

number of replications

type

string. if 'one_sample', then a one-sample t-test, else a two-sample t-test

...

optional arguments. You may pass selected parameters from the t.test() function. You may also pass the following parameters:

  • n0: numeric. sample size of control group if running a two-sample t-test. If not supplied then the function will use the value of n defined above.

  • sd0: numeric. standard deviation of control group if running a two-sample t-test. If not supplied then the function will use the value of sd defined above.

  • alternative: a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". You can specify just the initial letter. See ?t.test() for more information

Note that you are required to either pass all parameters related to the control group (n0, mu0, sd0) or a parameter related to the reference mean (ref_mu).

Value

list containing:

See Also

Rizzo, Maria L. 'Statistical Computing with R. Chapman and Hall/CRC, 2007'. (pp. 167-169)


JasperHG90/meerkat documentation built on May 31, 2019, 5:39 a.m.