## Monte-Carlo Test on a Discriminant Analysis (in C).

### Description

Test of the sum of a discriminant analysis eigenvalues (divided by the rank). Non parametric version of the Pillai's test. It authorizes any weighting.

### Usage

```## S3 method for class 'discrimin':
randtest(xtest, nrepet = 999, ...)
```

### Arguments

 `xtest` an object of class `discrimin` `nrepet` the number of permutations `...` further arguments passed to or from other methods

### Value

returns a list of class `randtest`

### Examples

```data(meaudret)
pca1 <- dudi.pca(meaudret\$mil, scan = FALSE, nf = 3)
rand1 <- randtest(discrimin(pca1, meaudret\$plan\$dat, scan = FALSE), 99)
rand1
#Monte-Carlo test
#Observation: 0.3035
#Call: as.randtest(sim = sim, obs = obs)
#Based on 999 replicates
#Simulated p-value: 0.001
plot(rand1, main = "Monte-Carlo test")
summary.manova(manova(as.matrix(meaudret\$mil)~meaudret\$plan\$dat), "Pillai")
#                   Df Pillai approx F num Df den Df  Pr(>F)
# meaudret\$plan\$dat  3   2.73    11.30     27     30 1.6e-09 ***
# Residuals         16
# ---
# Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
# 2.731/9 = 0.3034
```

### Worked out examples

```
> ### Name: randtest.discrimin
> ### Title: Monte-Carlo Test on a Discriminant Analysis (in C).
> ### Aliases: randtest.discrimin
> ### Keywords: multivariate nonparametric
>
> ### ** Examples
>
> data(meaudret)
> pca1 <- dudi.pca(meaudret\$mil, scan = FALSE, nf = 3)
> rand1 <- randtest(discrimin(pca1, meaudret\$plan\$dat, scan = FALSE), 99)
> rand1
Monte-Carlo test
Call: randtest.discrimin(xtest = discrimin(pca1, meaudret\$plan\$dat,
scan = FALSE), nrepet = 99)

Observation: 0.3034897

Based on 99 replicates
Simulated p-value: 0.01
Alternative hypothesis: greater

Std.Obs  Expectation     Variance
6.1878007203 0.1558929353 0.0005689594
> #Monte-Carlo test
> #Observation: 0.3035
> #Call: as.randtest(sim = sim, obs = obs)
> #Based on 999 replicates
> #Simulated p-value: 0.001
> plot(rand1, main = "Monte-Carlo test")
```
```> summary.manova(manova(as.matrix(meaudret\$mil)~meaudret\$plan\$dat), "Pillai")
Df Pillai approx F num Df den Df    Pr(>F)
meaudret\$plan\$dat  3 2.7314   11.299     27     30 1.636e-09 ***
Residuals         16
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> #                   Df Pillai approx F num Df den Df  Pr(>F)
> # meaudret\$plan\$dat  3   2.73    11.30     27     30 1.6e-09 ***
> # Residuals         16
> # ---
> # Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
> # 2.731/9 = 0.3034
>
>
>
>
```