similarity.test: Compute the similarity test.

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

View source: R/similarity.test.R

Description

This function compute the similarity test for categorical spatial process.

Usage

1
2
similarity.test(formula = NULL, data = NULL, na.action, fx = NULL, listw = listw,
alternative = "two.sided", distr = "asymptotic", nsim = NULL, control = list())

Arguments

formula

a symbolic description of the factor (optional).

data

an (optional) data frame or a sf object containing the variable to testing for.

fx

a factor (optional).

alternative

a character string specifying the type of cluster, must be one of "High" (default), "Both" or "Low".

distr

A string. Distribution of the test "asymptotic" (default) or "bootstrap"

nsim

Number of permutations.

control

List of additional control arguments.

Details

Escribir aquí cosas

Value

A object of the htest

data.name a character string giving the names of the data.
statistic Value of the similarity test
N total number of observations.
Zmlc Elements in the Most Likelihood Cluster.
alternative a character string describing the alternative hypothesis.
p.value p-value of the similarity test
similiarity.mc values of the similarity test in each permutation.

Control arguments

seedinit Numerical value for the seed (only for boot version). Default value seedinit=123

Author(s)

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

References

See Also

sp.runs.test, dgp.spq, Q.test, , scan.test

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
rm(list = ls())
N <- 100
cx <- runif(N)
cy <- runif(N)
listw <- knearneigh(cbind(cx,cy), k = 3)
p <- c(1/4,1/4,1/4,1/4)
rho <- 0.5
fx <- dgp.spq(p = p, listw = listw, rho = rho)
W <- (nb2mat(knn2nb(listw)) >0)*1
similarity <- similarity.test(fx = fx, data = FastFood.sf, listw = listw)
print(similarity)

# Case 2: SRQ test with formula, a sf object (points) and knn
rm(list = ls())
data("FastFood")
coor <- cbind(FastFood.sf$Lon,FastFood.sf$Lat)
listw <- spdep::knearneigh(coor, k = 4)
formula <- ~ Type
similarity <- similarity.test(formula = formula, data = FastFood.sf, listw = listw)
print(similarity)

# Case 3:
rm(list = ls())
data("Spain")
listw <- spdep::poly2nb(as(spain.sf,"Spatial"), queen = FALSE)
formula <- ~ MenWoman
similarity <- similarity.test(formula = formula, data = spain.sf, listw = listw)
print(similarity)

paezha/spqdata documentation built on Dec. 22, 2021, 5:24 a.m.