Description Usage Arguments Details Value Examples
View source: R/critical_value.R
this function calculates the test statistic critical value C which guarantees significance level (false discovery rate) alpha
1 | critical_value(p_1_hat, n_1, p_0_hat, n_0, alpha, s, h, gamma)
|
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 |
test significance level |
s |
either 1 (for one sided test) or 2 (for two sided test) |
h |
number of hypothesis tested in the same experiment (for Bonferroni correction) |
gamma |
minimum required lift |
In 2 sided tests each usually represents a different treatment. When doing one-sided tests it's usually the case that population 1 is considered the treatment and population 0 serves as the control. At any rate, one sided tests are always of the form p_1 - p_0 > C. For that reason for 1 sided tests one must set: gamma >= 0
critical value C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 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
critical_value(
p_1_hat = 0.225, n_1 = 10000, p_0_hat = 0.2, n_0 = 8000,
alpha = 0.05, s = 1, h = 2, gamma = 0.01
)
# this is significant
## hypothesis test number 2
critical_value(
p_1_hat = 0.114, n_1 = 5000, p_0_hat = 0.1, n_0 = 3000,
alpha = 0.05, s = 2, h = 2, gamma = 0
)
# this is insignificant
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.