jc.test: A function to compute jointcount test for binomial and...

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

Description

A function to compute Q test for spatial qualitative data

Usage

1
2
3
4
5
6
7
8
9
jc.test(formula = NULL,
               data = NULL,
               fx = NULL,
               listw = NULL,
               na.action,
               zero.policy = NULL,
               distr = "asymptotic",
               alternative = "greater",
               control =list())

Arguments

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 listw object created for example by nb2listw from spatialreg package; if nb2listw not given, the spatial weights are built using the object given in listw argument (usually an sf object). Default = NULL.

na.action

A function (default options("na.action")), can also be na.omit or na.exclude with consequences for residuals and fitted values. It may be necessary to set zero.policy to TRUE because this subsetting may create no-neighbour observations.

zero.policy

Similar to the corresponding parameter of lagsarlm function in spatialreg package. If TRUE assign zero to the lagged value of zones without neighbours. Default = NULL.

distr

character. Distribution type "asymptotic" (default) or "mc".

control

Optional argument. See Control Argument section.

Details

Aquí Antonio escribe una linda historia ....

Value

An object of the class htest

Control arguments

nsim

number of permutations for get the Monte Carlo distribution. Default = 999

seedinit

seed to select the initial element to star the algorithm to get compute the m-surroundings or to start the simulations.

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

CAMBIAR...

See Also

print.summary.spqtest, joincount.test, joincount.multi

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
 ## Case 1
 ## Multinomial + Binomial using a sf multipolygon
rm(list = ls())
data("Spain")
f1 <- ~ Older65 + MenWoman
jc1 <- jc.test(formula = f1,
               data = spain.sf,
               distr = "mc",
               alternative = "greater",
               zero.policy = TRUE)
summary(jc1)
f2 <- ~ MenWoman + Coast
jc2 <- jc.test(formula = f2,
               data = spain.sf,
               distr = "mc",
               zero.policy = TRUE)
summary(jc2)

# Case 2:
## Multinomial using a sf multipoint
rm(list = ls())
data("FastFood")
f1 <- ~ Type
jc3 <- jc.test(formula = f1,
               data = FastFood.sf,
               distr = "asymptotic",
               control = list(knn = 6))
 summary(jc3)

# Examples function joincount.test
data(oldcol)
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 = nb2listw(COL.nb,
               style="B"))
 jc5 <- jc.test(fx = HICRIME,
                listw = nb2listw(COL.nb, style="B"),
                distr = "'mc")
 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 = nb2listw(COL.nb,
                                 style="B"))

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