CI: Calculate proportion difference confidence interval

Description Usage Arguments Value Examples

View source: R/CI.R

Description

this function calculates the proportion difference confidence interval. This interval has probability alpha of containing the real difference.

Usage

1
CI(p_1_hat, n_1, p_0_hat, n_0, alpha, h)

Arguments

p_1_hat

estimated population 1 p parameter

n_1

population 1 sample size

p_0_hat

estimated population 0 p parameter

n_0

population 0 sample size

alpha

confidence interval significance level

h

number of hypothesis tested in the same experiment (for Bonferroni correction)

Value

a data.frame with 2 columns:

lower_bound

confidence interval lower bound

upper_bound

confidence interval upper bound

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
library(hype)

# For a thorugh simulation validation see
# https://github.com/IyarLin/hype/blob/master/inst/variuos_results_for_hypothesis_testing.pdf

# below we'll generate critical values for 2 hypothesis tests performed
# in the same experiemnt
# note that h is set to 2 in order to reflect that

## hypothesis test number 1
CI(
  p_1_hat = 0.212, n_1 = 10000, p_0_hat = 0.219, n_0 = 8000,
  alpha = 0.05, h = 2
)

## hypothesis test number 2
CI(
  p_1_hat = 0.11, n_1 = 5000, p_0_hat = 0.132, n_0 = 3000,
  alpha = 0.05, h = 2
)

IyarLin/hype documentation built on July 20, 2020, 4:07 p.m.