1. Home
  2. KSTMCTEST procedure

KSTMCTEST procedure

Performs a Monte-Carlo test for space-time interaction (D.A. Murray, P.J. Diggle & B.S. Rowlingson).

Options

PRINT = string token Controls printed output (statistic, rank); default stat, rank
PLOT = string token Whether to produce a plot of the test statistic (histogram); default hist
NTIMES = scalar Number of simulations for Monte-Carlo test; default 49
SEED = scalar Seed for random number generator; default 0 continues from previous generation or uses system clock

Parameters

Y = variates Vertical coordinates of the first spatial point patterns; no default – this parameter must be set
X = variates Horizontal coordinates of the first spatial point patterns; no default – this parameter must be set
TIMES = variates Times for each event
YPOLYGON = variates Vertical coordinates of the polygons; no default – this parameter must be set
XPOLYGON = variates Horizontal coordinates of the polygons; no default – this parameter must be set
S = variates Vectors of distances to use; no default – this parameter must be set
TVALUES = variates Time scales for the analysis
TLOWER = variates Lower temporal domain
TUPPER = variates Upper temporal domain
STATISTIC = scalars Saves the Monte-Carlo statistic

Description

For data that consist of locations and times of events within a specified spatial region and time-period, it is often of interest to examine whether events that are relatively close in space are also relatively close in time. Data that have events both close in space and time are said to exhibit space-time clustering. KSTMCTEST performs a Monte-Carlo test for space-time interaction using a sum of the residuals as a test statistic. For a given number of simulations the procedure randomly permutes the times of set of points, and computes the sum of differences between the space-time K function and the product of the spatial and temporal K functions. The first simulation represents the observed value of the test statistic.

The data required by the procedure are the coordinates of a spatial point pattern (specified by the parameters X and Y), and the times for each of the events (specified by TIMES). The coordinates of a polygon containing the spatial points are specified by the parameters XPOLYGON and YPOLYGON, and the S parameter is used to supply the vector of distances at which to calculate the spatial K function. The TLOWER and TUPPER parameters specify the start and finish of the temporal range. The TVALUES parameter is used to supply the vector of times at which to calculate the temporal K function. The output of the procedure are vectors of estimates of the spatial and temporal K function corresponding to the distances in S and times in TIMES. The values of the test statistic can be saved using the STATISTIC parameter.

The NTIMES option allows you to specify the number of simulations and the SEED option allows you to set a randomization seed. By default SEED=0, so the random numbers will continue any existing sequence, used earlier in the Genstat program. The setting PLOT=histogram can be used to produce a histogram of the test statistics with the value for the data indicated with a vertical line.

Printed output is controlled using the PRINT option. The default setting of summary prints the test statistic for the Monte-Carlo test, and rank prints how the test statistic for the data ranks with the simulations.

Options: PRINT, PLOT, NSIM, SEED.

Parameters: Y, X, TIMES, YPOLYGON, XPOLYGON, S, TVALUES, TLOWER, TUPPER, STATISTIC.

Method

A procedure PTCHECKXY is called to check that X, Y and TIMES have identical restrictions. A similar check is made on XPOLYGON and YPOLYGON. The procedure then calls PTCLOSEPOLYGON to close the polygon specified by XPOLYGON and YPOLYGON. For each simulation the procedure randomly permutes the times of the set of points and then calls a procedure PTPASS to call a Fortran program to calculate an estimate of the space-time K functions. The difference between the space-time K function and the product of the spatial and temporal K functions is then calculated.

Action with RESTRICT

The variates X, Y, TIMES, XPOLYGON, YPOLYGON, S and TVALUES may be restricted, as long as X, Y and TIMES have the same restriction, and XPOLYGON has the same restriction as YPOLYGON. Only the subset of values specified by each restriction will be included in the calculations.

References

Diggle, P,J. (1983). Statistical Analysis of Spatial Point Patterns. Academic Press, London.

Diggle, P.J., Chetwynd, A.G., Haggkvist, R. & Morris, S.E. (1995). Second-order analysis of space-time clustering. Statistical Methods in Medical Research, 4, 124-136.

See also

Procedures: FHAT, GHAT, KHAT, KSTHAT, KSTSE, K12HAT.

Commands for: Spatial statistics.

Example

