spatstat.explore-package: The spatstat.explore Package

spatstat.explore-packageR Documentation

The spatstat.explore Package

Description

The spatstat.explore package belongs to the spatstat family of packages. It contains the core functionality for statistical analysis and modelling of spatial data.

Details

spatstat is a family of R packages for the statistical analysis of spatial data. Its main focus is the analysis of spatial patterns of points in two-dimensional space.

The original spatstat package has now been split into several sub-packages.

This sub-package spatstat.explore contains the user-level functions that perform exploratory data analysis and nonparametric data analysis of spatial data.

(The main exception is that functions for linear networks are in the separate sub-package spatstat.linnet.)

Structure of the spatstat family

The orginal spatstat package grew to be very large. It has now been divided into several sub-packages:

  • spatstat.utils containing basic utilities

  • spatstat.sparse containing linear algebra utilities

  • spatstat.data containing datasets

  • spatstat.geom containing geometrical objects and geometrical operations

  • spatstat.explore containing the functionality for exploratory data analysis and nonparametric analysis of spatial data.

  • spatstat.model containing the functionality for statistical modelling, model-fitting, formal statistical inference and informal model diagnostics.

  • spatstat.linnet containing functions for spatial data on a linear network

  • spatstat, which simply loads the other sub-packages listed above, and provides documentation.

When you install spatstat, these sub-packages are also installed. Then if you load the spatstat package by typing library(spatstat), the other sub-packages listed above will automatically be loaded or imported.

For an overview of all the functions available in the sub-packages of spatstat, see the help file for "spatstat-package" in the spatstat package.

Additionally there are several extension packages:

  • spatstat.gui for interactive graphics

  • spatstat.local for local likelihood (including geographically weighted regression)

  • spatstat.Knet for additional, computationally efficient code for linear networks

  • spatstat.sphere (under development) for spatial data on a sphere, including spatial data on the earth's surface

The extension packages must be installed separately and loaded explicitly if needed. They also have separate documentation.

Overview of Functionality in spatstat.explore

The spatstat family of packages is designed to support a complete statistical analysis of spatial data. It supports

  • creation, manipulation and plotting of point patterns;

  • exploratory data analysis;

  • spatial random sampling;

  • simulation of point process models;

  • parametric model-fitting;

  • non-parametric smoothing and regression;

  • formal inference (hypothesis tests, confidence intervals);

  • model diagnostics.

For an overview, see the help file for "spatstat-package" in the spatstat package.

Following is a list of the functionality provided in the spatstat.explore package only.

To simulate a random point pattern:

Functions for generating random point patterns are now contained in the spatstat.random package.

To interrogate a point pattern:

density.ppp kernel estimation of point pattern intensity
densityHeat.ppp diffusion kernel estimation of point pattern intensity
Smooth.ppp kernel smoothing of marks of point pattern
sharpen.ppp data sharpening

Manipulation of pixel images:

An object of class "im" represents a pixel image.

blur apply Gaussian blur to image
Smooth.im apply Gaussian blur to image
transect.im line transect of image
pixelcentres extract centres of pixels
rnoise random pixel noise

Line segment patterns

An object of class "psp" represents a pattern of straight line segments.

density.psp kernel smoothing of line segments
rpoisline generate a realisation of the Poisson line process inside a window

Tessellations

An object of class "tess" represents a tessellation.

rpoislinetess generate tessellation using Poisson line process

Three-dimensional point patterns

An object of class "pp3" represents a three-dimensional point pattern in a rectangular box. The box is represented by an object of class "box3".

runifpoint3 generate uniform random points in 3-D
rpoispp3 generate Poisson random points in 3-D
envelope.pp3 generate simulation envelopes for 3-D pattern

Multi-dimensional space-time point patterns

An object of class "ppx" represents a point pattern in multi-dimensional space and/or time.

runifpointx generate uniform random points
rpoisppx generate Poisson random points

Classical exploratory tools:

clarkevans Clark and Evans aggregation index
fryplot Fry plot
miplot Morisita Index plot

Smoothing:

