get_level_from_bounds_two_sided | R Documentation |
For a test of uniformity of i.i.d. observations on the unit interval, this function will determine the significance
level as a function of the rejection region. Suppose n
observations are drawn i.i.d. from some CDF F(x) on the unit interval,
and it is desired to test the null hypothesis that F(x) = x for all x in (0, 1) against a two-sided alternative.
Suppose the acceptance region for the test is described by a set of intervals, one for each order statistic.
Given the bounds for these intervals, this function calculates the significance level of the test where the
null hypothesis is rejected if at least one of the order statistics is outside its corresponding interval.
get_level_from_bounds_two_sided(lower_bounds, upper_bounds)
lower_bounds |
Numeric vector where the ith component is the lower bound for the acceptance interval for the ith order statistic. The components must lie in [0, 1], and each component must be greater than or equal to the previous one. |
upper_bounds |
Numeric vector of the same length as |
Uses the method of Moscovich and Nadler (2016) as implemented in Crossprob (Moscovich 2020).
Global Significance Level \alpha
# For X1, X2 iid unif(0,1), calculate 1 - P(.1 < min(X1, X2) < .6 and .5 < max(X1, X2) < .9)
get_level_from_bounds_two_sided(lower_bounds = c(.1, .5), upper_bounds = c(.6, .9))
# Finds the global significance level corresponding to the local level eta.
# Suppose we reject the null hypothesis that X1, ..., Xn are iid unif(0, 1) if and only if at least
# one of the order statistics X(i) is significantly different from
# its null distribution based on a level-eta
# two-sided test, i.e. we reject if and only if X(i) is outside the interval
# (qbeta(eta/2, i, n - i + 1), qbeta(1 - eta/2, i, n - i + 1)) for at least one i.
# The lines of code below calculate the global significance level of
# the test (which is necessarily larger than eta if n > 1).
n <- 100
eta <- .05
lb <- qbeta(eta / 2, c(1:n), c(n:1))
ub <- qbeta(1 - eta / 2, c(1:n), c(n:1))
get_level_from_bounds_two_sided(lower_bounds = lb, upper_bounds = ub)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.