Skip to contents

Exact one-arm variance confidence bounds for Bernoulli outcomes using the folded-binomial distribution of the sample variance.

Usage

variance_bounds_bernoulli_exact(y, beta_l, beta_u, na.rm = TRUE, tol = 1e-11)

Arguments

y

One-arm Bernoulli outcomes coded as 0 and 1.

beta_l

One-sided endpoint error for the lower variance bound.

beta_u

One-sided endpoint error for the upper variance bound.

na.rm

If TRUE, drop missing outcomes.

tol

Numerical tolerance for endpoint inversion.

Value

A list with lower bound L, upper bound U, folded-binomial variance estimate vhat, method name, sample size n, and folded-count details in statistic.

Examples

y <- c(1, 0, 1, 1, 0, 0, 1, 0)
variance_bounds_bernoulli_exact(y, beta_l = 0.025, beta_u = 0.025)
#> $L
#> [1] 0.1374708
#> 
#> $U
#> [1] 0.25
#> 
#> $vhat
#> [1] 0.25
#> 
#> $method
#> [1] "bernoulli"
#> 
#> $n
#> [1] 8
#> 
#> $statistic
#> $statistic$j
#> [1] 4
#> 
#> $statistic$x
#> [1] 4
#> 
#> $statistic$m
#> [1] 8
#> 
#> $statistic$raw_sample_variance
#> [1] 0.2857143
#> 
#> $statistic$beta_l
#> [1] 0.025
#> 
#> $statistic$beta_u
#> [1] 0.025
#> 
#>