Q.map.test: Compute the QE and QI tests of Equivalence and Independence...

Description Usage Arguments Details Value Control arguments Author(s) See Also Examples

View source: R/Q.map.test.R

Description

This function compute the QE and QI tests for maps comparison based on symbolic entropy.

Usage

1
Q.map.test(formula = formula, data = data, coor = NULL, m = m, r = 1, type = "combinations", control = list())

Arguments

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.

Details

Aquí Antonio escribe una linda historia ...
Two alternative sets of arguments can be included in this function to compute the spatial runs test:

Alternative 1 A factor (xf) and a list of neighborhood (listw) of the class knn.
Alternative 2 A sf object (data) and formula to specify the factor. A list of neighborhood (listw)

Value

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.

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
gl free degree of the statistic for QE or QI
mh m-surrounding of th map.
Tm number of maps (ONLY 2).
R number of symbolized observations.
nsk a matrix Tm x symbols with the frequency of the number of symbols of each map

Control arguments

Several parameters to construct the m-surrounding

dtmaxabs

Delete degenerate surrounding based on the absolute distance between observations.

dtmaxpc

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.

dtmaxknn

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

seedinit

seed to select the initial element to star the algorithm to compute the m-surroundings.

Author(s)

Fernando López fernando.lopez@upct.es
Román Mínguez roman.minguez@uclm.es
Antonio paez@gmail.com
Manolo manuel.ruiz@upct.es

@references

See Also

dgp.spq, m.surround

Examples

 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Case 1:
rm(list = ls())
N <- 200
cx <- runif(N)
cy <- runif(N)
x <- cbind(cx,cy)
listw <- spdep::nb2listw(spdep::knn2nb(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:
rm(list = ls())
data(Spain)
m = 3
r = 1
formula <- ~ Coast + Older65
qmap <- Q.map.test(formula = formula, data = spain.sf, 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 = spain.sf, m = m, r = r, type ="combinations", control = control)
print(qmap)
plot(qmap[[1]]$mh)
summary(qmap[[1]]$mh)

# Case 3:
rm(list = ls())
data(Newark)
m = 3
r = 1
formula <- ~ IRISH + GERMAN
control <- list(dtmaxknn = 6)
qmap <- Q.map.test(formula = formula, data = Newark, coor = cbind(Newark$X,Newark$Y), m = m, r = r, type ="combinations", control = control)
print(qmap)
plot(qmap)
plot(qmap[[1]]$mh)

rominsal/spqdata documentation built on Jan. 24, 2021, 11:11 a.m.