density.ppp kernel smoothed density/intensity
relrisk kernel estimate of relative risk
Smooth.ppp spatial interpolation of marks
bw.diggle cross-validated bandwidth selection for density.ppp
bw.ppl likelihood cross-validated bandwidth selection for density.ppp
bw.CvL Cronie-Van Lieshout bandwidth selection for density estimation
bw.scott Scott's rule of thumb for density estimation
bw.abram Abramson's rule for adaptive bandwidths
bw.relrisk cross-validated bandwidth selection for relrisk
bw.smoothppp cross-validated bandwidth selection for Smooth.ppp
bw.frac bandwidth selection using window geometry
bw.stoyan Stoyan's rule of thumb for bandwidth for pcf

Modern exploratory tools:

clusterset Allard-Fraley feature detection
nnclean Byers-Raftery feature detection
sharpen.ppp Choi-Hall data sharpening
rhohat Kernel estimate of covariate effect
rho2hat Kernel estimate of effect of two covariates
spatialcdf Spatial cumulative distribution function
roc Receiver operating characteristic curve

Summary statistics for a point pattern:

Fest empty space function F
Gest nearest neighbour distribution function G
Jest J-function J = (1-G)/(1-F)
Kest Ripley's K-function
Lest Besag L-function
Tstat Third order T-function
allstats all four functions F, G, J, K
pcf pair correlation function
Kinhom K for inhomogeneous point patterns
Linhom L for inhomogeneous point patterns
pcfinhom pair correlation for inhomogeneous patterns
Finhom F for inhomogeneous point patterns
Ginhom G for inhomogeneous point patterns
Jinhom J for inhomogeneous point patterns
localL Getis-Franklin neighbourhood density function
localK neighbourhood K-function
localpcf local pair correlation function
localKinhom local K for inhomogeneous point patterns
localLinhom local L for inhomogeneous point patterns
localpcfinhom local pair correlation for inhomogeneous patterns
Ksector Directional K-function
Kscaled locally scaled K-function
Kest.fft fast K-function using FFT for large datasets
Kmeasure reduced second moment measure
envelope simulation envelopes for a summary function
varblock variances and confidence intervals
for a summary function
lohboot bootstrap for a summary function

Related facilities:

plot.fv plot a summary function
eval.fv evaluate any expression involving summary functions
harmonise.fv make functions compatible
eval.fasp evaluate any expression involving an array of functions
with.fv evaluate an expression for a summary function
Smooth.fv apply smoothing to a summary function
deriv.fv calculate derivative of a summary function
pool.fv pool several estimates of a summary function
density.ppp kernel smoothed density
densityHeat.ppp diffusion kernel smoothed density
Smooth.ppp spatial interpolation of marks
relrisk kernel estimate of relative risk
sharpen.ppp data sharpening
rknn theoretical distribution of nearest neighbour distance

Summary statistics for a multitype point pattern: A multitype point pattern is represented by an object X of class "ppp" such that marks(X) is a factor.

relrisk kernel estimation of relative risk
scan.test spatial scan test of elevated risk
Gcross,Gdot,Gmulti multitype nearest neighbour distributions G_{ij}, G_{i\bullet}
Kcross,Kdot, Kmulti multitype K-functions K_{ij}, K_{i\bullet}
Lcross,Ldot multitype L-functions L_{ij}, L_{i\bullet}
Jcross,Jdot,Jmulti multitype J-functions J_{ij}, J_{i\bullet}
pcfcross multitype pair correlation function g_{ij}
pcfdot multitype pair correlation function g_{i\bullet}
pcfmulti general pair correlation function
markconnect marked connection function p_{ij}
alltypes estimates of the above for all i,j pairs
Iest multitype I-function
Kcross.inhom,Kdot.inhom inhomogeneous counterparts of Kcross, Kdot
Lcross.inhom,Ldot.inhom inhomogeneous counterparts of Lcross, Ldot
pcfcross.inhom,pcfdot.inhom inhomogeneous counterparts of pcfcross, pcfdot
localKcross,localKdot local counterparts of Kcross, Kdot
localLcross,localLdot local counterparts of Lcross, Ldot
localKcross.inhom,localLcross.inhom local counterparts of Kcross.inhom, Lcross.inhom

Summary statistics for a marked point pattern: A marked point pattern is represented by an object X of class "ppp" with a component X$marks. The entries in the vector X$marks may be numeric, complex, string or any other atomic type. For numeric marks, there are the following functions:

