Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

PermutationDistribution-methods

Computation of the Permutation Distribution


Description

Methods for computation of the density function, distribution function, quantile function, random numbers and support of the permutation distribution.

Usage

## S4 method for signature 'NullDistribution'
dperm(object, x, ...)
## S4 method for signature 'IndependenceTest'
dperm(object, x, ...)

## S4 method for signature 'NullDistribution'
pperm(object, q, ...)
## S4 method for signature 'IndependenceTest'
pperm(object, q, ...)

## S4 method for signature 'NullDistribution'
qperm(object, p, ...)
## S4 method for signature 'IndependenceTest'
qperm(object, p, ...)

## S4 method for signature 'NullDistribution'
rperm(object, n, ...)
## S4 method for signature 'IndependenceTest'
rperm(object, n, ...)

## S4 method for signature 'NullDistribution'
support(object, ...)
## S4 method for signature 'IndependenceTest'
support(object, ...)

Arguments

object

an object from which the density function, distribution function, quantile function, random numbers or support of the permutation distribution can be computed.

x, q

a numeric vector, the quantiles for which the density function or distribution function is computed.

p

a numeric vector, the probabilities for which the quantile function is computed.

n

a numeric vector, the number of observations. If length(n) > 1, the length is taken to be the number required.

...

further arguments to be passed to methods.

Details

The methods dperm, pperm, qperm, rperm and support compute the density function, distribution function, quantile function, random deviates and support, respectively, of the permutation distribution.

Value

The density function, distribution function, quantile function, random deviates or support of the permutation distribution computed from object. A numeric vector.

Note

The density of asymptotic permutation distributions for maximum-type tests or exact permutation distributions obtained by the split-up algoritm is reported as NA. The quantile function of asymptotic permutation distributions for maximum-type tests cannot be computed for p less than 0.5, due to limitations in the mvtnorm package. The support of exact permutation distributions obtained by the split-up algorithm is reported as NA.

In versions of coin prior to 1.1-0, the support of asymptotic permutation distributions was given as an interval containing 99.999 % of the probability mass. It is now reported as NA.

Examples

## Two-sample problem
dta <- data.frame(
    y = rnorm(20),
    x = gl(2, 10)
)

## Exact Ansari-Bradley test
at <- ansari_test(y ~ x, data = dta, distribution = "exact")

## Support of the exact distribution of the Ansari-Bradley statistic
supp <- support(at)

## Density of the exact distribution of the Ansari-Bradley statistic
dens <- dperm(at, x = supp)

## Plotting the density
plot(supp, dens, type = "s")

## 95% quantile
qperm(at, p = 0.95)

## One-sided p-value
pperm(at, q = statistic(at))

## Random number generation
rperm(at, n = 5)

coin

Conditional Inference Procedures in a Permutation Test Framework

v1.4-1
GPL-2
Authors
Torsten Hothorn [aut, cre] (<https://orcid.org/0000-0001-8301-0471>), Henric Winell [aut] (<https://orcid.org/0000-0001-7995-3047>), Kurt Hornik [aut] (<https://orcid.org/0000-0003-4198-9911>), Mark A. van de Wiel [aut] (<https://orcid.org/0000-0003-4780-8472>), Achim Zeileis [aut] (<https://orcid.org/0000-0003-0918-3766>)
Initial release
2021-02-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.