Description Usage Arguments Details Value Examples
Compute the spatial groups using a neighbourhood matrix.
1 2 | calcGroupsW(W, subset = NULL, max_groups = 10000,
verbose = optionsMRIaggr("verbose"))
|
W |
the neighbourhood matrix. dgCMatrix. REQUIRED. |
subset |
the subset of observations to use. positive integer vector or |
max_groups |
the maximum number of groups. postive integer. |
verbose |
should the execution of the function be traced ? logical. |
This function requires to have installed the Matrix and the spam package to work.
An list containing :
[[group]]
: a vector containing the group index for each observation. Observations out of the subset are set to NA
.
[[subset]]
: a vector containing the group index for each observation in subset.
[[group_size]]
: a vector with the size of each spatial group.
[[group_number]]
: the number of spatial groups. integer vector.
[[group_max]]
: the number of the largest group. integer vector.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## load a MRIaggr object
data("MRIaggr.Pat1_red", package = "MRIaggr")
## select data
MASK_DWI_t0 <- selectContrast(MRIaggr.Pat1_red, param = "MASK_DWI_t0")
coords <- selectCoords(MRIaggr.Pat1_red)
## select compute W
W <- calcW(object = as.data.frame(coords[MASK_DWI_t0 == 1,]),
range = sqrt(2), row.norm = TRUE)$W
## find spatial groups
res.Groups <- calcGroupsW(W)
res.Groups$group_size
## display
multiplot(coords[MASK_DWI_t0 == 1,], contrast = res.Groups$group,
legend = FALSE, cex=0.5,
palette=rainbow(10)[-1])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.