markmean smoothed local average of marks
markvar smoothed local variance of marks
markcorr mark correlation function
markcrosscorr mark cross-correlation function
markvario mark variogram
markmarkscatter mark-mark scatterplot
Kmark mark-weighted K function
Emark mark independence diagnostic E(r)
Vmark mark independence diagnostic V(r)
nnmean nearest neighbour mean index
nnvario nearest neighbour mark variance index

For marks of any type, there are the following:

Gmulti multitype nearest neighbour distribution
Kmulti multitype K-function
Jmulti multitype J-function

Alternatively use cut.ppp to convert a marked point pattern to a multitype point pattern.

Programming tools:

marktable tabulate the marks of neighbours in a point pattern

Summary statistics for a three-dimensional point pattern:

These are for 3-dimensional point pattern objects (class pp3).

F3est empty space function F
G3est nearest neighbour function G
K3est K-function
pcf3est pair correlation function

Related facilities:

envelope.pp3 simulation envelopes

Summary statistics for random sets:

These work for point patterns (class ppp), line segment patterns (class psp) or windows (class owin).

Hest spherical contact distribution H
Gfox Foxall G-function
Jfox Foxall J-function

Model fitting

Functions for fitting point process models are now contained in the spatstat.model package.

Simulation

There are many ways to generate a random point pattern, line segment pattern, pixel image or tessellation in spatstat.

Random point patterns: Functions for random generation are now contained in the spatstat.random package.

See also varblock for estimating the variance of a summary statistic by block resampling, and lohboot for another bootstrap technique.

Fitted point process models:

If you have fitted a point process model to a point pattern dataset, the fitted model can be simulated.

Methods for simulating a fitted model are now contained in the spatstat.model package.

Other random patterns: Functions for random generation are now contained in the spatstat.random package.

Simulation-based inference

envelope critical envelope for Monte Carlo test of goodness-of-fit
bits.envelope critical envelope for balanced two-stage Monte Carlo test
qqplot.ppm diagnostic plot for interpoint interaction
scan.test spatial scan statistic/test
studpermu.test studentised permutation test
segregation.test test of segregation of types

Hypothesis tests:

quadrat.test \chi^2 goodness-of-fit test on quadrat counts
clarkevans.test Clark and Evans test
cdf.test Spatial distribution goodness-of-fit test
berman.test Berman's goodness-of-fit tests
envelope critical envelope for Monte Carlo test of goodness-of-fit
scan.test spatial scan statistic/test
dclf.test Diggle-Cressie-Loosmore-Ford test
mad.test Mean Absolute Deviation test
anova.ppm Analysis of Deviance for point process models

More recently-developed tests:

dg.test Dao-Genton test
bits.test Balanced independent two-stage test
dclf.progress Progress plot for DCLF test
mad.progress Progress plot for MAD test

Model diagnostics:

Classical measures of model sensitivity such as leverage and influence, and classical model diagnostic tools such as residuals, partial residuals, and effect estimates, have been adapted to point process models. These capabilities are now provided in the spatstat.model package.

Resampling and randomisation procedures

You can build your own tests based on randomisation and resampling using the following capabilities:

quadratresample block resampling
rshift random shifting of (subsets of) points
rthin random thinning

Licence

This library and its documentation are usable under the terms of the "GNU General Public License", a copy of which is distributed with the package.

Acknowledgements

Kasper Klitgaard Berthelsen, Ottmar Cronie, Tilman Davies, Julian Gilbey, Yongtao Guan, Ute Hahn, Kassel Hingee, Abdollah Jalilian, Marie-Colette van Lieshout, Greg McSwiggan, Tuomas Rajala, Suman Rakshit, Dominic Schuhmacher, Rasmus Waagepetersen and Hangsheng Wang made substantial contributions of code.

