splancs (version 2.01-44)

stmctest: Monte-Carlo test of space-time clustering

Description

Perform a Monte-Carlo test of space-time clustering.

Usage

stmctest(pts, times, poly, tlimits, s, tt, nsim, quiet=FALSE, returnSims=FALSE)

Value

A list with components:

t0

The observed value of the statistic

t

A single column matrix with nsim values each of which is a simulated value of the statistic

Arguments

pts

A set of points as used by Splancs.

times

A vector of times, the same length as the number of points in pts.

poly

A polygon enclosing the points.

tlimits

A vector of length 2, specifying the upper and lower temporal domain.

s

A vector of spatial distances for the analysis.

tt

A vector of times for the analysis.

nsim

The number of simulations to do.

quiet

If quiet=TRUE then no output is produced, otherwise the function prints the number of simulations completed so far, and also how the test statistic for the data ranks with the simulations.

returnSims

default FALSE, if TRUE, return the stkhat output for the observed data and each simulation as attributes obs and sims

Details

The function uses a sum of residuals as a test statistic, randomly permutes the times of the set of points and recomputes the test statistic for a number of simulations. See Diggle, Chetwynd, Haggkvist and Morris (1995) for details.

References

Diggle, P., Chetwynd, A., Haggkvist, R. and Morris, S. 1995 Second-order analysis of space-time clustering. Statistical Methods in Medical Research, 4, 124-136;Bailey, T. C. and Gatrell, A. C. 1995, Interactive spatial data analysis. Longman, Harlow, pp. 122-125; Rowlingson, B. and Diggle, P. 1993 Splancs: spatial point pattern analysis code in S-Plus. Computers and Geosciences, 19, 627-655; the original sources can be accessed at: https://www.maths.lancs.ac.uk/~rowlings/Splancs/. See also Bivand, R. and Gebhardt, A. 2000 Implementing functions for spatial statistical analysis using the R language. Journal of Geographical Systems, 2, 307-317.

See Also

stkhat, stsecal, stvmat, stdiagn

Examples

Run this code
example(stkhat)
bur1mc <- stmctest(burpts, burkitt$t, burbdy, c(400, 5800),
  seq(1,40,2), seq(100, 1500, 100), nsim=49, quiet=TRUE, returnSims=TRUE)
plot(density(bur1mc$t), xlim=range(c(bur1mc$t0, bur1mc$t)))
abline(v=bur1mc$t0)
r0 <- attr(bur1mc, "obs")$kst-outer(attr(bur1mc, "obs")$ks, attr(bur1mc, "obs")$kt)
rsimlist <- lapply(attr(bur1mc, "sims"), function(x) x$kst - outer(x$ks, x$kt))
rarray <- array(do.call("cbind", rsimlist), dim=c(20, 15, 49))
rmin <- apply(rarray, c(1,2), min)
rmax <- apply(rarray, c(1,2), max)
r0 < rmin
r0 > rmax

Run the code above in your browser using DataCamp Workspace