jc.test | R Documentation |
A function to compute joincount
tests for spatial qualitative data. This function
is a wrapper of joincount.multi
and joincount.test
in spdep package.
jc.test(formula = NULL, data = NULL, fx = NULL, listw = NULL, na.action, zero.policy = NULL, distr = "asymptotic", alternative = "greater", control =list())
formula |
a symbolic description of the factor(s). |
data |
an (optional) data frame or a sf object with points/multipolygons geometry containing the variable(s) to be tested. |
fx |
a factor or a matrix of factors in columns |
listw |
A |
na.action |
A function (default |
zero.policy |
Similar to the corresponding parameter of
|
distr |
character. Distribution type "asymptotic" (default) or "mc". |
alternative |
character string specifying the alternative hypothesis, must be one of "greater" (default), or "less". |
control |
list of additional arguments. |
An spjctest
object. This type of object
is a list of htest
objects.
The length of the list is the number of
factor variables included in the
formula
or the number of columns
in fx
.
Each element of the list can be a
jclist
object, for binomial factors,
or a jcmulti
object for multinomial
factors. See joincount.test
or joincount.multi
for additional details.
nsim | number of permutations used in
the Monte Carlo distribution.
Default nsim = 999. |
seedinit | seed to select the initial
element during the simulations.
Default seedinit = 1111. |
adjust.n | default *TRUE*,
if *FALSE* the number of observations
is not adjusted for no-neighbour
observations, if *TRUE*, the number of
observations is adjusted consistently.
See joincount.multi
for aditional information. |
spChk | should the data vector
names be checked against the spatial
objects for identity integrity,
*TRUE*, or *FALSE*, default *NULL* to
use *get.spChkOption()*.
See joincount.multi
for aditional information. |
sampling | default *nonfree*,
may be *free*.
See joincount.test for
additional information. |
queen | default *TRUE*. Defines the neighborhood criteria for *sf* objects. |
style | defines the style for
listw . Default = *B* (binary). |
knn | chooses the number of
neighboors when this criteria is used.
Default knn = 5.
|
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 |
Cliff, A. D., Ord, J. K. 1981 Spatial processes, Pion, pp. 19-20.
Upton, G., Fingleton, B. 1985 Spatial data analysis by example: point pattern and qualitative data, Wiley, pp. 158–170.
print.summary.spqtest
,
joincount.test
,
joincount.multi
## Case 1 ## Multinomial + Binomial using a sf multipolygon data("provinces_spain") sf::sf_use_s2(FALSE) provinces_spain$Male2Female <- factor(provinces_spain$Male2Female > 100) levels(provinces_spain$Male2Female) = c("men","woman") provinces_spain$Older <- cut(provinces_spain$Older, breaks = c(-Inf,19,22.5,Inf)) levels(provinces_spain$Older) = c("low","middle","high") f1 <- ~ Older + Male2Female jc1 <- jc.test(formula = f1, data = provinces_spain, distr = "mc", alternative = "greater", zero.policy = TRUE) summary(jc1) provinces_spain$Coast <- factor(provinces_spain$Coast) levels(provinces_spain$Coast) = c("no","yes") f2 <- ~ Male2Female + Coast jc2 <- jc.test(formula = f2, data = provinces_spain, distr = "mc", zero.policy = TRUE) summary(jc2) # Case 2: ## Multinomial using a sf multipoint data("FastFood.sf") sf::sf_use_s2(FALSE) f1 <- ~ Type jc3 <- jc.test(formula = f1, data = FastFood.sf, distr = "asymptotic", control = list(knn = 6)) summary(jc3) # Examples function joincount.test data(oldcol, package = "spdep") HICRIME <- cut(COL.OLD$CRIME, breaks = c(0,35,80), labels = c("low","high")) names(HICRIME) <- rownames(COL.OLD) jc4 <- jc.test(fx = HICRIME, listw = spdep::nb2listw(COL.nb, style="B")) summary(jc4) jc5 <- jc.test(fx = HICRIME, listw = spdep::nb2listw(COL.nb, style="B"), distr = "mc") summary(jc5) HICRIME <- cut(COL.OLD$CRIME, breaks = c(0, 35, 80), labels = c("low","high")) names(HICRIME) <- rownames(COL.OLD) jc6 <- jc.test(fx = HICRIME, listw = spdep::nb2listw(COL.nb, style = "B")) summary(jc6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.