Description Usage Arguments Details Value Author(s) References See Also Examples
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 observations, each being an independent realization of the random variable. No further distributional assumptions are made.
1 2 3  npMeanSingle(x, mu, lower = 0, upper = 1, alternative = "two.sided",
iterations = 5000, alpha = 0.05, epsilon = 1 * 10^(6),
ignoreNA = FALSE, max.iterations = 100000)

x 
a (nonempty) numeric vector of data values. 
mu 
threshold value for the null hypothesis. 
lower, upper 
the theoretical lower and upper bounds on the data outcomes known exante before gathering the data. 
alternative 
a character string describing the alternative hypothesis, can take values "greater", "less" or "two.sided". 
iterations 
the number of iterations used, should not be changed if the exact solution should be derived 
alpha 
the type I error. 
epsilon 
the tolerance in terms of probability of the Monte Carlo simulations. 
ignoreNA 
if 
max.iterations 
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: 
For any μ that lies between the two bounds, under alternative = "greater", it is a test of the null hypothesis H_0 : E(X) ≤ μ against the alternative hypothesis H_1 : E(X) > μ.
Using the known bounds, the data is transformed to lie in [0, 1] using an
affine transformation. Then the data is randomly transformed into a new
data set that has values 0, mu
and 1 using a mean preserving
transformation. The exact randomized binomial test is then used to
calculate the rejection probability of this under new data when level is
theta
*alpha
. This random transformation is repeated
iterations
times. If the average rejection probability is greater
than theta, one can reject the null hypothesis. If however the average
rejection probability is too close to theta then the iterations are
continued. The values of theta
and a value of mu
in the
alternative hypothesis is found in an optimization procedure to maximize
the set of parameters in the alternative hypothesis under which the type II
error probability is below 0.5. Please see the cited paper below for
further information.
A list with class "nphtest" containing the following components:
method 
a character string indicating the name and type of the test that was performed. 
data.name 
a character string giving the name(s) of the data. 
alternative 
a character string describing the alternative hypothesis. 
estimate 
the estimated mean or difference in means depending on whether it was a onesample test or a twosample test. 
probrej 
numerical estimate of the rejection
probability of the randomized test, derived by taking an average of

bounds 
the lower and upper bounds of the variables. 
null.value 
the specified hypothesized value of the correlation between the variables. 
alpha 
the type I error 
theta 
the parameter that minimizes the type II error. 
pseudoalpha 

rejection 
logical indicator for whether or not the null hypothesis can be rejected. 
iterations 
the number of iterations that were performed. 
Karl Schlag, Peter Saffert and Oliver Reiter
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.
https://homepage.univie.ac.at/karl.schlag/statistics.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14  ## test whether Americans gave more than 5 dollars in a round of
## the Ultimatum game
data(bargaining)
us_offers < bargaining$US
npMeanSingle(us_offers, mu = 5, lower = 0, upper = 10, alternative =
"greater", ignoreNA = TRUE) ## no rejection
## test if the decrease in pain before and after the surgery is smaller
## than 50
data(pain)
pain$decrease < with(pain, before  after)
without_pc < pain[pain$pc == 0, "decrease"]
npMeanSingle(without_pc, mu = 50, lower = 0, upper = 100,
alternative = "less")

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.