Pmat | R Documentation |
Compute a permutation matrix used as argument in aovperm, lmperm, clusterlm functions. The first column represents the identity permutation. Generally not suited for the "huh_jhun" method, as the dimension of this matrix does not correspond to the number of observations and may vary for different factors.
Pmat(np = 5000, n, type = "permutation", counting = "random")
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 transformations: "permutation" and "signflip" are available. See details. |
counting |
A character string to specify the selection of the transformations. "all" and "random" are available. See details. |
couting
can set to :
"random"
: np
random with replacement permutations/signflips among the n!
/2^n
permutations/signflips.
"all"
: all n!
/2^n
possible permutations/signflips.
A matrix n x np containing the permutations/signflips. First permutation is the identity.
Other pmat:
Pmat_product()
,
as.Pmat()
## data data("emergencycost") ## Create a set of 2000 permutations set.seed(42) pmat = Pmat(np = 2000, n = nrow(emergencycost)) sfmat = Pmat(np = 2000, n = nrow(emergencycost), type = "signflip") ## 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) mod_cost_3 <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost, P = sfmat) mod_cost_4 <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost,type="signflip") ## Same p-values for both models 1 and 2 but different of model 0 mod_cost_0 mod_cost_1 mod_cost_2 mod_cost_3 mod_cost_4
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.