Learn R Programming

coin (version 1.1-0)

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

## S3 method for class 'AsymptNullDistribution':
dperm(object, x, \dots)
## S3 method for class 'IndependenceTest':
dperm(object, x, \dots)
## S3 method for class 'NullDistribution':
dperm(object, x, \dots)

## S3 method for class 'AsymptNullDistribution': pperm(object, q, \dots) ## S3 method for class 'IndependenceTest': pperm(object, q, \dots) ## S3 method for class 'NullDistribution': pperm(object, q, \dots)

## S3 method for class 'AsymptNullDistribution': qperm(object, p, \dots) ## S3 method for class 'IndependenceTest': qperm(object, p, \dots) ## S3 method for class 'NullDistribution': qperm(object, p, \dots)

## S3 method for class 'IndependenceTest': rperm(object, n, \dots) ## S3 method for class 'NullDistribution': rperm(object, n, \dots)

## S3 method for class 'IndependenceTest': support(object, \dots) ## S3 method for class 'NullDistribution': support(object, \dots)

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.

Value

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

Details

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

Examples

Run this code
## 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, supp)

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

## 95 \% quantile
qperm(at, 0.95)

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

## Random number generation
rperm(at, 5)

Run the code above in your browser using DataLab