npVarianceSingle: A test for the variance of a bounded random variable based on...

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

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.

Usage

1
2
3
npVarianceSingle(x, v, lower = 0, upper = 1,
  alternative = "two.sided", alpha = 0.05, iterations = 5000,
  epsilon = 1 * 10^(-6), ignoreNA = FALSE, max.iterations = 100000)

Arguments

x

a (non-empty) numeric vector of data values.

v

the value of the variance to be tested as H_0: Var(x) ≤ v.

lower, upper

the theoretical lower and upper bounds on the data outcomes known ex-ante before gathering the data.

alternative

a character string describing the alternative hypothesis, can take values "greater", "less" or "two.sided"

alpha

the type I error.

iterations

the number of iterations used, should not be changed if the exact solution should be derived.

epsilon

the tolerance in terms of probability of the Monte Carlo simulations.

ignoreNA

if TRUE, NA values will be omitted. Default: FALSE

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: 10000

Details

This is a test of the null hypothesis H_0: Var(X) ≤ v against H_1 : Var(X) > v.

This test randomly matches the data into pairs, then computes for each pair the square of the difference and continues with the resulting sequence with half as many observations as npMeanSingle. See the cited paper for more information.

Value

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 one-sample test or a two-sample test.

probrej

numerical estimate of the rejection probability of the randomized test, derived by taking an average of iterations realizations of the rejection probability.

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

theta*alpha, this is the level used when calculating the average rejection probability during the iterations.

rejection

logical indicator for whether or not the null hypothesis can be rejected.

iterations

the number of iterations that were performed.

Author(s)

Karl Schlag and Oliver Reiter

References

Karl Schlag (2008). Exact tests for correlation and for the slope in simple linear regressions without making assumptions. Available at https://ideas.repec.org/p/upf/upfgen/1097.html.

See Also

https://homepage.univie.ac.at/karl.schlag/statistics.php

Examples

1
2
3
4
5
## see if the minority share holder shores have a variance greater
## than 0.05
data(mshscores)
scores <- unlist(mshscores)
npVarianceSingle(scores, lower = 0, upper = 1, v = 0.05, ignoreNA = TRUE)

zauster/npExact documentation built on May 4, 2019, 9:12 p.m.