Description Usage Arguments Details Value Examples
Compute the regional potential of a spatial field. Call the calcMultiPotential_cpp
C++ function.
1 2 | calcMultiPotential(W_SR, W_LR, distance.ref, sample, coords,
threshold = 0.01, nbGroup_min = 100, check.args = TRUE, verbose = TRUE)
|
W_SR |
The local neighborhood matrix. dgCMatrix. Should be normalized by row (i.e. |
W_LR |
The regional neighborhood matrix. dgCMatrix. Should contain the distances between the observations ( |
distance.ref |
The intervals of distance defining the several neighborhood orders in |
sample |
The probability membership to the group. numeric vector or character vector. REQUIRED. |
coords |
The voxel coordinates. matrix. REQUIRED. |
threshold |
The minimum value to consider non-negligible group membership. numeric. Default is |
nbGroup_min |
The minimum group size of the spatial groups required for computing the potential. integer. Default is |
check.args |
Should the validity of the arguments be checked ? logical. |
verbose |
Should the radius of the spatial groups be displayed ? logical. |
If check.args
is set to TRUE
, argument ccords
must be a matrix (and not a data.frame) and the x slot of argument W_LR
must contain categories of distances instead of distances.
Distance categories must begin at 0
and end at length(distance.ref)-1
.
A numeric vector containing the regional potential.
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | # spatial field
## Not run:
n <- 30
## End(Not run)
G <- 3
coords <- data.frame(which(matrix(0, nrow = n * G, ncol = n * G) == 0, arr.ind = TRUE), 1)
optionsMRIaggr(quantiles.legend = FALSE, axes = FALSE, num.main = FALSE)
# neighborhood matrix
W_SR <- calcW(coords, range = sqrt(2), row.norm = TRUE)$W
W_LR <- calcW(coords, range = 10, row.norm = FALSE)$W
distance.ref <- seq(1, 10, 1)
# data
set.seed(10)
sample <- simulPotts(W = W_SR, G = G, rho = 3.5, iter_max = 500)
#
multiplot(coords,sample$simulation[,2])
V1 <- calcMultiPotential(W_SR = W_SR, W_LR = W_LR, distance.ref = seq(1, 10, 1),
sample = sample$simulation[,2], coords = coords, verbose = TRUE)
multiplot(coords, V1)
#
sampleV <- (apply(sample$simulation, 1, which.max) - 1) / 2
multiplot(coords, sampleV)
system.time(
V2 <- calcMultiPotential(W_SR = W_SR, W_LR = W_LR, distance.ref = seq(1, 10, 1),
sample = sampleV, coords = coords, verbose = TRUE)
)
Wcat_LR <- W_LR
Wcat_LR@x <- findInterval(x = Wcat_LR@x, vec = distance.ref) - 1
system.time(
V2 <- calcMultiPotential(W_SR = W_SR, W_LR = Wcat_LR, distance.ref = seq(1, 10, 1),
sample = sampleV, coords = as.matrix(coords), verbose = TRUE, check.args = FALSE)
)
# quicker but arguments have to be correctly specified
multiplot(coords, V2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.