This test requires that the user knows upper and lower bounds before gathering the data such that the properties of the data generating process imply that all observations will be within these bounds. The data input consists of a sequence of independent observations for each random variable, the two sequences being generated independently. No further distributional assumptions are made.
npMeanUnpaired(x1, x2, lower = 0, upper = 1, iterations = 5000,
alpha = 0.05, alternative = "two.sided", epsilon = 1 * 10^(-6),
ignoreNA = FALSE, max.iterations = 100000)
the (non-empty) numerical data vectors which contain the variables to be tested.
the theoretical lower and upper bounds on the data outcomes known ex-ante before gathering the data.
the number of iterations used, should not be changed if the exact solution should be derived.
the type I error.
a character string describing the alternative hypothesis, can take values "greater", "less" or "two.sided".
the tolerance in terms of probability of the Monte Carlo simulations.
if TRUE
, NA values will be omitted. Default:
FALSE
the maximum number of iterations that should be
carried out. This number could be increased to achieve greater accuracy in
cases where the difference between the threshold probability and theta is
small. Default: 10000
A list with class "nphtest" containing the following components:
a character string indicating the name and type of the test that was performed.
a character string giving the name(s) of the data.
a character string describing the alternative hypothesis.
the sample means of the two variables.
numerical estimate of the rejection
probability of the randomized test, derived by taking an average of
iterations
realizations of the rejection probability.
the lower and upper bounds of the variables.
the specified hypothesized value of the correlation between the variables.
the type I error.
the parameter that minimizes the type II error.
theta
*alpha
, this is the level used when calculating the
average rejection probability during the iterations
logical indicator for whether or not the null hypothesis can be rejected
the number of iterations that were performed.
This is a test of the null hypothesis: \(H_0: E(X_1) \le E(X_2)\) against \(H_1: E(X_1) > E(X_2)\).
This test uses the known bounds of the variables to transform the data into
[0, 1]. Then a random transformation is used to turn the data into
binary-valued variables. On this variables the exact Fischer-Tocher Test
with level pseudoalpha
is performed and the result recorded. The
random transformation and the test are then repeated iterations
times. If the average rejection probability probrej
of the
iterations is at least theta
, then the null hypothesis is rejected.
If however probrej
is too close to the threshold theta
then
the number of iterations is increased. The algorithm keeps increasing the
number of iterations until the bound on the mistake involved by running
these iterations is below epsilon
. This error epsilon is
incorporated into the overall level alpha
in order to maintain that
the test is exact.
theta
is found in an optimization procedure. theta
is chosen
as to bring the type II error to 0.5. Please see the cited paper below for
further information.
Karl Schlag (2008), A New Method for Constructing Exact Tests without Making any Assumptions. Available at https://ideas.repec.org/p/upf/upfgen/1109.html.
# NOT RUN {
## test whether countries with french origin score lower than
## countries with no french origin
data(french)
npMeanUnpaired(french[[1]], french[[2]], alternative = "less", ignoreNA =
TRUE)
## test whether American tend to be more generous than Isrealis
## in a round of the Ultimatum game
data(bargaining)
npMeanUnpaired(bargaining$US, bargaining$IS, lower = 0, upper = 10, ignoreNA = TRUE)
# }
Run the code above in your browser using DataLab