| Q.map.test | R Documentation |
This function compute the QE and QI tests for maps comparison based on symbolic entropy.
Q.map.test(formula = formula, data = data, coor = NULL, m = m, r = 1,
type = "combinations", control = list())
formula |
a symbolic description of the two factors. |
data |
(optional) a data frame or a sf object containing the variables to testing for. |
coor |
(optional) a 2xN vector with coordinates. |
m |
length of m-surrounding. |
r |
maximum overlapping between any two m-surroundings (default = 1). |
type |
Type of symbols: "permutations" or "combinations". Default "combinations" |
control |
Optional argument. See Control Argument section. |
If data is not a sf object the coor argument with the coordinates
of each observation must be included.
A list with two objects of the class htest. The first one
is the QE test of Equivalence between maps and the second one is the QI test
of independence between maps. the elements of each test are:
method | a character string giving description of the method. |
data.name | a character string giving the name(s) of the data. |
statistic | the value of the statistic QE or/and QI. |
alternative | a character string describing the alternative hypothesis. |
p.value | p-value for QE or QI. |
parameter | free degree of the statistic for QE or QI. |
symb | A matrix with the symbols. |
mh | m-surrounding of th map. |
Tm | number of maps (ONLY 2). |
sample.size | number of symbolized observations. |
nsk | a matrix Tm x symbols with the frequency of the number of symbols of each map. |
Several parameters to construct the m-surrounding
Delete degenerate surrounding based on the absolute distance between observations.
A value between 0 and 1. Delete degenerate surrounding based on the distance. Delete m-surrounding when the maximum distance between observation is upper than k percentage of maximum distance between anywhere observation.
A integer value 'k'. Delete degenerate surrounding based on the near neighborhood criteria. Delete m-surrounding is a element of the m-surrounding is not include in the set of k near neighborhood of the first element
seed to select the initial element to star the algorithm to compute the m-surroundings.
| Fernando López | fernando.lopez@upct.es |
| Román Mínguez | roman.minguez@uclm.es |
| Antonio Páez | paezha@gmail.com |
| Manuel Ruiz | manuel.ruiz@upct.es |
Ruiz M, López FA and A Páez (2011). Comparison of Thematic Maps Using Symbolic Entropy. International Journal of Geographical Information Science, 26, 413-439.
Ruiz, M., López, FA, and Páez, A. (2010). Testing for spatial association of qualitative data using symbolic dynamics. Journal of Geographical Systems, 12(3), 281-309.0.
dgp.spq, m.surround, Q.test
# Case 1:
N <- 200
cx <- runif(N)
cy <- runif(N)
x <- cbind(cx,cy)
listw <- spdep::nb2listw(spdep::knn2nb(
spdep::knearneigh(cbind(cx,cy), k = 4)))
p <- c(1/6, 3/6, 2/6)
rho = 0.5
QY1 <- dgp.spq(p = p, listw = listw, rho = rho)
rho = 0.8
QY2 <- dgp.spq(p = p, listw = listw, rho = rho)
dt = data.frame(QY1,QY2)
m = 3
r = 1
formula <- ~ QY1 + QY2
control <- list(dtmaxknn = 10)
qmap <- Q.map.test(formula = formula, data = dt, coor = x, m = m, r = r,
type ="combinations", control = control)
print(qmap)
plot(qmap)
plot(qmap, ci=.6)
plot(qmap[[1]]$mh)
summary(qmap[[1]]$mh)
control <- list(dtmaxknn = 20)
qmap <- Q.map.test(formula = formula, data = dt, coor = x, m = m, r = r,
type ="permutations", control = control)
print(qmap)
plot(qmap)
plot(qmap[[1]]$mh)
qmap <- Q.map.test(formula = formula, data = dt, coor = x, m = m, r = r,
type ="combinations")
print(qmap)
plot(qmap)
control <- list(dtmaxknn = 10)
qmap <- Q.map.test(formula = formula, data = dt, coor = x, m = m, r = r,
type ="combinations", control = control)
print(qmap)
plot(qmap)
# Case 2:
data(provinces_spain)
# sf::sf_use_s2(FALSE)
m = 3
r = 1
provinces_spain$Mal2Fml <- factor(provinces_spain$Mal2Fml > 100)
levels(provinces_spain$Mal2Fml) = c("men","woman")
provinces_spain$Coast <- factor(provinces_spain$Coast)
levels(provinces_spain$Coast) = c("no","yes")
formula <- ~ Coast + Mal2Fml
qmap <- Q.map.test(formula = formula, data = provinces_spain, m = m, r = r,
type ="combinations")
print(qmap)
plot(qmap)
plot(qmap[[1]]$mh)
control <- list(dtmaxknn = 6)
qmap <- Q.map.test(formula = formula, data = provinces_spain, m = m, r = r,
type ="combinations", control = control)
print(qmap)
plot(qmap[[1]]$mh)
summary(qmap[[1]]$mh)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.