Pmat {permuco} | R Documentation |
Compute a permutation matrix used as argument in aovperm, lmperm, clusterlm functions. The first column represents the identity permutation.
Pmat(np = 5000, n, type = "default")
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. |
type
can set to :
"default"
: np
random with replacement permutations among the n!
permutations.
"all"
: all n!
possible permutations.
A matrix n x np containing the permutations/coinflips. First permutation is the identity.
## 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