compute_power {boodd}R Documentation

Compute the Power of a Statistical Test

Description

This function computes the power of a statistical test given the distributions under the null and alternative hypotheses for a specified significance level.

Usage

compute_power(null_dist, alt_dist, alpha)

Arguments

null_dist

A numeric vector representing the distribution under the null hypothesis.

alt_dist

A numeric vector representing the distribution under an alternative hypothesis.

alpha

A numeric value in (0,1); type I error rate of the test.

Details

The function calculates the proportion of values of the alternative distribution that falls into the critical region determined by the distribution under the null for an error rate alpha.

Value

A numeric value estimating the power of the test.

References

Bertail, P. and Dudek, A. (2025). Bootstrap for Dependent Data, with an R package (by Bernard Desgraupes and Karolina Marek) - submitted.

Beran, R. (1986). Simulated Power Functions. The Annals of Statistics, 14, 151-173.

See Also

pkc, bootglm, bootsemi.

Examples

# Generate two normally distributed samples as null and alternative distributions
set.seed(123)
null_dist <- rnorm(1000, mean = 0, sd = 1) # Null distribution
alt_dist <- rnorm(1000, mean = 0.5, sd = 1) # Alternative distribution
alpha <- 0.05 # Significance level
# Compute the power of the test
test_power <- compute_power(null_dist, alt_dist, alpha)
print(test_power)

[Package boodd version 0.1 Index]