ci.meandiff: Power calculation for precision analysis (confidence...

ci.meandiffR Documentation

Power calculation for precision analysis (confidence interval) for a difference between two means

Description

Calculates the "power" of a confidence interval for a difference between two means, that is, the probability of achieving a 100(1 - alpha) percent confidence interval with halfwidth not greater than a specified value. This function can solve for power, n1, n.ratio or alpha.

Usage

ci.meandiff(
  n1 = NULL,
  n.ratio = 1,
  halfwidth = NULL,
  sd = 1,
  alpha = 0.05,
  power = NULL,
  cond = FALSE,
  v = FALSE
)

Arguments

n1

The sample size for group 1.

n.ratio

The ratio n2/n1 between the sample sizes of two groups; defaults to 1 (equal group sizes).

halfwidth

The desired halfwidth for the difference in means.

sd

The estimated standard deviation; defaults to 1. Equal SDs in each group are assumed.

alpha

The significance level (type 1 error rate); defaults to 0.05.

power

The specified level of power.

cond

Specify using unconditional or conditional probability. Defaults to FALSE.

v

Either TRUE for verbose output or FALSE (default) to output computed argument only.

Details

The unconditional probability is the probability of obtaining the desired precision (i.e., that the observed halfwidth does not exceed the desired halfwidth) regardless of whether or not the confidence interval includes the true parameter value. The conditional probability is the probability of both obtaining the desired precision and having the interval include the true parameter value.

Value

A list of the arguments (including the computed one).

Examples

ci.meandiff(n1 = NULL, halfwidth = 0.25, power = 0.8)
ci.meandiff(n1 = 134, halfwidth = 0.25, cond = TRUE)

powertools documentation built on April 4, 2025, 5:02 a.m.