Description Usage Arguments Details Value Examples
Given an input matrix (or stack thereof), rmperm.grpd performs a
(random) simultaneous row/column permutation of the input data BY EACH GROUP.
That means permutation does not occur among the different groups.
1 | rmperm.grpd(mat, grp.ns = NULL)
|
mat |
a matrix, or stack thereof. For a stack of matrices, it should be either list format or array in which the first dimension indicates the layer. |
grp.ns |
a vector indicates the number of actors in each group. The default is |
This is the extention of the rmperm for the matrix
permtation. If no group was defined in grp.ns, it performs the normal
matrix permutation. If groups are defined, it perfom the matrix permutation
by each group seperately and then convert it into a single (or stacked)
matrix. This function helps for QAP test in which the off-diagonal matrix is
set to be NA, for example.
a permuted matrix (or matrices).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | library(sna)
# single group/single net(normal permutation)
m <- sna::rgraph(4)
rmperm.grpd(m)
# single group/multiplex(normal permutation)
m <- rgraph(4,2)
m[1,,];m[2,,]
res <- rmperm.grpd(m)
res[1,,];res[2,,]
# multi group/single net
m1 <- sna::rgraph(4)
m2 <- sna::rgraph(3)
m3 <- sna::rgraph(3)
spr.mat <- list2mat(list(m1,m2,m3))
spr.mat
rmperm.grpd(spr.mat, grp.ns = c(4,3,3))
# multi group/multiplex
spr.mat2 <- spr.mat
spr.mat2[3,2]<-1;spr.mat2[1,3]<-1
sprmats <- list(spr.mat,spr.mat2)
res <- rmperm.grpd(sprmats, grp.ns = c(nrow(m1),nrow(m2),nrow(m3)))
res[1,,];res[2,,]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.