| Title: | Knox test |
|---|---|
| Description: | Knox test for space-time interaction |
| Authors: | Thanh Le Viet |
| Maintainer: | Thanh Le Viet <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 1.0.1 |
| Built: | 2026-10-19 20:54:01 UTC |
| Source: | https://github.com/fdzul/knox |
Original Knox test
knox(x, y, time, sigma, tau)knox(x, y, time, sigma, tau)
x |
Longitude, should be projected to a planar system. |
y |
Latitude, should be projected to a planar system. |
time |
time column. |
sigma |
a distance in space. |
tau |
a distance in time. |
A knox statistic, which is the number of pairs of points found in a given space-time distance.
Knox, E. (1964). The detection of space-time interactions. Journal of the Royal Statistical Society. Series C (13(1), 25-30.
Tango, T. (2010). Statistical methods for disease clustering. Springer.
Performing Knox statistics with Monte Carlo simulation
knox_mc(x, y, time, sigma, tau, perm = 999L)knox_mc(x, y, time, sigma, tau, perm = 999L)
x |
Longitude, should be projected to a planar system. |
y |
Latitude, should be projected to a planar system. |
time |
time column. |
sigma |
a distance in space. |
tau |
a distance in time. |
perm |
Number of simulations. Default is 999 |
knox |
Knox statistic, which is the number of pairs of points found in a given space-time distance. |
p_value |
p-value calculated from simulation |
RR |
Relative Risk - calculated by observed value (Knox statistics) divided by mean of simulated values |
Create space-time links between two points from a given space and time distance.
st_link(x, y, time, ds, dt)st_link(x, y, time, ds, dt)
x |
Longitude - should be projected to a planar system. |
y |
Latitude - should be projected to a plannar system. |
time |
time |
ds |
a distance in space. |
dt |
a distance in time. |
A data frame with
Xo, Yo
|
X, Y of the starting point |
Xd, Yd
|
X, Y of the ending point |
Writing shapefile from a data frame of space-time links
writeSHP(data, x, y, time, ds, dt, w = TRUE, file.out = "st_links", ...)writeSHP(data, x, y, time, ds, dt, w = TRUE, file.out = "st_links", ...)
data |
A data frame holds at least 3 columns: longtitude, latitude and time. |
x |
Longitude, should be projected to a planar system. |
y |
Latitude, should be projected to a planar system. |
time |
time column. |
ds |
a cut-off distance in space. |
dt |
a cut-off distance in time. |
w |
default is TRUE, to write out a shapefile. |
file.out |
default is "st_links", shapfile name to be written. |
... |
parameters of the plot function of a line, i.e col, width, etc. |
A plot of space-time links in lines. By default, w is set
TRUE, a shapefile will be written out as well.
Thanh Le Viet, [email protected]
st_links