samplesizeOnePropExact: Sample Size for Binomial One-Sample Exact Test

View source: R/RcppExports.R

samplesizeOnePropExactR Documentation

Sample Size for Binomial One-Sample Exact Test

Description

Obtains the sample size for binomial one-sample exact test.

Usage

samplesizeOnePropExact(
  beta = 0.2,
  piH0 = NA_real_,
  pi = NA_real_,
  alpha = 0.025,
  max_n_search = 1000L,
  window = 10L
)

Arguments

beta

The type II error.

piH0

The response probability under the null hypothesis.

pi

The response probability under the alternative hypothesis.

alpha

The one-sided significance level. Defaults to 0.025.

max_n_search

The maximum sample size to search up to. If no sample size up to this value satisfies the windowed power criterion, an error is thrown.

window

The number of consecutive sample sizes that must all satisfy the power criterion to confirm the found sample size. This is to mitigate non-monotonicity of power in sample size for the exact test.

Value

A data frame containing the critical value of the number of responses for rejecting the null hypothesis, the attained type I error, the power for the exact test, the sample size, the response probabilities under the null and alternative hypotheses, and the direction of the alternative.

Author(s)

Kaifeng Lu, kaifenglu@gmail.com

Examples

samplesizeOnePropExact(beta = 0.2, piH0 = 0.15, pi = 0.25, alpha = 0.025)


lrstat documentation built on May 13, 2026, 9:06 a.m.