# perm.t.test: Permutation Student's t-test In RVAideMemoire: Testing and Plotting Procedures for Biostatistics

## Description

Performs a permutation Student's t-test.

## Usage

 ```1 2 3 4 5 6 7 8``` ```perm.t.test(x, ...) ## Default S3 method: perm.t.test(x, y, paired = FALSE, ...) ## S3 method for class 'formula' perm.t.test(formula, data, alternative = c("two.sided", "less", "greater"), paired = FALSE, nperm = 999, progress = TRUE, ...) ```

## Arguments

 `x` a numeric vector of data values. `y` a numeric vector of data values. `paired` a logical indicating whether you want a paired t-test. `formula` a formula of the form `a ~ b` where `a` gives the data values and `b` a factor with 2 levels giving the corresponding groups. `data` an optional data frame containing the variables in the formula `formula`. By default the variables are taken from `environment(formula)`. `alternative` a character string specifying the alternative hypothesis, must be one of `"two.sided"` (default), `"greater"` or `"less"`. `nperm` number of permutations. `progress` logical indicating if the progress bar should be displayed. `...` further arguments to be passed to or from other methods.

## Details

The function deals with the limitted floating point precision, which can bias calculation of p-values based on a discrete test statistic distribution.

## Value

 `statistic` test statistics of the parametric test. `permutations` number of permutations. `p.value` p-value of the permutation test. `estimate` the estimated mean or difference in means depending on whether it was a paired or not paired test. `alternative` a character string describing the alternative hypothesis. `method` a character string indicating what type of t-test was performed. `data.name` a character string giving the name(s) of the data. `null.value` the specified hypothesized value of the mean difference, always 0.

## Author(s)

Maxime Herv<e9> <[email protected]>

`t.test`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10``` ```response <- c(rnorm(5),rnorm(5,2,1)) fact <- gl(2,5,labels=LETTERS[1:2]) # Not enough permutations here but faster to run # Unpaired test perm.t.test(response~fact,nperm=49) # Paired test perm.t.test(response~fact,paired=TRUE,nperm=49) ```

### Example output

```*** Package RVAideMemoire v 0.9-68 ***

|
|                                                                      |   0%
|
|=                                                                     |   2%
|
|===                                                                   |   4%
|
|====                                                                  |   6%
|
|======                                                                |   8%
|
|=======                                                               |  10%
|
|========                                                              |  12%
|
|==========                                                            |  14%
|
|===========                                                           |  16%
|
|=============                                                         |  18%
|
|==============                                                        |  20%
|
|===============                                                       |  22%
|
|=================                                                     |  24%
|
|===================                                                   |  27%
|
|====================                                                  |  29%
|
|======================                                                |  31%
|
|=======================                                               |  33%
|
|========================                                              |  35%
|
|==========================                                            |  37%
|
|===========================                                           |  39%
|
|=============================                                         |  41%
|
|==============================                                        |  43%
|
|================================                                      |  45%
|
|=================================                                     |  47%
|
|==================================                                    |  49%
|
|====================================                                  |  51%
|
|=====================================                                 |  53%
|
|======================================                                |  55%
|
|========================================                              |  57%
|
|=========================================                             |  59%
|
|===========================================                           |  61%
|
|============================================                          |  63%
|
|==============================================                        |  65%
|
|===============================================                       |  67%
|
|================================================                      |  69%
|
|==================================================                    |  71%
|
|===================================================                   |  73%
|
|=====================================================                 |  76%
|
|=======================================================               |  78%
|
|========================================================              |  80%
|
|=========================================================             |  82%
|
|===========================================================           |  84%
|
|============================================================          |  86%
|
|==============================================================        |  88%
|
|===============================================================       |  90%
|
|================================================================      |  92%
|
|==================================================================    |  94%
|
|===================================================================   |  96%
|
|===================================================================== |  98%
|
|======================================================================| 100%

Permutation Two Sample t-test

data:  response by fact
49 permutations
t = -6.1475, p-value = 0.04
alternative hypothesis: true difference in means is not equal to 0
sample estimates:
mean in group A mean in group B
-0.6972425       2.2947575

|
|                                                                      |   0%
|
|=                                                                     |   2%
|
|===                                                                   |   4%
|
|====                                                                  |   6%
|
|======                                                                |   8%
|
|=======                                                               |  10%
|
|========                                                              |  12%
|
|==========                                                            |  14%
|
|===========                                                           |  16%
|
|=============                                                         |  18%
|
|==============                                                        |  20%
|
|===============                                                       |  22%
|
|=================                                                     |  24%
|
|===================                                                   |  27%
|
|====================                                                  |  29%
|
|======================                                                |  31%
|
|=======================                                               |  33%
|
|========================                                              |  35%
|
|==========================                                            |  37%
|
|===========================                                           |  39%
|
|=============================                                         |  41%
|
|==============================                                        |  43%
|
|================================                                      |  45%
|
|=================================                                     |  47%
|
|==================================                                    |  49%
|
|====================================                                  |  51%
|
|=====================================                                 |  53%
|
|======================================                                |  55%
|
|========================================                              |  57%
|
|=========================================                             |  59%
|
|===========================================                           |  61%
|
|============================================                          |  63%
|
|==============================================                        |  65%
|
|===============================================                       |  67%
|
|================================================                      |  69%
|
|==================================================                    |  71%
|
|===================================================                   |  73%
|
|=====================================================                 |  76%
|
|=======================================================               |  78%
|
|========================================================              |  80%
|
|=========================================================             |  82%
|
|===========================================================           |  84%
|
|============================================================          |  86%
|
|==============================================================        |  88%
|
|===============================================================       |  90%
|
|================================================================      |  92%
|
|==================================================================    |  94%
|
|===================================================================   |  96%
|
|===================================================================== |  98%
|
|======================================================================| 100%

Permutation Paired t-test

data:  response by fact
49 permutations
t = -5.8114, p-value = 0.28
alternative hypothesis: true difference in means is not equal to 0
sample estimates:
mean of the differences
-2.992
```

RVAideMemoire documentation built on Nov. 6, 2018, 5:05 p.m.