Package 'ump'

Title: Uniformly Most Powerful Tests
Description: Does uniformly most powerful (UMP) and uniformly most powerful unbiased (UMPU) tests. At present only distribution implemented is binomial distribution. Also does fuzzy tests and confidence intervals (following Geyer and Meeden, 2005, <doi:10.1214/088342305000000340>) for the binomial distribution (one-tailed procedures based on UMP test and two-tailed procedures based on UMPU test).
Authors: Charles J. Geyer <[email protected]> and Glen D. Meeden <[email protected]>
Maintainer: Charles J. Geyer <[email protected]>
License: MIT + file LICENSE
Version: 0.5-8
Built: 2025-03-06 03:47:29 UTC
Source: https://github.com/cran/ump

Help Index


Abstract Randomized P-value for the Binomial Distribution

Description

Calculate the abstract randomized P-value for the UMPU two-tailed test for the binomial distribution.

Usage

arpv.binom(x, n, p, plot = TRUE, ...)

Arguments

x

binomial observations.

n

number of observations.

p

the success probability under the null hypothesis.

plot

if TRUE make a plot.

...

additional arguments passed to arpv.plot.

Details

The first three arguments must be scalar. Evaluates the distribution function of the abstract randomized P-value for the UMPU two-tailed test for the binomial distribution, which is a continuous, piecewise linear function. Gives the knots.

Value

a list containing two components:

alpha

significance level values at the knots.

phi

distribution function values at the knots.

Examples

library(ump)
print(arpv.binom(10, 10, 0.7, plot = FALSE))
arpv.binom(10, 10, 0.7)
arpv.binom(10, 10, 0.7, df = FALSE)

Plot Abstract Randomized P-value

Description

Plot ether the distribution function or the probability density function of an abstract randomized P-value

Usage

arpv.plot(alpha, phi, df = TRUE, verticals = TRUE)

Arguments

alpha

significance levels at which the density is discontinuous ("knots").

phi

values of the distribution function at these knots.

df

if TRUE plot the distribution function, otherwise the density.

verticals

if TRUE plot vertical lines at the jumps of the density. Ignored if df == TRUE.

Value

none.

Examples

out <- arpv.binom(10, 10, 0.7)
arpv.plot(out$alpha, out$phi)
arpv.plot(out$alpha, out$phi, df = FALSE)

Abstract Randomized P-value for the Binomial Distribution

Description

Calculate the abstract randomized P-value for the UMPU two-tailed test for the binomial distribution.

Usage

fci.binom(x, n, alpha = 0.05, p = seq(0, 1, length = 10001), flat = 1 / 4)

Arguments

x

binomial observation.

n

number of observations.

alpha

the significance level, one minus the coverage probability.

p

the vector of parameter values at which (the membership function of) the fuzzy confidence interval is evaluated.

flat

the amount of flat parts of the membership function shown, expressed as a fraction of the curved parts.

Details

prints the core and support of the fuzzy confidence interval and makes one or two plots (as appropriate) showing the edges of the fuzzy interval.

Value

none

Examples

library(ump)
fci.binom(4, 10)
fci.binom(0, 10)
fci.binom(9, 10)

UMPU Test for the Binomial Distribution

Description

Calculate the uniformly most powerful unbiased (UMPU) two-tailed test for the binomial distribution.

Usage

umpu.binom(x, n, p, alpha, maxiter = 10, tol = 1e-9)

Arguments

x

binomial observations.

n

number of observations.

p

the success probability under the null hypothesis.

alpha

the significance level.

maxiter

the maximum number of iterations allowed.

tol

tolerance used in testing floating point numbers.

Details

At most one of x, p, and alpha is allowed to be a vector. Evaluates the critical function for the UMPU two-tailed test for the binomial distribution, which satisfies the following

    x <- seq(0, n)
    phix <- umpu.binom(x, n, p, alpha)
    px <- dbinom(x, n, p)
    sum(phix * px) == alpha
    sum(x * phix * px) == n * p * alpha
  

when p is strictly between zero and one.

Value

a vector of values of the critical function.

Examples

library(ump)
umpu.binom(0:10, 10, 0.6, 0.1)