# Pmat: Create a set of permutations. In permuco: Permutation Tests for Regression, (Repeated Measures) ANOVA/ANCOVA and Comparison of Signals

## Description

Compute a permutation matrix used as argument in aovperm, lmperm, clusterlm functions. The first column represents the identity permutation.

## Usage

 `1` ```Pmat(np = 5000, n, type = "default") ```

## Arguments

 `np` A numeric value for the number of permutations. Default is 5000. `n` A numeric value for the number of observations. `type` A character string to specify the type of matrix. See Details.

## Details

`type` can set to :
`"default"` : `np` random with replacement permutations among the `n!` permutations.
`"all"` : all `n!` possible permutations.

## Value

A matrix n x np containing the permutations/coinflips. First permutation is the identity.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19``` ```## data data("emergencycost") ## Create a set of 2000 permutations set.seed(42) pmat = Pmat(np = 2000, n = nrow(emergencycost)) ## centrering the covariate to the mean emergencycost\$LOSc <- scale(emergencycost\$LOS, scale = FALSE) ## ANCOVA mod_cost_0 <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost, np = 2000) mod_cost_1 <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost, P = pmat) mod_cost_2 <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost, P = pmat) ## Same p-values for both models 1 and 2 but differents of model 0 mod_cost_0 mod_cost_1 mod_cost_2 ```

permuco documentation built on Feb. 14, 2018, 5:04 p.m.