CAPTION 'KSTMCTEST example'; STYLE=meta
VARIATE [NVALUES=188] X
READ    X
300 291 326 299 267 266 267 262 268 335 302 301 302 324 260 306 284 293 274
263 307 274 297 288 283 290 284 286 282 292 305 298 299 287 276 261 273 284
266 285 278 305 293 297 332 256 275 267 267 286 322 278 280 276 261 323 260
283 282 308 293 331 266 280 301 279 321 292 315 323 282 269 330 281 330 328
264 303 264 259 329 328 284 309 329 273 295 262 281 325 288 302 315 295 284
272 305 279 290 311 288 324 287 283 267 280 275 281 313 273 283 304 308 330
260 289 268 329 264 274 286 263 265 269 260 279 284 270 267 320 282 303 303
264 303 289 270 262 274 262 262 267 255 267 273 270 270 265 276 276 283 305
264 286 278 257 302 275 290 279 300 270 290 291 283 270 266 267 300 268 276
293 273 267 278 310 298 266 279 266 267 272 327 265 310 279 277 258 :
VARIATE [NVALUES=188] Y
READ    Y
302 270 263 376 327 356 345 338 335 275 272 304 272 337 338 385 362 332 353
333 386 357 282 365 366 352 341 341 350 278 381 378 381 342 380 345 347 357
361 360 350 321 332 375 273 345 357 350 301 379 332 349 356 354 343 298 346
352 361 390 275 272 308 354 271 361 280 391 307 333 302 348 349 302 396 341
323 382 285 337 350 351 351 370 270 347 267 353 352 335 341 248 273 377 358
376 369 318 339 376 256 284 353 364 337 298 326 299 365 332 363 366 387 275
339 335 314 268 298 342 373 346 335 340 359 355 399 337 363 282 315 377 247
297 337 380 330 335 342 333 333 369 290 336 309 328 339 334 360 360 363 374
326 361 333 344 395 378 361 362 255 357 356 368 361 325 332 367 364 390 337
396 345 338 367 387 268 332 340 361 344 370 383 335 387 339 379 350 :
VARIATE [NVALUES=188] Times
READ    Times
413  472  511  689  730  847  871  899  921 1134 1190 1214 1224 1322 1399
1480 1503 1549 1567 1607 1615 1657 1688 1695 1714 1811 1813 1910 1986 1996
2049 2053 2075 2081 2103 2204 2209 2215 2239 2272 2281 2349 2351 2373 2377
2388 2411 2412 2419 2424 2488 2510 2512 2533 2545 2588 2616 2617 2629 2658
2695 2715 2766 2772 2800 2888 2996 3027 3118 3153 3149 3149 3173 3237 3245
3266 3275 3286 3302 3308 3323 3342 3346 3422 3453 3453 3500 3530 3570 3576
3614 3636 3661 3693 3716 3773 3790 3806 3843 3848 3848 3851 3973 3976 3878
3963 3985 4079 4080 4107 4118 4133 4156 4194 4195 4207 4212 4213 4213 4216
4235 4258 4273 4277 4290 4336 4339 4352 4383 4385 4441 4492 4518 4554 4565
4610 4628 4637 4638 4700 4700 4701 4708 4750 4751 4764 4780 4806 4822 4848
4858 4861 4862 4888 4891 4914 4918 4932 4944 4948 4964 4975 5001 5002 5072
5135 5199 5353 5358 5361 5489 5495 5505 5530 5578 5583 5588 5599 5641 5643
5650 5661 5702 5728 5752 5753 5755 5775 :
VARIATE [NVALUES=353] Xpoly
READ    Xpoly
337.8 338.5 340.4 341 340.4 340.4 338.5 337.8 337.2 336.6 335.9 332.7 331.5
328.3 326.3 326.3 325.7 325.7 325.1 324.4 323.8 323.1 322.5 323.1 323.8
325.1 325.1 325.7 325.7 325.1 325.1 323.1 321.9 320.6 320.6 318.7 315.5
314.8 314.8 315.5 315.5 316.1 316.7 318.7 319.3 319.9 319.9 321.9 321.9
322.5 322.5 323.1 323.1 323.8 323.8 324.4 324.4 326.3 326.3 327 327 328.3
328.3 328.9 328.9 330.8 331.5 332.7 332.7 331.5 330.8 330.2 329.5 328.3
328.3 323.8 323.8 324.4 324.4 325.1 325.1 324.4 324.4 325.1 325.1 326.3
326.3 327 328.3 328.9 328.9 329.5 329.5 330.2 330.2 330.8 330.8 332.7 332.7
333.4 333.4 335.3 335.3 334.7 334.7 333.4 333.4 331.5 330.8 329.5 328.3 327
325.7 325.1 324.4 321.9 321.2 320.6 319.9 319.3 318 317.4 316.7 316.1 314.8
314.2 312.3 311 309.1 308.4 307.2 306.5 303.3 302.7 299.5 298.8 297.6 296.9
295 293.7 291.2 290.5 289.9 288.6 288 287.3 286 284.8 281.6 280.9 280.3
279.7 279.7 275.2 274.5 273.9 272 270.7 269.4 267.5 266.9 263.7 263.7 263
263 261.7 261.7 261.1 261.1 261.7 263.7 264.9 266.2 268.1 268.8 268.8 269.4
269.4 268.8 268.8 267.5 266.9 263.7 263.7 260.5 259.8 259.2 259.2 257.9
257.9 257.3 257.3 256.6 256.6 256 256 255.3 255.3 254.1 254.1 253.4 253.4
252.8 252.8 251.5 250.9 250.2 250.2 249.6 249.6 249 249 250.2 251.5 254.7
255.3 257.9 257.9 258.5 258.5 259.2 259.2 259.8 259.8 261.1 261.1 261.7
261.7 263 263 261.7 261.7 260.5 259.8 259.2 259.2 258.5 257.9 257.3 256.6
253.4 253.4 250.9 250.9 251.5 251.5 248.3 248.3 247 247 246.4 246.4 248.3
248.3 249 249.6 250.2 254.1 255.3 255.3 257.9 257.9 259.2 262.4 263 266.2
266.9 268.8 269.4 269.4 270.1 270.7 271.3 272.6 273.3 275.8 277.1 277.7
278.4 280.3 280.9 282.2 283.5 283.5 284.1 284.1 285.4 285.4 286 287.3 288.6
289.9 290.5 291.2 291.8 292.4 293.1 293.7 295 296.3 296.9 296.9 298.8 299.5
300.1 300.8 301.4 302 302.7 303.3 304.6 304.6 305.9 307.2 308.4 309.7 310.3
310.3 311.6 311.6 312.3 312.3 314.2 314.2 314.8 314.8 316.1 316.7 317.4
317.4 318 318.7 319.9 319.9 320.6 323.1 323.8 324.4 326.3 326.3 328.3 330.2
331.5 332.7 334 334.7 335.9 336.6 337.8 338.5 339.1 339.1 337.8 :
VARIATE [NVALUES=353] Ypoly
READ    Ypoly
270.9 271.7 271.7 272.4 273.2 274.7 277 277 277.7 277.7 278.5 278.5 280 280
282.3 283 283.8 289.1 289.8 289.8 290.6 290.6 291.4 292.1 292.1 293.6 295.2
295.9 302.7 303.5 305.8 308 308 309.5 310.3 312.6 312.6 313.3 316.4 317.1
317.9 318.6 318.6 320.9 320.9 321.7 322.4 324.7 326.2 327 327.7 328.5 329.2
330 330.8 331.5 333 335.3 336.8 337.6 338.3 339.8 340.6 341.4 342.1 344.4
344.4 345.9 348.2 349.7 349.7 350.5 350.5 352 353.5 358.8 362.6 363.3 364.8
365.6 367.9 368.6 371.7 372.4 374.7 376.2 377.7 378.5 378.5 379.2 380.8
381.5 382.3 383 383.8 384.5 385.3 387.6 388.3 389.1 389.8 392.1 398.9 399.7
401.2 402.7 403.5 405.8 405.8 407.3 407.3 408.8 408.8 409.5 409.5 412.6
412.6 413.3 413.3 414.1 414.1 414.8 414.8 415.6 415.6 416.4 416.4 417.9
417.9 418.6 418.6 419.4 419.4 418.6 418.6 417.9 417.9 417.1 417.1 415.6
415.6 414.8 414.8 413.3 413.3 412.6 412.6 411.1 411.1 410.3 410.3 409.5
408.8 403.5 403.5 402.7 402.7 401.2 401.2 398.9 398.9 395.2 392.9 392.1
391.4 389.8 388.3 387.6 383.8 383 383 384.5 384.5 386.8 386.1 383.8 383
375.5 374.7 373.2 371.7 371.7 367.9 367.1 363.3 363.3 362.6 361.8 360.3
359.5 358.8 357.3 356.5 355.8 355 352.7 352 351.2 349.7 348.9 348.2 347.4
346.7 345.9 344.4 344.4 343.6 342.1 341.4 340.6 339.8 338.3 336.8 336.8 333
333 330 327.7 327 326.2 325.5 324.7 323.9 323.2 321.7 320.9 320.2 319.4
317.9 317.1 315.6 314.8 313.3 313.3 312.6 311.8 311.1 311.1 310.3 310.3
306.5 305.8 302.7 295.2 294.4 290.6 286.8 285.3 283.8 283 282.3 278.5 276.2
270.2 269.4 269.4 270.2 270.2 268.6 266.4 263.3 261.8 260.3 260.3 261.1
261.1 260.3 260.3 261.1 265.6 266.4 266.4 267.1 267.1 266.4 266.4 264.8
264.8 264.1 264.1 263.3 263.3 261.8 260.3 259.5 258 256.5 254.2 253.5 253.5
252 252 252.7 252.7 253.5 253.5 254.2 254.2 255.8 255.8 255 247.4 245.2
245.2 244.4 244.4 243.6 243.6 242.9 242.9 241.4 240.6 239.1 239.1 237.6
237.6 238.3 239.1 240.6 242.9 243.6 244.4 246.7 247.4 248.2 250.5 252 252
252.7 253.5 254.2 254.2 255.8 257.3 258 258 258.8 258.8 261.1 262.6 264.8
264.8 263.3 263.3 261.8 261.8 263.3 263.3 264.8 264.8 265.6 269.4 270.9 :
VARIATE   [VALUES=1,3...39] S
VARIATE   [VALUES=100,200...1500] T
KSTMCTEST [SEED=483796] Y=Y; X=X; TIMES=Times; YPOLYGON=Ypoly;\
          XPOLYGON=Xpoly; S=S; TVALUES=T; TLOWER=400; TUPPER=5800
Updated on June 19, 2019

Was this article helpful?