# perm.t.test

##### R function for permutation-based t-test

The function allows to perform a permutation-based t-test to compare two independent groups. The test's results are graphically displayed within the returned chart.

- Keywords
- perm.t.test

##### Usage

```
perm.t.test(data, format, sample1.lab = NULL, sample2.lab = NULL,
B = 999)
```

##### Arguments

- data
Dataframe containing the data.

- format
It takes "long" if the data are arranged in two columns, with the left-hand one containing the values, and the righ-hand one containing a grouping variable; it takes "short" if the values of the two groups being compared are stored in two different adjacent columns.

- sample1.lab
Label for the first sample being tested (default: smpl 1).

- sample2.lab
Label for the first sample being tested (default: smpl 2).

- B
Desired number of permutations (set at 999 by default).

##### Details

A permutation t-test proves useful when the assumption of 'regular' t-test are not met. In particular, when the two groups being compared show a very skewed distribution, and when the sample sizes are very unbalanced.

"The permutation test is useful even if we plan to use the two-sample t test. Rather than relying on Normal quantile plots of the two samples and the central limit theorem, we can directly check the Normality of the sampling distribution by looking at the permutation distribution. Permutation tests provide a <U+201C>gold standard<U+201D> for assessing two-sample t tests. If the two P-values differ considerably, it usually indicates that the conditions for the two-sample t don<U+2019>t hold for these data. Because permutation tests give accurate P-values even when the sampling distribution is skewed, they are often used when accuracy is very important." (Moore, McCabe, Craig, "Introduction to the Practice of Statistics", New York: W. H. Freeman and Company, 2009).

##### Value

The frequency histogram returned by the function displays the distribution of the permuted mean difference between the two samples; a solid dot indicates the observed mean difference, while an hollow dot represents the mean of the permuted differences. Two dashed blue lines indicates the 0.025 and 0.975 percentile of the permuted distribution. A rug plot at the bottom histgram indicates the individual permuted mean differences. At the bottom of the chart, some information are displayed. In particular, the observed mean difference and the permuted p-values are reported. In the last row, the result of the regular (parametric) t-test (both assuming and not assuming equal variances) is reported to allow users to compare the outcome of these different versions of the test.

##### Examples

```
# NOT RUN {
#load the 'resample' package which stores a toy dataset
library(resample)
#load the 'Verizon' dataset
data("Verizon")
#performs the permutation-based t-test using 199 permutations
perm.t.test(Verizon, format="long", B=199)
# }
```

*Documentation reproduced from package GmAMisc, version 1.1.1, License: GPL (>= 2)*