The data input consists of a sequence of independent realizations observations of each random variable, observations of the different sequences also being independent.
npStochinUnpaired(x1, x2, d = 0, alternative = "two.sided",
iterations = 5000, alpha = 0.05, epsilon = 1 * 10^(-6),
ignoreNA = FALSE, max.iterations = 100000)
the (non-empty) numerical data vectors which contain the variables to be tested.
the maximal difference in probabilities assumed \(H_0 : P(X_2 > X_1) - P(X_2 < X_1) <= d\). Default is 0.
a character string describing the alternative
hypothesis. Default is "greater". If "less" is given, x1
and
x2
are switched for each other.
the number of iterations used, should not be changed if the exact solution should be derived.
the type I error.
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.
an estimate of \(P(x_2 > x_1) - P(x_2 < x_1)\).
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.
Given \(-1 < d < 1\) it is a test of the null hypothesis \(H_0 : P(X_2 > X_1) \le P(X_2 < X_1) + d\) against the alternative hypothesis \(H_1 : P(X_2 > X_1) > P(X_2 < X_1) + d\).
The data is randomly matched into pairs and then treats them as matched
pairs. The number of pairs is equal to the number of observations in the
smaller sequence. The exact randomized test is then used to determine if
sufficiently many occurrences of \(x_2 > x_1\) occur when compared to how
often \(x_2 < x_1\) occurs, using level theta
*alpha
. The
matching into pairs is repeated iterations
times. The test gives a
rejection of the average rejection probability in these iterations lies
above theta
. If the average rejection probability lies too close to
theta then the number of iterations is increased.
theta
is determined to maximize the set of differences
\(P(X_2>X_1) - P(X_2<X_1)\) belonging to the alternative hypothesis in
which the type II error probability lies below 0.5. For more details see
the paper.
Schlag, Karl H. 2008, A New Method for Constructing Exact Tests without Making any Assumptions, Department of Economics and Business Working Paper 1109, Universitat Pompeu Fabra. Available at https://ideas.repec.org/p/upf/upfgen/1109.html.
# NOT RUN {
data(french)
origin <- french$french.origin
rest <- french$rest.of.civil
npStochinUnpaired(origin, rest, ignoreNA = TRUE)
# }
Run the code above in your browser using DataLab