A function to compute joint-count test for binomial and multinomial (asymptotic and permutation distributions).
jc.test.Rd
A function to compute joincount
tests for spatial qualitative data. This function
is a wrapper of joincount.multi
and joincount.test
in spdep package.
Usage
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 bynb2listw
from spdep package; ifnb2listw
not given, the spatial weights are built using the object given inlistw
argument (usually ansf
object). Default =NULL
.- na.action
A function (default
options("na.action")
), can also bena.omit
orna.exclude
. It may be necessary to setzero.policy
toTRUE
because this subsetting may create no-neighbour observations.- zero.policy
Similar to the corresponding parameter of
lagsarlm
function in spatialreg package. IfTRUE
assign zero to the lagged value of zones without neighbours. Default =NULL
.- 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.
Value
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.
Control arguments
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. |
References
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.
Author
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 |
Examples
## Case 1
## Multinomial + Binomial using a sf multipolygon
# \donttest{
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)
#> although coordinates are longitude/latitude, st_intersects assumes that they are planar
summary(jc1)
#> <div id="rgrdpswsrb" style="overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
#> <style>html {
#> font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
#> }
#>
#> #rgrdpswsrb .gt_table {
#> display: table;
#> border-collapse: collapse;
#> margin-left: auto;
#> margin-right: auto;
#> color: #333333;
#> font-size: 16px;
#> font-weight: normal;
#> font-style: normal;
#> background-color: #FFFFFF;
#> width: auto;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #A8A8A8;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #A8A8A8;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> }
#>
#> #rgrdpswsrb .gt_heading {
#> background-color: #FFFFFF;
#> text-align: center;
#> border-bottom-color: #FFFFFF;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #rgrdpswsrb .gt_title {
#> color: #333333;
#> font-size: 125%;
#> font-weight: initial;
#> padding-top: 4px;
#> padding-bottom: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-bottom-color: #FFFFFF;
#> border-bottom-width: 0;
#> }
#>
#> #rgrdpswsrb .gt_subtitle {
#> color: #333333;
#> font-size: 85%;
#> font-weight: initial;
#> padding-top: 0;
#> padding-bottom: 6px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-top-color: #FFFFFF;
#> border-top-width: 0;
#> }
#>
#> #rgrdpswsrb .gt_bottom_border {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #rgrdpswsrb .gt_col_headings {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #rgrdpswsrb .gt_col_heading {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: normal;
#> text-transform: inherit;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: bottom;
#> padding-top: 5px;
#> padding-bottom: 6px;
#> padding-left: 5px;
#> padding-right: 5px;
#> overflow-x: hidden;
#> }
#>
#> #rgrdpswsrb .gt_column_spanner_outer {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: normal;
#> text-transform: inherit;
#> padding-top: 0;
#> padding-bottom: 0;
#> padding-left: 4px;
#> padding-right: 4px;
#> }
#>
#> #rgrdpswsrb .gt_column_spanner_outer:first-child {
#> padding-left: 0;
#> }
#>
#> #rgrdpswsrb .gt_column_spanner_outer:last-child {
#> padding-right: 0;
#> }
#>
#> #rgrdpswsrb .gt_column_spanner {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> vertical-align: bottom;
#> padding-top: 5px;
#> padding-bottom: 5px;
#> overflow-x: hidden;
#> display: inline-block;
#> width: 100%;
#> }
#>
#> #rgrdpswsrb .gt_group_heading {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: middle;
#> }
#>
#> #rgrdpswsrb .gt_empty_group_heading {
#> padding: 0.5px;
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> vertical-align: middle;
#> }
#>
#> #rgrdpswsrb .gt_from_md > :first-child {
#> margin-top: 0;
#> }
#>
#> #rgrdpswsrb .gt_from_md > :last-child {
#> margin-bottom: 0;
#> }
#>
#> #rgrdpswsrb .gt_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> margin: 10px;
#> border-top-style: solid;
#> border-top-width: 1px;
#> border-top-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: middle;
#> overflow-x: hidden;
#> }
#>
#> #rgrdpswsrb .gt_stub {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-right-style: solid;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #rgrdpswsrb .gt_stub_row_group {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-right-style: solid;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> padding-left: 5px;
#> padding-right: 5px;
#> vertical-align: top;
#> }
#>
#> #rgrdpswsrb .gt_row_group_first td {
#> border-top-width: 2px;
#> }
#>
#> #rgrdpswsrb .gt_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #rgrdpswsrb .gt_first_summary_row {
#> border-top-style: solid;
#> border-top-color: #D3D3D3;
#> }
#>
#> #rgrdpswsrb .gt_first_summary_row.thick {
#> border-top-width: 2px;
#> }
#>
#> #rgrdpswsrb .gt_last_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #rgrdpswsrb .gt_grand_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #rgrdpswsrb .gt_first_grand_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-top-style: double;
#> border-top-width: 6px;
#> border-top-color: #D3D3D3;
#> }
#>
#> #rgrdpswsrb .gt_striped {
#> background-color: rgba(128, 128, 128, 0.05);
#> }
#>
#> #rgrdpswsrb .gt_table_body {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #rgrdpswsrb .gt_footnotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #rgrdpswsrb .gt_footnote {
#> margin: 0px;
#> font-size: 90%;
#> padding-left: 4px;
#> padding-right: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #rgrdpswsrb .gt_sourcenotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #rgrdpswsrb .gt_sourcenote {
#> font-size: 90%;
#> padding-top: 4px;
#> padding-bottom: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #rgrdpswsrb .gt_left {
#> text-align: left;
#> }
#>
#> #rgrdpswsrb .gt_center {
#> text-align: center;
#> }
#>
#> #rgrdpswsrb .gt_right {
#> text-align: right;
#> font-variant-numeric: tabular-nums;
#> }
#>
#> #rgrdpswsrb .gt_font_normal {
#> font-weight: normal;
#> }
#>
#> #rgrdpswsrb .gt_font_bold {
#> font-weight: bold;
#> }
#>
#> #rgrdpswsrb .gt_font_italic {
#> font-style: italic;
#> }
#>
#> #rgrdpswsrb .gt_super {
#> font-size: 65%;
#> }
#>
#> #rgrdpswsrb .gt_footnote_marks {
#> font-style: italic;
#> font-weight: normal;
#> font-size: 75%;
#> vertical-align: 0.4em;
#> }
#>
#> #rgrdpswsrb .gt_asterisk {
#> font-size: 100%;
#> vertical-align: 0;
#> }
#>
#> #rgrdpswsrb .gt_slash_mark {
#> font-size: 0.7em;
#> line-height: 0.7em;
#> vertical-align: 0.15em;
#> }
#>
#> #rgrdpswsrb .gt_fraction_numerator {
#> font-size: 0.6em;
#> line-height: 0.6em;
#> vertical-align: 0.45em;
#> }
#>
#> #rgrdpswsrb .gt_fraction_denominator {
#> font-size: 0.6em;
#> line-height: 0.6em;
#> vertical-align: -0.05em;
#> }
#> </style>
#> <table class="gt_table">
#> <thead class="gt_header">
#> <tr>
#> <th colspan="5" class="gt_heading gt_title gt_font_normal gt_bottom_border" style>JoinCount Spatial Tests (Monte Carlo)</th>
#> </tr>
#>
#> </thead>
#> <thead class="gt_col_headings">
#> <tr>
#> <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1">pairs</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">pvalue</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">Joincount</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">Expected</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">Variance</th>
#> </tr>
#> </thead>
#> <tbody class="gt_table_body">
#> <tr class="gt_group_heading_row">
#> <td colspan="5" class="gt_group_heading">Older - multinomial - alternative: greater - Monte-Carlo simulation of
#> join-count statistic (nonfree sampling)</td>
#> </tr>
#> <tr class="gt_row_group_first"><td class="gt_row gt_left">high:high</td>
#> <td class="gt_row gt_right">0.44100</td>
#> <td class="gt_row gt_right">14</td>
#> <td class="gt_row gt_right">13.99</td>
#> <td class="gt_row gt_right">11.06</td></tr>
#> <tr><td class="gt_row gt_left">low:low</td>
#> <td class="gt_row gt_right">0.69700</td>
#> <td class="gt_row gt_right">7</td>
#> <td class="gt_row gt_right">8.31</td>
#> <td class="gt_row gt_right">6.57</td></tr>
#> <tr><td class="gt_row gt_left">middle:middle</td>
#> <td class="gt_row gt_right">0.54900</td>
#> <td class="gt_row gt_right">13</td>
#> <td class="gt_row gt_right">13.83</td>
#> <td class="gt_row gt_right">10.44</td></tr>
#> <tr><td class="gt_row gt_left">low:high</td>
#> <td class="gt_row gt_right">0.35800</td>
#> <td class="gt_row gt_right">24</td>
#> <td class="gt_row gt_right">22.88</td>
#> <td class="gt_row gt_right">15.87</td></tr>
#> <tr><td class="gt_row gt_left">middle:high</td>
#> <td class="gt_row gt_right">0.57000</td>
#> <td class="gt_row gt_right">28</td>
#> <td class="gt_row gt_right">29.15</td>
#> <td class="gt_row gt_right">20.45</td></tr>
#> <tr><td class="gt_row gt_left">middle:low</td>
#> <td class="gt_row gt_right">0.30300</td>
#> <td class="gt_row gt_right">25</td>
#> <td class="gt_row gt_right">22.83</td>
#> <td class="gt_row gt_right">17.09</td></tr>
#> <tr><td class="gt_row gt_left">Jtot</td>
#> <td class="gt_row gt_right">0.38300</td>
#> <td class="gt_row gt_right">77</td>
#> <td class="gt_row gt_right">74.86</td>
#> <td class="gt_row gt_right">23.27</td></tr>
#> <tr class="gt_group_heading_row">
#> <td colspan="5" class="gt_group_heading">Male2Female - binomial - alternative: greater - Monte-Carlo simulation of join-count statistic</td>
#> </tr>
#> <tr class="gt_row_group_first"><td class="gt_row gt_left">men-men</td>
#> <td class="gt_row gt_right">0.55100</td>
#> <td class="gt_row gt_right">60</td>
#> <td class="gt_row gt_right">60.62</td>
#> <td class="gt_row gt_right">22.64</td></tr>
#> <tr><td class="gt_row gt_left">woman-woman</td>
#> <td class="gt_row gt_right">0.01500</td>
#> <td class="gt_row gt_right">13</td>
#> <td class="gt_row gt_right">6.98</td>
#> <td class="gt_row gt_right">5.89</td></tr>
#> </tbody>
#>
#>
#> </table>
#> </div>
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)
#> although coordinates are longitude/latitude, st_intersects assumes that they are planar
summary(jc2)
#> <div id="krjaggrbnb" style="overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
#> <style>html {
#> font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
#> }
#>
#> #krjaggrbnb .gt_table {
#> display: table;
#> border-collapse: collapse;
#> margin-left: auto;
#> margin-right: auto;
#> color: #333333;
#> font-size: 16px;
#> font-weight: normal;
#> font-style: normal;
#> background-color: #FFFFFF;
#> width: auto;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #A8A8A8;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #A8A8A8;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> }
#>
#> #krjaggrbnb .gt_heading {
#> background-color: #FFFFFF;
#> text-align: center;
#> border-bottom-color: #FFFFFF;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #krjaggrbnb .gt_title {
#> color: #333333;
#> font-size: 125%;
#> font-weight: initial;
#> padding-top: 4px;
#> padding-bottom: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-bottom-color: #FFFFFF;
#> border-bottom-width: 0;
#> }
#>
#> #krjaggrbnb .gt_subtitle {
#> color: #333333;
#> font-size: 85%;
#> font-weight: initial;
#> padding-top: 0;
#> padding-bottom: 6px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-top-color: #FFFFFF;
#> border-top-width: 0;
#> }
#>
#> #krjaggrbnb .gt_bottom_border {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #krjaggrbnb .gt_col_headings {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #krjaggrbnb .gt_col_heading {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: normal;
#> text-transform: inherit;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: bottom;
#> padding-top: 5px;
#> padding-bottom: 6px;
#> padding-left: 5px;
#> padding-right: 5px;
#> overflow-x: hidden;
#> }
#>
#> #krjaggrbnb .gt_column_spanner_outer {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: normal;
#> text-transform: inherit;
#> padding-top: 0;
#> padding-bottom: 0;
#> padding-left: 4px;
#> padding-right: 4px;
#> }
#>
#> #krjaggrbnb .gt_column_spanner_outer:first-child {
#> padding-left: 0;
#> }
#>
#> #krjaggrbnb .gt_column_spanner_outer:last-child {
#> padding-right: 0;
#> }
#>
#> #krjaggrbnb .gt_column_spanner {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> vertical-align: bottom;
#> padding-top: 5px;
#> padding-bottom: 5px;
#> overflow-x: hidden;
#> display: inline-block;
#> width: 100%;
#> }
#>
#> #krjaggrbnb .gt_group_heading {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: middle;
#> }
#>
#> #krjaggrbnb .gt_empty_group_heading {
#> padding: 0.5px;
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> vertical-align: middle;
#> }
#>
#> #krjaggrbnb .gt_from_md > :first-child {
#> margin-top: 0;
#> }
#>
#> #krjaggrbnb .gt_from_md > :last-child {
#> margin-bottom: 0;
#> }
#>
#> #krjaggrbnb .gt_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> margin: 10px;
#> border-top-style: solid;
#> border-top-width: 1px;
#> border-top-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: middle;
#> overflow-x: hidden;
#> }
#>
#> #krjaggrbnb .gt_stub {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-right-style: solid;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #krjaggrbnb .gt_stub_row_group {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-right-style: solid;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> padding-left: 5px;
#> padding-right: 5px;
#> vertical-align: top;
#> }
#>
#> #krjaggrbnb .gt_row_group_first td {
#> border-top-width: 2px;
#> }
#>
#> #krjaggrbnb .gt_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #krjaggrbnb .gt_first_summary_row {
#> border-top-style: solid;
#> border-top-color: #D3D3D3;
#> }
#>
#> #krjaggrbnb .gt_first_summary_row.thick {
#> border-top-width: 2px;
#> }
#>
#> #krjaggrbnb .gt_last_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #krjaggrbnb .gt_grand_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #krjaggrbnb .gt_first_grand_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-top-style: double;
#> border-top-width: 6px;
#> border-top-color: #D3D3D3;
#> }
#>
#> #krjaggrbnb .gt_striped {
#> background-color: rgba(128, 128, 128, 0.05);
#> }
#>
#> #krjaggrbnb .gt_table_body {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #krjaggrbnb .gt_footnotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #krjaggrbnb .gt_footnote {
#> margin: 0px;
#> font-size: 90%;
#> padding-left: 4px;
#> padding-right: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #krjaggrbnb .gt_sourcenotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #krjaggrbnb .gt_sourcenote {
#> font-size: 90%;
#> padding-top: 4px;
#> padding-bottom: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #krjaggrbnb .gt_left {
#> text-align: left;
#> }
#>
#> #krjaggrbnb .gt_center {
#> text-align: center;
#> }
#>
#> #krjaggrbnb .gt_right {
#> text-align: right;
#> font-variant-numeric: tabular-nums;
#> }
#>
#> #krjaggrbnb .gt_font_normal {
#> font-weight: normal;
#> }
#>
#> #krjaggrbnb .gt_font_bold {
#> font-weight: bold;
#> }
#>
#> #krjaggrbnb .gt_font_italic {
#> font-style: italic;
#> }
#>
#> #krjaggrbnb .gt_super {
#> font-size: 65%;
#> }
#>
#> #krjaggrbnb .gt_footnote_marks {
#> font-style: italic;
#> font-weight: normal;
#> font-size: 75%;
#> vertical-align: 0.4em;
#> }
#>
#> #krjaggrbnb .gt_asterisk {
#> font-size: 100%;
#> vertical-align: 0;
#> }
#>
#> #krjaggrbnb .gt_slash_mark {
#> font-size: 0.7em;
#> line-height: 0.7em;
#> vertical-align: 0.15em;
#> }
#>
#> #krjaggrbnb .gt_fraction_numerator {
#> font-size: 0.6em;
#> line-height: 0.6em;
#> vertical-align: 0.45em;
#> }
#>
#> #krjaggrbnb .gt_fraction_denominator {
#> font-size: 0.6em;
#> line-height: 0.6em;
#> vertical-align: -0.05em;
#> }
#> </style>
#> <table class="gt_table">
#> <thead class="gt_header">
#> <tr>
#> <th colspan="5" class="gt_heading gt_title gt_font_normal gt_bottom_border" style>JoinCount Spatial Tests (Monte Carlo)</th>
#> </tr>
#>
#> </thead>
#> <thead class="gt_col_headings">
#> <tr>
#> <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1">pairs</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">pvalue</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">Joincount</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">Expected</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">Variance</th>
#> </tr>
#> </thead>
#> <tbody class="gt_table_body">
#> <tr class="gt_group_heading_row">
#> <td colspan="5" class="gt_group_heading">Male2Female - binomial - alternative: greater - Monte-Carlo simulation of join-count statistic</td>
#> </tr>
#> <tr class="gt_row_group_first"><td class="gt_row gt_left">men-men</td>
#> <td class="gt_row gt_right">0.52200</td>
#> <td class="gt_row gt_right">60</td>
#> <td class="gt_row gt_right">60.46</td>
#> <td class="gt_row gt_right">22.66</td></tr>
#> <tr><td class="gt_row gt_left">woman-woman</td>
#> <td class="gt_row gt_right">0.01000</td>
#> <td class="gt_row gt_right">13</td>
#> <td class="gt_row gt_right">6.96</td>
#> <td class="gt_row gt_right">5.66</td></tr>
#> <tr class="gt_group_heading_row">
#> <td colspan="5" class="gt_group_heading">Coast - binomial - alternative: greater - Monte-Carlo simulation of join-count statistic</td>
#> </tr>
#> <tr class="gt_row_group_first"><td class="gt_row gt_left">no-no</td>
#> <td class="gt_row gt_right">0.00100</td>
#> <td class="gt_row gt_right">64</td>
#> <td class="gt_row gt_right">36.62</td>
#> <td class="gt_row gt_right">22.03</td></tr>
#> <tr><td class="gt_row gt_left">yes-yes</td>
#> <td class="gt_row gt_right">0.90450</td>
#> <td class="gt_row gt_right">14</td>
#> <td class="gt_row gt_right">18.84</td>
#> <td class="gt_row gt_right">14.13</td></tr>
#> </tbody>
#>
#>
#> </table>
#> </div>
# }
# 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))
#> Warning: bounding box has potentially an invalid value range for longlat data
#> Warning: bounding box has potentially an invalid value range for longlat data
#> Warning: knearneigh: coordinates are not geographical: longlat argument wrong
summary(jc3)
#> <div id="ltmvkjwapz" style="overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
#> <style>html {
#> font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
#> }
#>
#> #ltmvkjwapz .gt_table {
#> display: table;
#> border-collapse: collapse;
#> margin-left: auto;
#> margin-right: auto;
#> color: #333333;
#> font-size: 16px;
#> font-weight: normal;
#> font-style: normal;
#> background-color: #FFFFFF;
#> width: auto;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #A8A8A8;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #A8A8A8;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> }
#>
#> #ltmvkjwapz .gt_heading {
#> background-color: #FFFFFF;
#> text-align: center;
#> border-bottom-color: #FFFFFF;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #ltmvkjwapz .gt_title {
#> color: #333333;
#> font-size: 125%;
#> font-weight: initial;
#> padding-top: 4px;
#> padding-bottom: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-bottom-color: #FFFFFF;
#> border-bottom-width: 0;
#> }
#>
#> #ltmvkjwapz .gt_subtitle {
#> color: #333333;
#> font-size: 85%;
#> font-weight: initial;
#> padding-top: 0;
#> padding-bottom: 6px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-top-color: #FFFFFF;
#> border-top-width: 0;
#> }
#>
#> #ltmvkjwapz .gt_bottom_border {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #ltmvkjwapz .gt_col_headings {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #ltmvkjwapz .gt_col_heading {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: normal;
#> text-transform: inherit;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: bottom;
#> padding-top: 5px;
#> padding-bottom: 6px;
#> padding-left: 5px;
#> padding-right: 5px;
#> overflow-x: hidden;
#> }
#>
#> #ltmvkjwapz .gt_column_spanner_outer {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: normal;
#> text-transform: inherit;
#> padding-top: 0;
#> padding-bottom: 0;
#> padding-left: 4px;
#> padding-right: 4px;
#> }
#>
#> #ltmvkjwapz .gt_column_spanner_outer:first-child {
#> padding-left: 0;
#> }
#>
#> #ltmvkjwapz .gt_column_spanner_outer:last-child {
#> padding-right: 0;
#> }
#>
#> #ltmvkjwapz .gt_column_spanner {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> vertical-align: bottom;
#> padding-top: 5px;
#> padding-bottom: 5px;
#> overflow-x: hidden;
#> display: inline-block;
#> width: 100%;
#> }
#>
#> #ltmvkjwapz .gt_group_heading {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: middle;
#> }
#>
#> #ltmvkjwapz .gt_empty_group_heading {
#> padding: 0.5px;
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> vertical-align: middle;
#> }
#>
#> #ltmvkjwapz .gt_from_md > :first-child {
#> margin-top: 0;
#> }
#>
#> #ltmvkjwapz .gt_from_md > :last-child {
#> margin-bottom: 0;
#> }
#>
#> #ltmvkjwapz .gt_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> margin: 10px;
#> border-top-style: solid;
#> border-top-width: 1px;
#> border-top-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: middle;
#> overflow-x: hidden;
#> }
#>
#> #ltmvkjwapz .gt_stub {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-right-style: solid;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #ltmvkjwapz .gt_stub_row_group {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-right-style: solid;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> padding-left: 5px;
#> padding-right: 5px;
#> vertical-align: top;
#> }
#>
#> #ltmvkjwapz .gt_row_group_first td {
#> border-top-width: 2px;
#> }
#>
#> #ltmvkjwapz .gt_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #ltmvkjwapz .gt_first_summary_row {
#> border-top-style: solid;
#> border-top-color: #D3D3D3;
#> }
#>
#> #ltmvkjwapz .gt_first_summary_row.thick {
#> border-top-width: 2px;
#> }
#>
#> #ltmvkjwapz .gt_last_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #ltmvkjwapz .gt_grand_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #ltmvkjwapz .gt_first_grand_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-top-style: double;
#> border-top-width: 6px;
#> border-top-color: #D3D3D3;
#> }
#>
#> #ltmvkjwapz .gt_striped {
#> background-color: rgba(128, 128, 128, 0.05);
#> }
#>
#> #ltmvkjwapz .gt_table_body {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #ltmvkjwapz .gt_footnotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #ltmvkjwapz .gt_footnote {
#> margin: 0px;
#> font-size: 90%;
#> padding-left: 4px;
#> padding-right: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #ltmvkjwapz .gt_sourcenotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #ltmvkjwapz .gt_sourcenote {
#> font-size: 90%;
#> padding-top: 4px;
#> padding-bottom: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #ltmvkjwapz .gt_left {
#> text-align: left;
#> }
#>
#> #ltmvkjwapz .gt_center {
#> text-align: center;
#> }
#>
#> #ltmvkjwapz .gt_right {
#> text-align: right;
#> font-variant-numeric: tabular-nums;
#> }
#>
#> #ltmvkjwapz .gt_font_normal {
#> font-weight: normal;
#> }
#>
#> #ltmvkjwapz .gt_font_bold {
#> font-weight: bold;
#> }
#>
#> #ltmvkjwapz .gt_font_italic {
#> font-style: italic;
#> }
#>
#> #ltmvkjwapz .gt_super {
#> font-size: 65%;
#> }
#>
#> #ltmvkjwapz .gt_footnote_marks {
#> font-style: italic;
#> font-weight: normal;
#> font-size: 75%;
#> vertical-align: 0.4em;
#> }
#>
#> #ltmvkjwapz .gt_asterisk {
#> font-size: 100%;
#> vertical-align: 0;
#> }
#>
#> #ltmvkjwapz .gt_slash_mark {
#> font-size: 0.7em;
#> line-height: 0.7em;
#> vertical-align: 0.15em;
#> }
#>
#> #ltmvkjwapz .gt_fraction_numerator {
#> font-size: 0.6em;
#> line-height: 0.6em;
#> vertical-align: 0.45em;
#> }
#>
#> #ltmvkjwapz .gt_fraction_denominator {
#> font-size: 0.6em;
#> line-height: 0.6em;
#> vertical-align: -0.05em;
#> }
#> </style>
#> <table class="gt_table">
#> <thead class="gt_header">
#> <tr>
#> <th colspan="6" class="gt_heading gt_title gt_font_normal gt_bottom_border" style>JoinCount Spatial Tests (asymptotic)</th>
#> </tr>
#>
#> </thead>
#> <thead class="gt_col_headings">
#> <tr>
#> <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1">pairs</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">z-value</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">pvalue</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">Joincount</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">Expected</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">Variance</th>
#> </tr>
#> </thead>
#> <tbody class="gt_table_body">
#> <tr class="gt_group_heading_row">
#> <td colspan="6" class="gt_group_heading">Type - multinomial - alternative: greater - Join count test under nonfree sampling</td>
#> </tr>
#> <tr class="gt_row_group_first"><td class="gt_row gt_left">H:H</td>
#> <td class="gt_row gt_right">−0.23</td>
#> <td class="gt_row gt_right">0.58942</td>
#> <td class="gt_row gt_right">255.5</td>
#> <td class="gt_row gt_right">258.05</td>
#> <td class="gt_row gt_right">127.06</td></tr>
#> <tr><td class="gt_row gt_left">P:P</td>
#> <td class="gt_row gt_right">0.30</td>
#> <td class="gt_row gt_right">0.38114</td>
#> <td class="gt_row gt_right">317.0</td>
#> <td class="gt_row gt_right">313.38</td>
#> <td class="gt_row gt_right">143.47</td></tr>
#> <tr><td class="gt_row gt_left">S:S</td>
#> <td class="gt_row gt_right">−1.82</td>
#> <td class="gt_row gt_right">0.96574</td>
#> <td class="gt_row gt_right">283.5</td>
#> <td class="gt_row gt_right">305.14</td>
#> <td class="gt_row gt_right">141.19</td></tr>
#> <tr><td class="gt_row gt_left">P:H</td>
#> <td class="gt_row gt_right">0.02</td>
#> <td class="gt_row gt_right">0.49358</td>
#> <td class="gt_row gt_right">571.0</td>
#> <td class="gt_row gt_right">570.72</td>
#> <td class="gt_row gt_right">304.67</td></tr>
#> <tr><td class="gt_row gt_left">S:H</td>
#> <td class="gt_row gt_right">0.05</td>
#> <td class="gt_row gt_right">0.48128</td>
#> <td class="gt_row gt_right">564.0</td>
#> <td class="gt_row gt_right">563.18</td>
#> <td class="gt_row gt_right">301.61</td></tr>
#> <tr><td class="gt_row gt_left">S:P</td>
#> <td class="gt_row gt_right">1.08</td>
#> <td class="gt_row gt_right">0.14022</td>
#> <td class="gt_row gt_right">640.0</td>
#> <td class="gt_row gt_right">620.53</td>
#> <td class="gt_row gt_right">325.50</td></tr>
#> <tr><td class="gt_row gt_left">Jtot</td>
#> <td class="gt_row gt_right">0.90</td>
#> <td class="gt_row gt_right">0.18350</td>
#> <td class="gt_row gt_right">1775.0</td>
#> <td class="gt_row gt_right">1,754.43</td>
#> <td class="gt_row gt_right">519.87</td></tr>
#> </tbody>
#>
#>
#> </table>
#> </div>
# 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)
#> <div id="hbyizqonme" style="overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
#> <style>html {
#> font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
#> }
#>
#> #hbyizqonme .gt_table {
#> display: table;
#> border-collapse: collapse;
#> margin-left: auto;
#> margin-right: auto;
#> color: #333333;
#> font-size: 16px;
#> font-weight: normal;
#> font-style: normal;
#> background-color: #FFFFFF;
#> width: auto;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #A8A8A8;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #A8A8A8;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> }
#>
#> #hbyizqonme .gt_heading {
#> background-color: #FFFFFF;
#> text-align: center;
#> border-bottom-color: #FFFFFF;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #hbyizqonme .gt_title {
#> color: #333333;
#> font-size: 125%;
#> font-weight: initial;
#> padding-top: 4px;
#> padding-bottom: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-bottom-color: #FFFFFF;
#> border-bottom-width: 0;
#> }
#>
#> #hbyizqonme .gt_subtitle {
#> color: #333333;
#> font-size: 85%;
#> font-weight: initial;
#> padding-top: 0;
#> padding-bottom: 6px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-top-color: #FFFFFF;
#> border-top-width: 0;
#> }
#>
#> #hbyizqonme .gt_bottom_border {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #hbyizqonme .gt_col_headings {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #hbyizqonme .gt_col_heading {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: normal;
#> text-transform: inherit;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: bottom;
#> padding-top: 5px;
#> padding-bottom: 6px;
#> padding-left: 5px;
#> padding-right: 5px;
#> overflow-x: hidden;
#> }
#>
#> #hbyizqonme .gt_column_spanner_outer {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: normal;
#> text-transform: inherit;
#> padding-top: 0;
#> padding-bottom: 0;
#> padding-left: 4px;
#> padding-right: 4px;
#> }
#>
#> #hbyizqonme .gt_column_spanner_outer:first-child {
#> padding-left: 0;
#> }
#>
#> #hbyizqonme .gt_column_spanner_outer:last-child {
#> padding-right: 0;
#> }
#>
#> #hbyizqonme .gt_column_spanner {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> vertical-align: bottom;
#> padding-top: 5px;
#> padding-bottom: 5px;
#> overflow-x: hidden;
#> display: inline-block;
#> width: 100%;
#> }
#>
#> #hbyizqonme .gt_group_heading {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: middle;
#> }
#>
#> #hbyizqonme .gt_empty_group_heading {
#> padding: 0.5px;
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> vertical-align: middle;
#> }
#>
#> #hbyizqonme .gt_from_md > :first-child {
#> margin-top: 0;
#> }
#>
#> #hbyizqonme .gt_from_md > :last-child {
#> margin-bottom: 0;
#> }
#>
#> #hbyizqonme .gt_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> margin: 10px;
#> border-top-style: solid;
#> border-top-width: 1px;
#> border-top-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: middle;
#> overflow-x: hidden;
#> }
#>
#> #hbyizqonme .gt_stub {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-right-style: solid;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #hbyizqonme .gt_stub_row_group {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-right-style: solid;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> padding-left: 5px;
#> padding-right: 5px;
#> vertical-align: top;
#> }
#>
#> #hbyizqonme .gt_row_group_first td {
#> border-top-width: 2px;
#> }
#>
#> #hbyizqonme .gt_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #hbyizqonme .gt_first_summary_row {
#> border-top-style: solid;
#> border-top-color: #D3D3D3;
#> }
#>
#> #hbyizqonme .gt_first_summary_row.thick {
#> border-top-width: 2px;
#> }
#>
#> #hbyizqonme .gt_last_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #hbyizqonme .gt_grand_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #hbyizqonme .gt_first_grand_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-top-style: double;
#> border-top-width: 6px;
#> border-top-color: #D3D3D3;
#> }
#>
#> #hbyizqonme .gt_striped {
#> background-color: rgba(128, 128, 128, 0.05);
#> }
#>
#> #hbyizqonme .gt_table_body {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #hbyizqonme .gt_footnotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #hbyizqonme .gt_footnote {
#> margin: 0px;
#> font-size: 90%;
#> padding-left: 4px;
#> padding-right: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #hbyizqonme .gt_sourcenotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #hbyizqonme .gt_sourcenote {
#> font-size: 90%;
#> padding-top: 4px;
#> padding-bottom: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #hbyizqonme .gt_left {
#> text-align: left;
#> }
#>
#> #hbyizqonme .gt_center {
#> text-align: center;
#> }
#>
#> #hbyizqonme .gt_right {
#> text-align: right;
#> font-variant-numeric: tabular-nums;
#> }
#>
#> #hbyizqonme .gt_font_normal {
#> font-weight: normal;
#> }
#>
#> #hbyizqonme .gt_font_bold {
#> font-weight: bold;
#> }
#>
#> #hbyizqonme .gt_font_italic {
#> font-style: italic;
#> }
#>
#> #hbyizqonme .gt_super {
#> font-size: 65%;
#> }
#>
#> #hbyizqonme .gt_footnote_marks {
#> font-style: italic;
#> font-weight: normal;
#> font-size: 75%;
#> vertical-align: 0.4em;
#> }
#>
#> #hbyizqonme .gt_asterisk {
#> font-size: 100%;
#> vertical-align: 0;
#> }
#>
#> #hbyizqonme .gt_slash_mark {
#> font-size: 0.7em;
#> line-height: 0.7em;
#> vertical-align: 0.15em;
#> }
#>
#> #hbyizqonme .gt_fraction_numerator {
#> font-size: 0.6em;
#> line-height: 0.6em;
#> vertical-align: 0.45em;
#> }
#>
#> #hbyizqonme .gt_fraction_denominator {
#> font-size: 0.6em;
#> line-height: 0.6em;
#> vertical-align: -0.05em;
#> }
#> </style>
#> <table class="gt_table">
#> <thead class="gt_header">
#> <tr>
#> <th colspan="6" class="gt_heading gt_title gt_font_normal gt_bottom_border" style>JoinCount Spatial Tests (asymptotic)</th>
#> </tr>
#>
#> </thead>
#> <thead class="gt_col_headings">
#> <tr>
#> <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1">pairs</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">z-value</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">pvalue</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">Joincount</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">Expected</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">Variance</th>
#> </tr>
#> </thead>
#> <tbody class="gt_table_body">
#> <tr class="gt_group_heading_row">
#> <td colspan="6" class="gt_group_heading">fx - binomial - alternative: greater - Join count test under nonfree sampling</td>
#> </tr>
#> <tr class="gt_row_group_first"><td class="gt_row gt_left">high-high</td>
#> <td class="gt_row gt_right">6.33</td>
#> <td class="gt_row gt_right">0.00000</td>
#> <td class="gt_row gt_right">54</td>
#> <td class="gt_row gt_right">27.22</td>
#> <td class="gt_row gt_right">17.89</td></tr>
#> <tr><td class="gt_row gt_left">low-low</td>
#> <td class="gt_row gt_right">1.01</td>
#> <td class="gt_row gt_right">0.15527</td>
#> <td class="gt_row gt_right">34</td>
#> <td class="gt_row gt_right">29.59</td>
#> <td class="gt_row gt_right">18.90</td></tr>
#> <tr><td class="gt_row gt_left">high-low</td>
#> <td class="gt_row gt_right">−6.09</td>
#> <td class="gt_row gt_right">1.00000</td>
#> <td class="gt_row gt_right">28</td>
#> <td class="gt_row gt_right">59.18</td>
#> <td class="gt_row gt_right">26.23</td></tr>
#> </tbody>
#>
#>
#> </table>
#> </div>
jc5 <- jc.test(fx = HICRIME,
listw = spdep::nb2listw(COL.nb, style="B"),
distr = "mc")
summary(jc5)
#> <div id="ojlndidqrg" style="overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
#> <style>html {
#> font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
#> }
#>
#> #ojlndidqrg .gt_table {
#> display: table;
#> border-collapse: collapse;
#> margin-left: auto;
#> margin-right: auto;
#> color: #333333;
#> font-size: 16px;
#> font-weight: normal;
#> font-style: normal;
#> background-color: #FFFFFF;
#> width: auto;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #A8A8A8;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #A8A8A8;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> }
#>
#> #ojlndidqrg .gt_heading {
#> background-color: #FFFFFF;
#> text-align: center;
#> border-bottom-color: #FFFFFF;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #ojlndidqrg .gt_title {
#> color: #333333;
#> font-size: 125%;
#> font-weight: initial;
#> padding-top: 4px;
#> padding-bottom: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-bottom-color: #FFFFFF;
#> border-bottom-width: 0;
#> }
#>
#> #ojlndidqrg .gt_subtitle {
#> color: #333333;
#> font-size: 85%;
#> font-weight: initial;
#> padding-top: 0;
#> padding-bottom: 6px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-top-color: #FFFFFF;
#> border-top-width: 0;
#> }
#>
#> #ojlndidqrg .gt_bottom_border {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #ojlndidqrg .gt_col_headings {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #ojlndidqrg .gt_col_heading {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: normal;
#> text-transform: inherit;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: bottom;
#> padding-top: 5px;
#> padding-bottom: 6px;
#> padding-left: 5px;
#> padding-right: 5px;
#> overflow-x: hidden;
#> }
#>
#> #ojlndidqrg .gt_column_spanner_outer {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: normal;
#> text-transform: inherit;
#> padding-top: 0;
#> padding-bottom: 0;
#> padding-left: 4px;
#> padding-right: 4px;
#> }
#>
#> #ojlndidqrg .gt_column_spanner_outer:first-child {
#> padding-left: 0;
#> }
#>
#> #ojlndidqrg .gt_column_spanner_outer:last-child {
#> padding-right: 0;
#> }
#>
#> #ojlndidqrg .gt_column_spanner {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> vertical-align: bottom;
#> padding-top: 5px;
#> padding-bottom: 5px;
#> overflow-x: hidden;
#> display: inline-block;
#> width: 100%;
#> }
#>
#> #ojlndidqrg .gt_group_heading {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: middle;
#> }
#>
#> #ojlndidqrg .gt_empty_group_heading {
#> padding: 0.5px;
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> vertical-align: middle;
#> }
#>
#> #ojlndidqrg .gt_from_md > :first-child {
#> margin-top: 0;
#> }
#>
#> #ojlndidqrg .gt_from_md > :last-child {
#> margin-bottom: 0;
#> }
#>
#> #ojlndidqrg .gt_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> margin: 10px;
#> border-top-style: solid;
#> border-top-width: 1px;
#> border-top-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: middle;
#> overflow-x: hidden;
#> }
#>
#> #ojlndidqrg .gt_stub {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-right-style: solid;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #ojlndidqrg .gt_stub_row_group {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-right-style: solid;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> padding-left: 5px;
#> padding-right: 5px;
#> vertical-align: top;
#> }
#>
#> #ojlndidqrg .gt_row_group_first td {
#> border-top-width: 2px;
#> }
#>
#> #ojlndidqrg .gt_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #ojlndidqrg .gt_first_summary_row {
#> border-top-style: solid;
#> border-top-color: #D3D3D3;
#> }
#>
#> #ojlndidqrg .gt_first_summary_row.thick {
#> border-top-width: 2px;
#> }
#>
#> #ojlndidqrg .gt_last_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #ojlndidqrg .gt_grand_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #ojlndidqrg .gt_first_grand_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-top-style: double;
#> border-top-width: 6px;
#> border-top-color: #D3D3D3;
#> }
#>
#> #ojlndidqrg .gt_striped {
#> background-color: rgba(128, 128, 128, 0.05);
#> }
#>
#> #ojlndidqrg .gt_table_body {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #ojlndidqrg .gt_footnotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #ojlndidqrg .gt_footnote {
#> margin: 0px;
#> font-size: 90%;
#> padding-left: 4px;
#> padding-right: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #ojlndidqrg .gt_sourcenotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #ojlndidqrg .gt_sourcenote {
#> font-size: 90%;
#> padding-top: 4px;
#> padding-bottom: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #ojlndidqrg .gt_left {
#> text-align: left;
#> }
#>
#> #ojlndidqrg .gt_center {
#> text-align: center;
#> }
#>
#> #ojlndidqrg .gt_right {
#> text-align: right;
#> font-variant-numeric: tabular-nums;
#> }
#>
#> #ojlndidqrg .gt_font_normal {
#> font-weight: normal;
#> }
#>
#> #ojlndidqrg .gt_font_bold {
#> font-weight: bold;
#> }
#>
#> #ojlndidqrg .gt_font_italic {
#> font-style: italic;
#> }
#>
#> #ojlndidqrg .gt_super {
#> font-size: 65%;
#> }
#>
#> #ojlndidqrg .gt_footnote_marks {
#> font-style: italic;
#> font-weight: normal;
#> font-size: 75%;
#> vertical-align: 0.4em;
#> }
#>
#> #ojlndidqrg .gt_asterisk {
#> font-size: 100%;
#> vertical-align: 0;
#> }
#>
#> #ojlndidqrg .gt_slash_mark {
#> font-size: 0.7em;
#> line-height: 0.7em;
#> vertical-align: 0.15em;
#> }
#>
#> #ojlndidqrg .gt_fraction_numerator {
#> font-size: 0.6em;
#> line-height: 0.6em;
#> vertical-align: 0.45em;
#> }
#>
#> #ojlndidqrg .gt_fraction_denominator {
#> font-size: 0.6em;
#> line-height: 0.6em;
#> vertical-align: -0.05em;
#> }
#> </style>
#> <table class="gt_table">
#> <thead class="gt_header">
#> <tr>
#> <th colspan="5" class="gt_heading gt_title gt_font_normal gt_bottom_border" style>JoinCount Spatial Tests (Monte Carlo)</th>
#> </tr>
#>
#> </thead>
#> <thead class="gt_col_headings">
#> <tr>
#> <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1">pairs</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">pvalue</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">Joincount</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">Expected</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">Variance</th>
#> </tr>
#> </thead>
#> <tbody class="gt_table_body">
#> <tr class="gt_group_heading_row">
#> <td colspan="5" class="gt_group_heading">fx - binomial - alternative: greater - Monte-Carlo simulation of join-count statistic</td>
#> </tr>
#> <tr class="gt_row_group_first"><td class="gt_row gt_left">high-high</td>
#> <td class="gt_row gt_right">0.00100</td>
#> <td class="gt_row gt_right">54</td>
#> <td class="gt_row gt_right">27.37</td>
#> <td class="gt_row gt_right">18.76</td></tr>
#> <tr><td class="gt_row gt_left">low-low</td>
#> <td class="gt_row gt_right">0.13600</td>
#> <td class="gt_row gt_right">34</td>
#> <td class="gt_row gt_right">29.38</td>
#> <td class="gt_row gt_right">18.08</td></tr>
#> </tbody>
#>
#>
#> </table>
#> </div>
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)
#> <div id="zcgtvsbuev" style="overflow-x:auto;overflow-y:auto;width:auto;height:auto;">
#> <style>html {
#> font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
#> }
#>
#> #zcgtvsbuev .gt_table {
#> display: table;
#> border-collapse: collapse;
#> margin-left: auto;
#> margin-right: auto;
#> color: #333333;
#> font-size: 16px;
#> font-weight: normal;
#> font-style: normal;
#> background-color: #FFFFFF;
#> width: auto;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #A8A8A8;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #A8A8A8;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> }
#>
#> #zcgtvsbuev .gt_heading {
#> background-color: #FFFFFF;
#> text-align: center;
#> border-bottom-color: #FFFFFF;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #zcgtvsbuev .gt_title {
#> color: #333333;
#> font-size: 125%;
#> font-weight: initial;
#> padding-top: 4px;
#> padding-bottom: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-bottom-color: #FFFFFF;
#> border-bottom-width: 0;
#> }
#>
#> #zcgtvsbuev .gt_subtitle {
#> color: #333333;
#> font-size: 85%;
#> font-weight: initial;
#> padding-top: 0;
#> padding-bottom: 6px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-top-color: #FFFFFF;
#> border-top-width: 0;
#> }
#>
#> #zcgtvsbuev .gt_bottom_border {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #zcgtvsbuev .gt_col_headings {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #zcgtvsbuev .gt_col_heading {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: normal;
#> text-transform: inherit;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: bottom;
#> padding-top: 5px;
#> padding-bottom: 6px;
#> padding-left: 5px;
#> padding-right: 5px;
#> overflow-x: hidden;
#> }
#>
#> #zcgtvsbuev .gt_column_spanner_outer {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: normal;
#> text-transform: inherit;
#> padding-top: 0;
#> padding-bottom: 0;
#> padding-left: 4px;
#> padding-right: 4px;
#> }
#>
#> #zcgtvsbuev .gt_column_spanner_outer:first-child {
#> padding-left: 0;
#> }
#>
#> #zcgtvsbuev .gt_column_spanner_outer:last-child {
#> padding-right: 0;
#> }
#>
#> #zcgtvsbuev .gt_column_spanner {
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> vertical-align: bottom;
#> padding-top: 5px;
#> padding-bottom: 5px;
#> overflow-x: hidden;
#> display: inline-block;
#> width: 100%;
#> }
#>
#> #zcgtvsbuev .gt_group_heading {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: middle;
#> }
#>
#> #zcgtvsbuev .gt_empty_group_heading {
#> padding: 0.5px;
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> vertical-align: middle;
#> }
#>
#> #zcgtvsbuev .gt_from_md > :first-child {
#> margin-top: 0;
#> }
#>
#> #zcgtvsbuev .gt_from_md > :last-child {
#> margin-bottom: 0;
#> }
#>
#> #zcgtvsbuev .gt_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> margin: 10px;
#> border-top-style: solid;
#> border-top-width: 1px;
#> border-top-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 1px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 1px;
#> border-right-color: #D3D3D3;
#> vertical-align: middle;
#> overflow-x: hidden;
#> }
#>
#> #zcgtvsbuev .gt_stub {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-right-style: solid;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #zcgtvsbuev .gt_stub_row_group {
#> color: #333333;
#> background-color: #FFFFFF;
#> font-size: 100%;
#> font-weight: initial;
#> text-transform: inherit;
#> border-right-style: solid;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> padding-left: 5px;
#> padding-right: 5px;
#> vertical-align: top;
#> }
#>
#> #zcgtvsbuev .gt_row_group_first td {
#> border-top-width: 2px;
#> }
#>
#> #zcgtvsbuev .gt_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #zcgtvsbuev .gt_first_summary_row {
#> border-top-style: solid;
#> border-top-color: #D3D3D3;
#> }
#>
#> #zcgtvsbuev .gt_first_summary_row.thick {
#> border-top-width: 2px;
#> }
#>
#> #zcgtvsbuev .gt_last_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #zcgtvsbuev .gt_grand_summary_row {
#> color: #333333;
#> background-color: #FFFFFF;
#> text-transform: inherit;
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #zcgtvsbuev .gt_first_grand_summary_row {
#> padding-top: 8px;
#> padding-bottom: 8px;
#> padding-left: 5px;
#> padding-right: 5px;
#> border-top-style: double;
#> border-top-width: 6px;
#> border-top-color: #D3D3D3;
#> }
#>
#> #zcgtvsbuev .gt_striped {
#> background-color: rgba(128, 128, 128, 0.05);
#> }
#>
#> #zcgtvsbuev .gt_table_body {
#> border-top-style: solid;
#> border-top-width: 2px;
#> border-top-color: #D3D3D3;
#> border-bottom-style: solid;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> }
#>
#> #zcgtvsbuev .gt_footnotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #zcgtvsbuev .gt_footnote {
#> margin: 0px;
#> font-size: 90%;
#> padding-left: 4px;
#> padding-right: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #zcgtvsbuev .gt_sourcenotes {
#> color: #333333;
#> background-color: #FFFFFF;
#> border-bottom-style: none;
#> border-bottom-width: 2px;
#> border-bottom-color: #D3D3D3;
#> border-left-style: none;
#> border-left-width: 2px;
#> border-left-color: #D3D3D3;
#> border-right-style: none;
#> border-right-width: 2px;
#> border-right-color: #D3D3D3;
#> }
#>
#> #zcgtvsbuev .gt_sourcenote {
#> font-size: 90%;
#> padding-top: 4px;
#> padding-bottom: 4px;
#> padding-left: 5px;
#> padding-right: 5px;
#> }
#>
#> #zcgtvsbuev .gt_left {
#> text-align: left;
#> }
#>
#> #zcgtvsbuev .gt_center {
#> text-align: center;
#> }
#>
#> #zcgtvsbuev .gt_right {
#> text-align: right;
#> font-variant-numeric: tabular-nums;
#> }
#>
#> #zcgtvsbuev .gt_font_normal {
#> font-weight: normal;
#> }
#>
#> #zcgtvsbuev .gt_font_bold {
#> font-weight: bold;
#> }
#>
#> #zcgtvsbuev .gt_font_italic {
#> font-style: italic;
#> }
#>
#> #zcgtvsbuev .gt_super {
#> font-size: 65%;
#> }
#>
#> #zcgtvsbuev .gt_footnote_marks {
#> font-style: italic;
#> font-weight: normal;
#> font-size: 75%;
#> vertical-align: 0.4em;
#> }
#>
#> #zcgtvsbuev .gt_asterisk {
#> font-size: 100%;
#> vertical-align: 0;
#> }
#>
#> #zcgtvsbuev .gt_slash_mark {
#> font-size: 0.7em;
#> line-height: 0.7em;
#> vertical-align: 0.15em;
#> }
#>
#> #zcgtvsbuev .gt_fraction_numerator {
#> font-size: 0.6em;
#> line-height: 0.6em;
#> vertical-align: 0.45em;
#> }
#>
#> #zcgtvsbuev .gt_fraction_denominator {
#> font-size: 0.6em;
#> line-height: 0.6em;
#> vertical-align: -0.05em;
#> }
#> </style>
#> <table class="gt_table">
#> <thead class="gt_header">
#> <tr>
#> <th colspan="6" class="gt_heading gt_title gt_font_normal gt_bottom_border" style>JoinCount Spatial Tests (asymptotic)</th>
#> </tr>
#>
#> </thead>
#> <thead class="gt_col_headings">
#> <tr>
#> <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1">pairs</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">z-value</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">pvalue</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">Joincount</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">Expected</th>
#> <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1">Variance</th>
#> </tr>
#> </thead>
#> <tbody class="gt_table_body">
#> <tr class="gt_group_heading_row">
#> <td colspan="6" class="gt_group_heading">fx - binomial - alternative: greater - Join count test under nonfree sampling</td>
#> </tr>
#> <tr class="gt_row_group_first"><td class="gt_row gt_left">high-high</td>
#> <td class="gt_row gt_right">6.33</td>
#> <td class="gt_row gt_right">0.00000</td>
#> <td class="gt_row gt_right">54</td>
#> <td class="gt_row gt_right">27.22</td>
#> <td class="gt_row gt_right">17.89</td></tr>
#> <tr><td class="gt_row gt_left">low-low</td>
#> <td class="gt_row gt_right">1.01</td>
#> <td class="gt_row gt_right">0.15527</td>
#> <td class="gt_row gt_right">34</td>
#> <td class="gt_row gt_right">29.59</td>
#> <td class="gt_row gt_right">18.90</td></tr>
#> <tr><td class="gt_row gt_left">high-low</td>
#> <td class="gt_row gt_right">−6.09</td>
#> <td class="gt_row gt_right">1.00000</td>
#> <td class="gt_row gt_right">28</td>
#> <td class="gt_row gt_right">59.18</td>
#> <td class="gt_row gt_right">26.23</td></tr>
#> </tbody>
#>
#>
#> </table>
#> </div>