Package 'knox'

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

Help Index


Original Knox test

Description

Original Knox test

Usage

knox(x, y, time, sigma, tau)

Arguments

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.

Value

A knox statistic, which is the number of pairs of points found in a given space-time distance.

References

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.


Knox test with Monte Carlo simulation

Description

Performing Knox statistics with Monte Carlo simulation

Usage

knox_mc(x, y, time, sigma, tau, perm = 999L)

Arguments

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

Value

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


Writting shapefile of space-time links

Description

Writing shapefile from a data frame of space-time links

Usage

writeSHP(data, x, y, time, ds, dt, w = TRUE, file.out = "st_links", ...)

Arguments

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.

Value

A plot of space-time links in lines. By default, w is set TRUE, a shapefile will be written out as well.

Author(s)

Thanh Le Viet, [email protected]

See Also

st_links