mkdeltamid {simctest}R Documentation

Function mkdeltamid in Package ‘simctest’

Description

Easy creation of adaptive delta function

Usage

mkdeltamid(mindelta=0.02, maxdelta=0.1, llim=0.05, rlim=0.95)

Arguments

mindelta

desired length of CI for regions of interest, such as when the power is less than 0.05 or greater than 0.95.

maxdelta

desired length of CI when power is not in reregion of interest, e.g. between 0.05 and 0.95

llim

change if want different left limit (i.e. not 0.05)

rlim

change if want different right limit (i.e. not 0.95)

Value

A function, say deltamid, that specifies the user's desired precision depending on the midpoint of the computed confidence interval. If the current confidence interval has a midpoint M, then the algorithm will stop if deltamid(M) <= length of CI.

Author(s)

Axel Gandy and Patrick Rubin-Delanchy

References

Gandy, A. and Rubin-Delanchy, P (2013). An Algorithm to compute the power of Monte Carlo tests with guaranteed precision. Annals of Statistics, 41(1):125–142.

Examples

## only care about powers around 0.9 or higher
## (e.g. if want to check that the test is powerful enough).

deltamid <- mkdeltamid(mindelta=0.02, maxdelta=1, llim=0, rlim=0.9)

genstream <- function(){p <- runif(1); function(N){runif(N) <= p}}

## The power is 0.05. The algorithm should stop as soon as it is clear
## that the power is not larger than 0.9. (Must specify epsilon
## if using non-standard delta.)

res <- mcp(genstream, alpha=0.05, delta="adaptive", cp=0.99,
options=list(deltamid = deltamid, epsilon = 0.0001))

##should stop early.
res

[Package simctest version 2.6 Index]