tests {hyper2}R Documentation

Hypothesis testing

Description

Tests different nulls against a free alternative

Usage

equalp.test(H, startp=NULL, ...)
knownp.test(H, p, ...)
samep.test(H, i, give=FALSE, startp=NULL, ...)
specificp.test(H, i, specificp=1/size(H),
         alternative = c("two.sided","less","greater"),  ...)
specificp.ne.test(H, i, specificp=1/size(H), ...)
specificp.gt.test(H, i, specificp=1/size(H), delta=1e-5, ...)
specificp.lt.test(H, i, specificp=1/size(H), ...)
## S3 method for class 'hyper2test'
print(x, ...)

Arguments

H

A likelihood function, an object of class hyper2

p

In equalp.test(), putative strength vector to be tested

...

Further arguments passed by equalp.test() to maxp() and ignored by print.hyper2test()

startp

Starting value for optimization

i

A character vector of names

specificp

Strength, real number between 0 and 1

alternative

a character string specifying the alternative hypothesis, must be one of two.sided (default), greater or less. You can specify just the initial letter (taken from t.test.Rd)

give

Boolean, with TRUE meaning to return more detailed debugging information, and default FALSE meaning to return a more user-friendly object of class equalp.test, which has its own print method

x

Object of class equalp.test, the result of equalp.test()

delta

Small value for numerical stability

Details

Given a hyper2 likelihood function, there are a number of natural questions to ask about the strengths of the players; see Hankin 2010 (JSS) for examples. An extended discussion is presented in vignette “hyper2” and the functions documented here cover most of the tests used in the vignette.

The tests return an object with class hyper2test, which has its own print method.

Value

The test functions return a list with class "hyper2test" containing the following components:

statistic

the difference in support between the null and alternative

p.value

the (asymptotic) p-value for the test, based on Wilks's theorem

estimate

the maximum likelihood estimate for p

method

a character string indicating what type of test was performed

data.name

a character string giving the name(s) of the data.

Note

Function specificp.gt.test() includes quite a bit of messing about to ensure that frequently-used idiom like specificp.gt.test(icons,"NB",0) works as expected, testing a null of p_NB=0 (observe that specificp.ne.test(icons,"NB",0) and specificp.gt.test(icons,"NB",0) will (correctly) throw an error). In the case of testing a strength's being zero, the support function is often quite badly-behaved near the constraint [think tossing a coin with probability p twice, observing one head and one tail, and testing p=0; at the constraint, the likelihood is zero, the support negative infinity, and the gradient of the support is infinite]. Numerically, the code tests p_NB=delta. Note that similar machinations are not required in specificp.lt.test() because a null of p_NB=1 is unrealistic.

Function samep.test() does not have access to gradient information so it is slow, inaccurate, and may fail completely for high-dimensional datasets. If any(i==n), this constrains the fillup value; this makes no difference mathematically but the function idiom is involved.

In functions specificp.??.test(H,i,...), if i is not present in H, an error is returned although technically the result should be “not enough evidence to reject”, as H is uninformative about i.

See Also

maxp

Examples


equalp.test(chess)

# samep.test(icons,c("NB","L"))
# knownp.test(icons,zipf(icons))


[Package hyper2 version 3.1-0 Index]