perm.test {exactRankTests} | R Documentation |

Performs the permutation test for the one and two sample problem.

## Default S3 method: perm.test(x, y, paired=FALSE, alternative=c("two.sided", "less", "greater"), mu=0, exact=NULL, conf.int=FALSE, conf.level=0.95, tol=NULL, ...) ## S3 method for class 'formula' perm.test(formula, data, subset, na.action, ...)

`x` |
numeric vector of integer data values. |

`y` |
numeric vector of integer data values. |

`paired` |
a logical indicating whether you want a paired test. |

`alternative` |
the alternative hypothesis must be
one of |

`mu` |
a number specifying an optional location parameter. |

`exact` |
a logical indicating whether an exact p-value should be computed. |

`conf.int` |
a logical indicating whether a confidence interval should be computed. |

`conf.level` |
confidence level of the interval. |

`tol` |
real. real valued scores are mapped into integers by
multiplication. Make sure that the absolute difference between
the "true" quantile and the approximated quantile is less
than |

`formula` |
a formula of the form |

`data` |
an optional data frame containing the variables in the model formula. |

`subset` |
an optional vector specifying a subset of observations to be used. |

`na.action` |
a function which indicates what should happen when
the data contain |

`...` |
further arguments to be passed to or from methods. |

The permutation test is performed for integer valued observations or
scores. If real values `x`

or `y`

are passed to this function
the following applies: if `exact`

is true (i.e. the sample size is
less than 50 observations) and `tol`

is not given, the scores are
mapped into *\{1,…,N\}*, see `pperm`

for the details.
Otherwise the p-values are computed using `tol`

. If the sample size
exceeds $50$ observations, the usual normal approximation is used.

P-values are computed according to the StatXact-manual, see
`pperm`

.

For (in principle) continuous variables the confidence sets represent the "largest shift in location being consistent with the observations". For discrete variables with only a few categories they are hard to interpret. In the case of binary data (e.g. success / failure) the confidence sets can be interpreted as the differences of two success-rates covered by the data. For a detailed description see R\"ohmel (1996).

Confidence intervals are only available for independent samples. When the
sample sizes are unbalanced, `length(x)`

needs to be smaller than
`length(y)`

.

A list with class `"htest"`

containing the following components:

`statistic` |
the value of the test statistic with a name describing it. |

`p.value` |
the p-value for the test. |

`pointprob` |
this gives the probability of observing the test statistic itself. |

`null.value` |
the location parameter |

`alternative` |
a character string describing the alternative hypothesis. |

`method` |
the type of test applied. |

`data.name` |
a character string giving the names of the data. |

`conf.int` |
a confidence interval for the location parameter.
(Only present if argument |

Confidence intervals may need some cpu-time ...

Torsten Hothorn <Torsten.Hothorn@rzmail.uni-erlangen.de>

Joachim R\"ohmel (1996),
Precision intervals for estimates of the difference in success
rates for binary random variables based on the permutation principle.
*Biometrical Journal*, **38**(8), 977–993.

Cyrus R. Mehta & Nitin R. Patel (2001),
*StatXact-5 for Windows.*
Manual, Cytel Software Cooperation, Cambridge, USA

# Example from Gardner & Altman (1989), p. 30 # two treatments A and B, 1 means improvement, 0 means no improvement # confidence sets cf. R\"ohmel (1996) A <- c(rep(1, 61), rep(0, 19)) B <- c(rep(1, 45), rep(0, 35)) perm.test(A, B, conf.int=TRUE, exact=TRUE) # one-sample AIDS data (differences only), Methta and Patel (2001), # Table 8.1 page 181 data(sal) attach(sal) ppdiff <- pre - post detach(sal) # p-values in StatXact == 0.0011 one-sided, 0.0021 two.sided, page 183 perm.test(ppdiff) perm.test(ppdiff, alternative="less") perm.test(ppdiff, exact=FALSE)

[Package *exactRankTests* version 0.8-30 Index]