pkc {boodd}R Documentation

Plot Kernel Density Estimates for Null and Alternative Distributions.

Description

Plots kernel density estimates for null and alternative distributions, showing the acceptance region for a hypothesis test and highlighting the type II error against an alternative hypothesis.

Usage

pkc(nul_dist, alt_dist, alpha)

Arguments

nul_dist

Numeric vector representing the distribution under the null hypothesis.

alt_dist

Numeric vector representing the distribution under an alternative hypothesis.

alpha

Numeric value between [0,0.5]; the significance level of the test (type I error rate).

Details

This function visualizes the kernel density estimates of two distributions: one under the null hypothesis and the other one under an alternative hypothesis. It highlights the acceptance region of the test (using the significance level alpha) and the region corresponding to type II error. This visual representation can be useful for understanding the behaviour of bootstrapped test statistics and the trade-off between type I and type II errors.

Value

Creates a plot showing the kernel density estimates of the null and alternative distributions with the relevant regions highlighted. The function does not return any values.

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. Ann. Statist., 14, 151 - 173.

See Also

compute_power.

Examples

# Example: Comparing null and alternative distributions
# Generate two normally distributed samples
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

# Plot kernel density estimates
pkc(null_dist, alt_dist, alpha)

[Package boodd version 0.1 Index]