For comments, corrections, bug alerts and suggestions, we thank Monsuru Adepeju, Corey Anderson, Ang Qi Wei, Ryan Arellano, Jens Astrom, Robert Aue, Marcel Austenfeld, Sandro Azaele, Malissa Baddeley, Guy Bayegnak, Colin Beale, Melanie Bell, Thomas Bendtsen, Ricardo Bernhardt, Andrew Bevan, Brad Biggerstaff, Anders Bilgrau, Leanne Bischof, Christophe Biscio, Roger Bivand, Jose M. Blanco Moreno, Florent Bonneu, Jordan Brown, Ian Buller, Julian Burgos, Simon Byers, Ya-Mei Chang, Jianbao Chen, Igor Chernayavsky, Y.C. Chin, Bjarke Christensen, Lucia Cobo Sanchez, Jean-Francois Coeurjolly, Kim Colyvas, Hadrien Commenges, Rochelle Constantine, Robin Corria Ainslie, Richard Cotton, Marcelino de la Cruz, Peter Dalgaard, Mario D'Antuono, Sourav Das, Peter Diggle, Patrick Donnelly, Ian Dryden, Stephen Eglen, Ahmed El-Gabbas, Belarmain Fandohan, Olivier Flores, David Ford, Peter Forbes, Shane Frank, Janet Franklin, Funwi-Gabga Neba, Oscar Garcia, Agnes Gault, Jonas Geldmann, Marc Genton, Shaaban Ghalandarayeshi, Jason Goldstick, Pavel Grabarnik, C. Graf, Ute Hahn, Andrew Hardegen, Martin \Bogsted Hansen, Martin Hazelton, Juha Heikkinen, Mandy Hering, Markus Herrmann, Maximilian Hesselbarth, Paul Hewson, Hamidreza Heydarian, Kurt Hornik, Philipp Hunziker, Jack Hywood, Ross Ihaka, Cenk Icos, Aruna Jammalamadaka, Robert John-Chandran, Devin Johnson, Mahdieh Khanmohammadi, Bob Klaver, Lily Kozmian-Ledward, Peter Kovesi, Mike Kuhn, Jeff Laake, Robert Lamb, Frederic Lavancier, Tom Lawrence, Tomas Lazauskas, Jonathan Lee, George Leser, Angela Li, Li Haitao, George Limitsios, Andrew Lister, Nestor Luambua, Ben Madin, Martin Maechler, Kiran Marchikanti, Jeff Marcus, Robert Mark, Peter McCullagh, Monia Mahling, Jorge Mateu Mahiques, Ulf Mehlig, Frederico Mestre, Sebastian Wastl Meyer, Mi Xiangcheng, Lore De Middeleer, Robin Milne, Enrique Miranda, Jesper \Moller, Annie Mollie, Ines Moncada, Mehdi Moradi, Virginia Morera Pujol, Erika Mudrak, Gopalan Nair, Nader Najari, Nicoletta Nava, Linda Stougaard Nielsen, Felipe Nunes, Jens Randel Nyengaard, Jens \Oehlschlaegel, Thierry Onkelinx, Sean O'Riordan, Evgeni Parilov, Jeff Picka, Nicolas Picard, Tim Pollington, Mike Porter, Sergiy Protsiv, Adrian Raftery, Ben Ramage, Pablo Ramon, Xavier Raynaud, Nicholas Read, Matt Reiter, Ian Renner, Tom Richardson, Brian Ripley, Ted Rosenbaum, Barry Rowlingson, Jason Rudokas, Tyler Rudolph, John Rudge, Christopher Ryan, Farzaneh Safavimanesh, Aila \Sarkka, Cody Schank, Katja Schladitz, Sebastian Schutte, Bryan Scott, Olivia Semboli, Francois Semecurbe, Vadim Shcherbakov, Shen Guochun, Shi Peijian, Harold-Jeffrey Ship, Tammy L Silva, Ida-Maria Sintorn, Yong Song, Malte Spiess, Mark Stevenson, Kaspar Stucki, Jan Sulavik, Michael Sumner, P. Surovy, Ben Taylor, Thordis Linda Thorarinsdottir, Leigh Torres, Berwin Turlach, Torben Tvedebrink, Kevin Ummer, Medha Uppala, Andrew van Burgel, Tobias Verbeke, Mikko Vihtakari, Alexendre Villers, Fabrice Vinatier, Maximilian Vogtland, Sasha Voss, Sven Wagner, Hao Wang, H. Wendrock, Jan Wild, Carl G. Witthoft, Selene Wong, Maxime Woringer, Luke Yates, Mike Zamboni and Achim Zeileis.

Author(s)

\spatstatAuthors

.


spatstat.explore documentation built on Oct. 23, 2023, 1:07 a.m.