# spatial field
## Not run:
# n <- 50
# ## End(Not run)
G <- 3
coords <- as.data.frame(which(matrix(0, nrow = n * G, ncol = n * G) == 0, arr.ind = TRUE))
# neighbourhood matrix
resW <- calcW(as.data.frame(coords), range = sqrt(2), row.norm = TRUE, calcBlockW = TRUE)
W_SR <- resW$W
site_order <- unlist(resW$blocks$ls_groups) - 1
# initialisation
set.seed(10)
sample <- simulPotts(W_SR, G = 3, rho = 3.5, iter_max = 500,
site_order = site_order)$simulation
#### estimation using the neighbourhood matrix
rho_MF <- calcPottsParameter(Y = sample, W_SR = W_SR, method = "MF")
## Not run:
# rho_Lvfree <- calcPottsParameter(Y = sample, W_SR = W_SR,
# site_order = site_order, method = "Lvfree", verbose = 2)
# ## End(Not run)
#### estimation using the coordinates
rho_MF <- calcPottsParameter(Y = sample, coords = coords, range = sqrt(2), method = "MF")
## Not run:
# rho_Lvfree <- calcPottsParameter(Y = sample, coords = coords, range = sqrt(2),
# site_order = site_order, method = "Lvfree", verbose = 2)
# ## End(Not run)
Run the code above in your browser using DataLab