Spat Stat Quick Ref

32
Spatstat Quick Reference guide March 2, 2015 spatstat-package The Spatstat Package Description This is a summary of the features of spatstat, a package in R for the statistical analysis of spatial point patterns. Details spatstat is a package for the statistical analysis of spatial data. Currently, it deals mainly with the analysis of spatial patterns of points in two-dimensional space. The points may carry auxiliary data (‘marks’), and the spatial region in which the points were recorded may have arbitrary shape. The package supports • creation, manipulation and plotting of point patterns • exploratory data analysis • simulation of point process models • parametric model-fitting • hypothesis tests and model diagnostics Apart from two-dimensional point patterns and point processes, spatstat also supports point pat- terns in three dimensions, point patterns in multidimensional space-time, point patterns on a linear network, patterns of line segments in two dimensions, and spatial tessellations and random sets in two dimensions. The package can fit several types of point process models to a point pattern dataset: • Poisson point process models (by Berman-Turner approximate maximum likelihood or by spatial logistic regression) • Gibbs/Markov point process models (by Baddeley-Turner approximate maximum pseudolike- lihood, Coeurjolly-Rubak logistic likelihood, or Huang-Ogata approximate maximum likeli- hood) 1

description

q

Transcript of Spat Stat Quick Ref

Page 1: Spat Stat Quick Ref

Spatstat Quick Reference guideMarch 2, 2015

spatstat-package The Spatstat Package

Description

This is a summary of the features of spatstat, a package in R for the statistical analysis of spatialpoint patterns.

Details

spatstat is a package for the statistical analysis of spatial data. Currently, it deals mainly with theanalysis of spatial patterns of points in two-dimensional space. The points may carry auxiliary data(‘marks’), and the spatial region in which the points were recorded may have arbitrary shape.

The package supports

• creation, manipulation and plotting of point patterns

• exploratory data analysis

• simulation of point process models

• parametric model-fitting

• hypothesis tests and model diagnostics

Apart from two-dimensional point patterns and point processes, spatstat also supports point pat-terns in three dimensions, point patterns in multidimensional space-time, point patterns on a linearnetwork, patterns of line segments in two dimensions, and spatial tessellations and random sets intwo dimensions.

The package can fit several types of point process models to a point pattern dataset:

• Poisson point process models (by Berman-Turner approximate maximum likelihood or byspatial logistic regression)

• Gibbs/Markov point process models (by Baddeley-Turner approximate maximum pseudolike-lihood, Coeurjolly-Rubak logistic likelihood, or Huang-Ogata approximate maximum likeli-hood)

1

Page 2: Spat Stat Quick Ref

2 spatstat-package

• Cox/cluster process models (by Waagepetersen’s two-step fitting procedure and minimumcontrast, or by composite likelihood)

The models may include spatial trend, dependence on covariates, and complicated interpoint in-teractions. Models are specified by a formula in the R language, and are fitted using a functionanalogous to lm and glm. Fitted models can be printed, plotted, predicted, simulated and so on.

Getting Started

For a quick introduction to spatstat, see the package vignette Getting started with spatstat installedwith spatstat. (To see this document online, start R, type help.start() to open the help browser,and navigate to Packages > spatstat > Vignettes).

For a complete 2-day course on using spatstat, see the workshop notes by Baddeley (2010), avail-able on the internet. (This is now somewhat out-of-date but it will get you started.)

Type demo(spatstat) for a demonstration of the package’s capabilities. Type demo(data) to seeall the datasets available in the package.

For information about handling data in shapefiles, see the Vignette Handling shapefiles in the spat-stat package installed with spatstat.To learn about spatial point process methods, see the short book by Diggle (2003) and the handbookGelfand et al (2010).

Updates

New versions of spatstat are produced about once a month. Users are advised to update theirinstallation of spatstat regularly.

Type latest.news to read the news documentation about changes to the current installed versionof spatstat.See the Vignette Summary of recent updates, installed with spatstat, which describes the mainchanges to spatstat since the workshop notes were published in 2010,

Type news(package="spatstat") to read news documentation about all previous versions of thepackage.

FUNCTIONS AND DATASETS

Following is a summary of the main functions and datasets in the spatstat package. Alternativelyan alphabetical list of all functions and datasets is available by typing library(help=spatstat).

For further information on any of these, type help(name) where name is the name of the functionor dataset.

CONTENTS:

I. Creating and manipulating dataII. Exploratory Data AnalysisIII. Model fitting (cluster models)IV. Model fitting (Poisson and Gibbs models)V. Model fitting (spatial logistic regression)VI. Simulation

Page 3: Spat Stat Quick Ref

spatstat-package 3

VII. Tests and diagnosticsVIII. Documentation

I. CREATING AND MANIPULATING DATA

Types of spatial data:The main types of spatial data supported by spatstat are:

ppp point patternowin window (spatial region)im pixel imagepsp line segment patterntess tessellationpp3 three-dimensional point patternppx point pattern in any number of dimensionslpp point pattern on a linear network

To create a point pattern:

ppp create a point pattern from (x, y) and window informationppp(x, y, xlim, ylim) for rectangular windowppp(x, y, poly) for polygonal windowppp(x, y, mask) for binary image window

as.ppp convert other types of data to a ppp objectclickppp interactively add points to a plotmarks<-, %mark% attach/reassign marks to a point pattern

To simulate a random point pattern:

runifpoint generate n independent uniform random pointsrpoint generate n independent random pointsrmpoint generate n independent multitype random pointsrpoispp simulate the (in)homogeneous Poisson point processrmpoispp simulate the (in)homogeneous multitype Poisson point processrunifdisc generate n independent uniform random points in discrstrat stratified random sample of pointsrsyst systematic random sample of pointsrjitter apply random displacements to points in a patternrMaternI simulate the Matérn Model I inhibition processrMaternII simulate the Matérn Model II inhibition processrSSI simulate Simple Sequential Inhibition processrStrauss simulate Strauss process (perfect simulation)rHardcore simulate Hard Core process (perfect simulation)rDiggleGratton simulate Diggle-Gratton process (perfect simulation)rDGS simulate Diggle-Gates-Stibbard process (perfect simulation)rNeymanScott simulate a general Neyman-Scott process

Page 4: Spat Stat Quick Ref

4 spatstat-package

rPoissonCluster simulate a general Poisson cluster processrMatClust simulate the Matérn Cluster processrThomas simulate the Thomas processrGaussPoisson simulate the Gauss-Poisson cluster processrCauchy simulate Neyman-Scott Cauchy cluster processrVarGamma simulate Neyman-Scott Variance Gamma cluster processrthin random thinningrcell simulate the Baddeley-Silverman cell processrmh simulate Gibbs point process using Metropolis-Hastingssimulate.ppm simulate Gibbs point process using Metropolis-HastingsrunifpointOnLines generate n random points along specified line segmentsrpoisppOnLines generate Poisson random points along specified line segments

To randomly change an existing point pattern:

rshift random shifting of pointsrjitter apply random displacements to points in a patternrthin random thinningrlabel random (re)labelling of a multitype point patternquadratresample block resampling

Standard point pattern datasets:Datasets in spatstat are lazy-loaded, so you can simply type the name of the dataset to use it; thereis no need to type data(amacrine) etc.

Type demo(data) to see a display of all the datasets installed with the package.

Type vignette(datasets) for a document giving an overview of all datasets, including back-ground information, and plots.

amacrine Austin Hughes’ rabbit amacrine cellsanemones Upton-Fingleton sea anemones dataants Harkness-Isham ant nests databdspots Breakdown spots in microelectrodesbei Tropical rainforest treesbetacells Waessle et al. cat retinal ganglia databramblecanes Bramble Canes databronzefilter Bronze Filter Section datacells Crick-Ripley biological cells datachicago Chicago street crimeschorley Chorley-Ribble cancer dataclmfires Castilla-La Mancha forest firescopper Berman-Huntington copper deposits datadendrite Dendritic spinesdemohyper Synthetic point patternsdemopat Synthetic point patternfinpines Finnish Pines dataflu Influenza virus proteinsgordon People in Gordon Square, London

Page 5: Spat Stat Quick Ref

spatstat-package 5

gorillas Gorilla nest siteshamster Aherne’s hamster tumour datahumberside North Humberside childhood leukaemia datahyytiala Mixed forest in Hyytiälä, Finlandjapanesepines Japanese Pines datalansing Lansing Woods datalongleaf Longleaf Pines datamucosa Cells in gastric mucosamurchison Murchison gold depositsnbfires New Brunswick fires datanztrees Mark-Esler-Ripley trees dataosteo Osteocyte lacunae (3D, replicated)paracou Kimboto trees in Paracou, French Guianaponderosa Getis-Franklin ponderosa pine trees datapyramidal Pyramidal neurons from 31 brainsredwood Strauss-Ripley redwood saplings dataredwoodfull Strauss redwood saplings data (full set)residualspaper Data from Baddeley et al (2005)shapley Galaxies in an astronomical surveysimdat Simulated point pattern (inhomogeneous, with interaction)spiders Spider webs on mortar lines of brick wallsporophores Mycorrhizal fungi around a treespruces Spruce trees in Saxoniaswedishpines Strand-Ripley Swedish pines dataurkiola Urkiola Woods datawaka Trees in Waka national parkwaterstriders Insects on water surface

To manipulate a point pattern:

plot.ppp plot a point pattern (e.g. plot(X))iplot plot a point pattern interactively[.ppp extract or replace a subset of a point pattern

pp[subset] or pp[subwindow]subset.ppp extract subset of point pattern satisfying a conditionsuperimpose combine several point patternsby.ppp apply a function to sub-patterns of a point patterncut.ppp classify the points in a point patternsplit.ppp divide pattern into sub-patternsunmark remove marksnpoints count the number of pointscoords extract coordinates, change coordinatesmarks extract marks, change marks or attach marksrotate rotate patternshift translate patternflipxy swap x and y coordinatesreflect reflect in the originperiodify make several translated copiesaffine apply affine transformation

Page 6: Spat Stat Quick Ref

6 spatstat-package

scalardilate apply scalar dilationdensity.ppp kernel estimation of point pattern intensitySmooth.ppp kernel smoothing of marks of point patternnnmark mark value of nearest data pointsharpen.ppp data sharpeningidentify.ppp interactively identify pointsunique.ppp remove duplicate pointsduplicated.ppp determine which points are duplicatesconnected.ppp find clumps of pointsdirichlet compute Dirichlet-Voronoi tessellationdelaunay compute Delaunay triangulationdelaunay.distance graph distance in Delaunay triangulationconvexhull compute convex hulldiscretise discretise coordinatespixellate.ppp approximate point pattern by pixel imageas.im.ppp approximate point pattern by pixel image

See spatstat.options to control plotting behaviour.

To create a window:An object of class "owin" describes a spatial region (a window of observation).

owin Create a window objectowin(xlim, ylim) for rectangular windowowin(poly) for polygonal windowowin(mask) for binary image window

Window Extract window of another objectFrame Extract the containing rectangle (’frame’) of another objectas.owin Convert other data to a window objectsquare make a square windowdisc make a circular windowripras Ripley-Rasson estimator of window, given only the pointsconvexhull compute convex hull of somethingletterR polygonal window in the shape of the R logoclickpoly interactively draw a polygonal windowclickbox interactively draw a rectangle

To manipulate a window:

plot.owin plot a window.plot(W)

boundingbox Find a tight bounding box for the windowerosion erode window by a distance rdilation dilate window by a distance rclosing close window by a distance ropening open window by a distance rborder difference between window and its erosion/dilationcomplement.owin invert (swap inside and outside)

Page 7: Spat Stat Quick Ref

spatstat-package 7

simplify.owin approximate a window by a simple polygonrotate rotate windowflipxy swap x and y coordinatesshift translate windowperiodify make several translated copiesaffine apply affine transformation

Digital approximations:

as.mask Make a discrete pixel approximation of a given windowas.im.owin convert window to pixel imagepixellate.owin convert window to pixel imagecommonGrid find common pixel grid for windowsnearest.raster.point map continuous coordinates to raster locationsraster.x raster x coordinatesraster.y raster y coordinatesas.polygonal convert pixel mask to polygonal window

See spatstat.options to control the approximation

Geometrical computations with windows:

edges extract boundary edgesintersect.owin intersection of two windowsunion.owin union of two windowssetminus.owin set subtraction of two windowsinside.owin determine whether a point is inside a windowarea.owin compute areaperimeter compute perimeter lengthdiameter.owin compute diameterincircle find largest circle inside a windowconnected.owin find connected components of windoweroded.areas compute areas of eroded windowsdilated.areas compute areas of dilated windowsbdist.points compute distances from data points to window boundarybdist.pixels compute distances from all pixels to window boundarybdist.tiles boundary distance for each tile in tessellationdistmap.owin distance transform imagedistfun.owin distance transformcentroid.owin compute centroid (centre of mass) of windowis.subset.owin determine whether one window contains anotheris.convex determine whether a window is convexconvexhull compute convex hullas.mask pixel approximation of windowas.polygonal polygonal approximation of windowis.rectangle test whether window is a rectangleis.polygonal test whether window is polygonalis.mask test whether window is a masksetcov spatial covariance function of window

Page 8: Spat Stat Quick Ref

8 spatstat-package

pixelcentres extract centres of pixels in mask

Pixel images: An object of class "im" represents a pixel image. Such objects are returned by someof the functions in spatstat including Kmeasure, setcov and density.ppp.

im create a pixel imageas.im convert other data to a pixel imagepixellate convert other data to a pixel imageas.matrix.im convert pixel image to matrixas.data.frame.im convert pixel image to data frameas.function.im convert pixel image to functionplot.im plot a pixel image on screen as a digital imagecontour.im draw contours of a pixel imagepersp.im draw perspective plot of a pixel imagergbim create colour-valued pixel imagehsvim create colour-valued pixel image[.im extract a subset of a pixel image[<-.im replace a subset of a pixel imagerotate.im rotate pixel imageshift.im apply vector shift to pixel imageaffine.im apply affine transformation to imageX print very basic information about image Xsummary(X) summary of image Xhist.im histogram of imagemean.im mean pixel value of imageintegral.im integral of pixel valuesquantile.im quantiles of imagecut.im convert numeric image to factor imageis.im test whether an object is a pixel imageinterp.im interpolate a pixel imageblur apply Gaussian blur to imageSmooth.im apply Gaussian blur to imageconnected.im find connected componentscompatible.im test whether two images have compatible dimensionsharmonise.im make images compatiblecommonGrid find a common pixel grid for imageseval.im evaluate any expression involving imagesscaletointerval rescale pixel valueszapsmall.im set very small pixel values to zerolevelset level set of an imagesolutionset region where an expression is trueimcov spatial covariance function of imageconvolve.im spatial convolution of imagestransect.im line transect of imagepixelcentres extract centres of pixels

Line segment patternsAn object of class "psp" represents a pattern of straight line segments.

Page 9: Spat Stat Quick Ref

spatstat-package 9

psp create a line segment patternas.psp convert other data into a line segment patternedges extract edges of a windowis.psp determine whether a dataset has class "psp"plot.psp plot a line segment patternprint.psp print basic informationsummary.psp print summary information[.psp extract a subset of a line segment patternas.data.frame.psp convert line segment pattern to data framemarks.psp extract marks of line segmentsmarks<-.psp assign new marks to line segmentsunmark.psp delete marks from line segmentsmidpoints.psp compute the midpoints of line segmentsendpoints.psp extract the endpoints of line segmentslengths.psp compute the lengths of line segmentsangles.psp compute the orientation angles of line segmentssuperimpose combine several line segment patternsflipxy swap x and y coordinatesrotate.psp rotate a line segment patternshift.psp shift a line segment patternperiodify make several shifted copiesaffine.psp apply an affine transformationpixellate.psp approximate line segment pattern by pixel imageas.mask.psp approximate line segment pattern by binary maskdistmap.psp compute the distance map of a line segment patterndistfun.psp compute the distance map of a line segment patterndensity.psp kernel smoothing of line segmentsselfcrossing.psp find crossing points between line segmentscrossing.psp find crossing points between two line segment patternsnncross find distance to nearest line segment from a given pointnearestsegment find line segment closest to a given pointproject2segment find location along a line segment closest to a given pointpointsOnLines generate points evenly spaced along line segmentrpoisline generate a realisation of the Poisson line process inside a windowrlinegrid generate a random array of parallel lines through a window

TessellationsAn object of class "tess" represents a tessellation.

tess create a tessellationquadrats create a tessellation of rectangleshextess create a tessellation of hexagonsquantess quantile tessellationas.tess convert other data to a tessellationplot.tess plot a tessellationtiles extract all the tiles of a tessellation[.tess extract some tiles of a tessellation[<-.tess change some tiles of a tessellation

Page 10: Spat Stat Quick Ref

10 spatstat-package

intersect.tess intersect two tessellationsor restrict a tessellation to a window

chop.tess subdivide a tessellation by a linedirichlet compute Dirichlet-Voronoi tessellation of pointsdelaunay compute Delaunay triangulation of pointsrpoislinetess generate tessellation using Poisson line processtile.areas area of each tile in tessellationbdist.tiles boundary distance for each tile in tessellation

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

pp3 create a 3-D point patternplot.pp3 plot a 3-D point patterncoords extract coordinatesas.hyperframe extract coordinatessubset.pp3 extract subset of 3-D point patternunitname.pp3 name of unit of lengthnpoints count the number of pointsrunifpoint3 generate uniform random points in 3-Drpoispp3 generate Poisson random points in 3-Denvelope.pp3 generate simulation envelopes for 3-D patternbox3 create a 3-D rectangular boxas.box3 convert data to 3-D rectangular boxunitname.box3 name of unit of lengthdiameter.box3 diameter of boxvolume.box3 volume of boxshortside.box3 shortest side of boxeroded.volumes volumes of erosions of box

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

ppx create a multidimensional space-time point patterncoords extract coordinatesas.hyperframe extract coordinatessubset.ppx extract subsetunitname.ppx name of unit of lengthnpoints count the number of pointsrunifpointx generate uniform random pointsrpoisppx generate Poisson random pointsboxx define multidimensional boxdiameter.boxx diameter of boxvolume.boxx volume of boxshortside.boxx shortest side of boxeroded.volumes.boxx volumes of erosions of box

Page 11: Spat Stat Quick Ref

spatstat-package 11

Point patterns on a linear networkAn object of class "linnet" represents a linear network (for example, a road network).

linnet create a linear networkclickjoin interactively join vertices in networksimplenet simple example of networklineardisc disc in a linear networkmethods.linnet methods for linnet objects

An object of class "lpp" represents a point pattern on a linear network (for example, road accidentson a road network).

lpp create a point pattern on a linear networkmethods.lpp methods for lpp objectssubset.lpp method for subsetrpoislpp simulate Poisson points on linear networkruniflpp simulate random points on a linear networkchicago Chicago street crime datadendrite Dendritic spines dataspiders Spider webs on mortar lines of brick wall

HyperframesA hyperframe is like a data frame, except that the entries may be objects of any kind.

hyperframe create a hyperframeas.hyperframe convert data to hyperframeplot.hyperframe plot hyperframewith.hyperframe evaluate expression using each row of hyperframecbind.hyperframe combine hyperframes by columnsrbind.hyperframe combine hyperframes by rowsas.data.frame.hyperframe convert hyperframe to data frame

Layered objectsA layered object represents data that should be plotted in successive layers, for example, a back-ground and a foreground.

layered create layered objectplot.layered plot layered object[.layered extract subset of layered object

Colour mapsA colour map is a mechanism for associating colours with data. It can be regarded as a function,mapping data to colours. Using a colourmap object in a plot command ensures that the mappingfrom numbers to colours is the same in different plots.

colourmap create a colour map

Page 12: Spat Stat Quick Ref

12 spatstat-package

plot.colourmap plot the colour map onlytweak.colourmap alter individual colour valuesinterp.colourmap make a smooth transition between coloursbeachcolourmap one special colour map

II. EXPLORATORY DATA ANALYSIS

Inspection of data:

summary(X) print useful summary of point pattern XX print basic description of point pattern Xany(duplicated(X)) check for duplicated points in pattern Xistat(X) Interactive exploratory analysis

Classical exploratory tools:

clarkevans Clark and Evans aggregation indexfryplot Fry plotmiplot Morisita Index plot

Smoothing:

density.ppp kernel smoothed density/intensityrelrisk kernel estimate of relative riskSmooth.ppp spatial interpolation of marksbw.diggle cross-validated bandwidth selection for density.pppbw.ppl likelihood cross-validated bandwidth selection for density.pppbw.scott Scott’s rule of thumb for density estimationbw.relrisk cross-validated bandwidth selection for relriskbw.smoothppp cross-validated bandwidth selection for Smooth.pppbw.frac bandwidth selection using window geometrybw.stoyan Stoyan’s rule of thumb for bandwidth for pcf

Modern exploratory tools:

clusterset Allard-Fraley feature detectionnnclean Byers-Raftery feature detectionsharpen.ppp Choi-Hall data sharpeningrhohat Kernel estimate of covariate effectrho2hat Kernel estimate of covariate effectspatialcdf Spatial cumulative distribution function

Summary statistics for a point pattern: Type demo(sumfun) for a demonstration of many of thesummary statistics.

intensity Mean intensityquadratcount Quadrat countsintensity.quadratcount Mean intensity in quadrats

Page 13: Spat Stat Quick Ref

spatstat-package 13

Fest empty space function FGest nearest neighbour distribution function GJest J-function J = (1−G)/(1− F )Kest Ripley’s K-functionLest Besag L-functionTstat Third order T -functionallstats all four functions F , G, J , Kpcf pair correlation functionKinhom K for inhomogeneous point patternsLinhom L for inhomogeneous point patternspcfinhom pair correlation for inhomogeneous patternsFinhom F for inhomogeneous point patternsGinhom G for inhomogeneous point patternsJinhom J for inhomogeneous point patternslocalL Getis-Franklin neighbourhood density functionlocalK neighbourhood K-functionlocalpcf local pair correlation functionlocalKinhom local K for inhomogeneous point patternslocalLinhom local L for inhomogeneous point patternslocalpcfinhom local pair correlation for inhomogeneous patternsKsector Directional K-functionKscaled locally scaled K-functionKest.fft fast K-function using FFT for large datasetsKmeasure reduced second moment measureenvelope simulation envelopes for a summary functionvarblock variances and confidence intervals

for a summary functionlohboot bootstrap for a summary function

Related facilities:

plot.fv plot a summary functioneval.fv evaluate any expression involving summary functionsharmonise.fv make functions compatibleeval.fasp evaluate any expression involving an array of functionswith.fv evaluate an expression for a summary functionSmooth.fv apply smoothing to a summary functionderiv.fv calculate derivative of a summary functionnndist nearest neighbour distancesnnwhich find nearest neighbourspairdist distances between all pairs of pointscrossdist distances between points in two patternsnncross nearest neighbours between two point patternsexactdt distance from any location to nearest data pointdistmap distance map imagedistfun distance map functionnnmap nearest point imagennfun nearest point functiondensity.ppp kernel smoothed density

Page 14: Spat Stat Quick Ref

14 spatstat-package

Smooth.ppp spatial interpolation of marksrelrisk kernel estimate of relative risksharpen.ppp data sharpeningrknn theoretical distribution of nearest neighbour distance

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

relrisk kernel estimation of relative riskscan.test spatial scan test of elevated riskGcross,Gdot,Gmulti multitype nearest neighbour distributions Gij , Gi•Kcross,Kdot, Kmulti multitype K-functions Kij ,Ki•Lcross,Ldot multitype L-functions Lij , Li•Jcross,Jdot,Jmulti multitype J-functions Jij , Ji•pcfcross multitype pair correlation function gijpcfdot multitype pair correlation function gi•pcfmulti general pair correlation functionmarkconnect marked connection function pijalltypes estimates of the above for all i, j pairsIest multitype I-functionKcross.inhom,Kdot.inhom inhomogeneous counterparts of Kcross, KdotLcross.inhom,Ldot.inhom inhomogeneous counterparts of Lcross, Ldotpcfcross.inhom,pcfdot.inhom inhomogeneous counterparts of pcfcross, pcfdot

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

markmean smoothed local average of marksmarkvar smoothed local variance of marksmarkcorr mark correlation functionmarkvario mark variogramKmark mark-weighted K functionEmark mark independence diagnostic E(r)Vmark mark independence diagnostic V (r)nnmean nearest neighbour mean indexnnvario nearest neighbour mark variance index

For marks of any type, there are the following:

Gmulti multitype nearest neighbour distributionKmulti multitype K-functionJmulti multitype J-function

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

Programming tools:

Page 15: Spat Stat Quick Ref

spatstat-package 15

applynbd apply function to every neighbourhood in a point patternmarkstat apply function to the marks of neighbours in a point patternmarktable tabulate the marks of neighbours in a point patternpppdist find the optimal match between two point patterns

Summary statistics for a point pattern on a linear network:These are for point patterns on a linear network (class lpp). For unmarked patterns:

linearK K function on linear networklinearKinhom inhomogeneous K function on linear networklinearpcf pair correlation function on linear networklinearpcfinhom inhomogeneous pair correlation on linear network

For multitype patterns:

linearKcross K function between two types of pointslinearKdot K function from one type to any typelinearKcross.inhom Inhomogeneous version of linearKcrosslinearKdot.inhom Inhomogeneous version of linearKdotlinearmarkconnect Mark connection function on linear networklinearmarkequal Mark equality function on linear networklinearpcfcross Pair correlation between two types of pointslinearpcfdot Pair correlation from one type to any typelinearpcfcross.inhom Inhomogeneous version of linearpcfcrosslinearpcfdot.inhom Inhomogeneous version of linearpcfdot

Related facilities:

pairdist.lpp distances between pairscrossdist.lpp distances between pairsnndist.lpp nearest neighbour distancesnncross.lpp nearest neighbour distancesnnwhich.lpp find nearest neighboursnnfun.lpp find nearest data pointdistfun.lpp distance transformenvelope.lpp simulation envelopesrpoislpp simulate Poisson points on linear networkruniflpp simulate random points on a linear network

It is also possible to fit point process models to lpp objects. See Section IV.

Summary statistics for a three-dimensional point pattern:These are for 3-dimensional point pattern objects (class pp3).

F3est empty space function FG3est nearest neighbour function GK3est K-functionpcf3est pair correlation function

Page 16: Spat Stat Quick Ref

16 spatstat-package

Related facilities:

envelope.pp3 simulation envelopespairdist.pp3 distances between all pairs of pointscrossdist.pp3 distances between points in two patternsnndist.pp3 nearest neighbour distancesnnwhich.pp3 find nearest neighboursnncross.pp3 find nearest neighbours in another pattern

Computations for multi-dimensional point pattern:These are for multi-dimensional space-time point pattern objects (class ppx).

pairdist.ppx distances between all pairs of pointscrossdist.ppx distances between points in two patternsnndist.ppx nearest neighbour distancesnnwhich.ppx find nearest neighbours

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 HGfox Foxall G-functionJfox Foxall J-function

III. MODEL FITTING (CLUSTER MODELS)

Cluster process models (with homogeneous or inhomogeneous intensity) and Cox processes can befitted by the function kppm. Its result is an object of class "kppm". The fitted model can be printed,plotted, predicted, simulated and updated.

kppm Fit modelplot.kppm Plot the fitted modelfitted.kppm Compute fitted intensitypredict.kppm Compute fitted intensityupdate.kppm Update the modelimprove.kppm Refine the estimate of trendsimulate.kppm Generate simulated realisationsvcov.kppm Variance-covariance matrix of coefficientsKmodel.kppm K function of fitted modelpcfmodel.kppm Pair correlation of fitted model

The theoretical models can also be simulated, for any choice of parameter values, using rThomas,rMatClust, rCauchy, rVarGamma, and rLGCP.

Lower-level fitting functions include:

lgcp.estK fit a log-Gaussian Cox process modellgcp.estpcf fit a log-Gaussian Cox process model

Page 17: Spat Stat Quick Ref

spatstat-package 17

thomas.estK fit the Thomas process modelthomas.estpcf fit the Thomas process modelmatclust.estK fit the Matern Cluster process modelmatclust.estpcf fit the Matern Cluster process modelcauchy.estK fit a Neyman-Scott Cauchy cluster processcauchy.estpcf fit a Neyman-Scott Cauchy cluster processvargamma.estK fit a Neyman-Scott Variance Gamma processvargamma.estpcf fit a Neyman-Scott Variance Gamma processmincontrast low-level algorithm for fitting models

by the method of minimum contrast

IV. MODEL FITTING (POISSON AND GIBBS MODELS)

Types of modelsPoisson point processes are the simplest models for point patterns. A Poisson model assumes thatthe points are stochastically independent. It may allow the points to have a non-uniform spatial den-sity. The special case of a Poisson process with a uniform spatial density is often called CompleteSpatial Randomness.

Poisson point processes are included in the more general class of Gibbs point process models. In aGibbs model, there is interaction or dependence between points. Many different types of interactioncan be specified.

For a detailed explanation of how to fit Poisson or Gibbs point process models to point pattern datausing spatstat, see Baddeley and Turner (2005b) or Baddeley (2008).

To fit a Poison or Gibbs point process model:Model fitting in spatstat is performed mainly by the function ppm. Its result is an object of class"ppm".

Here are some examples, where X is a point pattern (class "ppp"):

command modelppm(X) Complete Spatial Randomnessppm(X ~ 1) Complete Spatial Randomnessppm(X ~ x) Poisson process with

intensity loglinear in x coordinateppm(X ~ 1, Strauss(0.1)) Stationary Strauss processppm(X ~ x, Strauss(0.1)) Strauss process with

conditional intensity loglinear in x

It is also possible to fit models that depend on other covariates.

Manipulating the fitted model:

plot.ppm Plot the fitted modelpredict.ppm Compute the spatial trend and conditional intensity

of the fitted point process modelcoef.ppm Extract the fitted model coefficientsformula.ppm Extract the trend formulaintensity.ppm Compute fitted intensity

Page 18: Spat Stat Quick Ref

18 spatstat-package

Kmodel.ppm K function of fitted modelpcfmodel.ppm pair correlation of fitted modelfitted.ppm Compute fitted conditional intensity at quadrature pointsresiduals.ppm Compute point process residuals at quadrature pointsupdate.ppm Update the fitvcov.ppm Variance-covariance matrix of estimatesrmh.ppm Simulate from fitted modelsimulate.ppm Simulate from fitted modelprint.ppm Print basic information about a fitted modelsummary.ppm Summarise a fitted modeleffectfun Compute the fitted effect of one covariatelogLik.ppm log-likelihood or log-pseudolikelihoodanova.ppm Analysis of deviancemodel.frame.ppm Extract data frame used to fit modelmodel.images Extract spatial data used to fit modelmodel.depends Identify variables in the modelas.interact Interpoint interaction component of modelfitin Extract fitted interpoint interactionis.hybrid Determine whether the model is a hybridvalid.ppm Check the model is a valid point processproject.ppm Ensure the model is a valid point process

For model selection, you can also use the generic functions step, drop1 and AIC on fitted pointprocess models.

See spatstat.options to control plotting of fitted model.

To specify a point process model:The first order “trend” of the model is determined by an R language formula. The formula specifiesthe form of the logarithm of the trend.

X ~ 1 No trend (stationary)X ~ x Loglinear trend λ(x, y) = exp(α+ βx)

where x, y are Cartesian coordinatesX ~ polynom(x,y,3) Log-cubic polynomial trendX ~ harmonic(x,y,2) Log-harmonic polynomial trendX ~ Z Loglinear function of covariate Z

λ(x, y) = exp(α+ βZ(x, y))

The higher order (“interaction”) components are described by an object of class "interact". Suchobjects are created by:

Poisson() the Poisson point processAreaInter() Area-interaction processBadGey() multiscale Geyer processConcom() connected component interactionDiggleGratton() Diggle-Gratton potentialDiggleGatesStibbard() Diggle-Gates-Stibbard potentialFiksel() Fiksel pairwise interaction process

Page 19: Spat Stat Quick Ref

spatstat-package 19

Geyer() Geyer’s saturation processHardcore() Hard core processHybrid() Hybrid of several interactionsLennardJones() Lennard-Jones potentialMultiHard() multitype hard core processMultiStrauss() multitype Strauss processMultiStraussHard() multitype Strauss/hard core processOrdThresh() Ord process, threshold potentialOrd() Ord model, user-supplied potentialPairPiece() pairwise interaction, piecewise constantPairwise() pairwise interaction, user-supplied potentialSatPiece() Saturated pair model, piecewise constant potentialSaturated() Saturated pair model, user-supplied potentialSoftcore() pairwise interaction, soft core potentialStrauss() Strauss processStraussHard() Strauss/hard core point processTriplets() Geyer triplets process

Note that it is also possible to combine several such interactions using Hybrid.

Finer control over model fitting:A quadrature scheme is represented by an object of class "quad". To create a quadrature scheme,typically use quadscheme.

quadscheme default quadrature schemeusing rectangular cells or Dirichlet cells

pixelquad quadrature scheme based on image pixelsquad create an object of class "quad"

To inspect a quadrature scheme:

plot(Q) plot quadrature scheme Qprint(Q) print basic information about quadrature scheme Qsummary(Q) summary of quadrature scheme Q

A quadrature scheme consists of data points, dummy points, and weights. To generate dummypoints:

default.dummy default pattern of dummy pointsgridcentres dummy points in a rectangular gridrstrat stratified random dummy patternspokes radial pattern of dummy pointscorners dummy points at corners of the window

To compute weights:

gridweights quadrature weights by the grid-counting ruledirichlet.weights quadrature weights are Dirichlet tile areas

Page 20: Spat Stat Quick Ref

20 spatstat-package

Simulation and goodness-of-fit for fitted models:

rmh.ppm simulate realisations of a fitted modelsimulate.ppm simulate realisations of a fitted modelenvelope compute simulation envelopes for a fitted model

Point process models on a linear network:An object of class "lpp" represents a pattern of points on a linear network. Point process modelscan also be fitted to these objects. Currently only Poisson models can be fitted.

lppm point process model on linear networkanova.lppm analysis of deviance for

point process model on linear networkenvelope.lppm simulation envelopes for

point process model on linear networkpredict.lppm model prediction on linear networklinim pixel image on linear networkplot.linim plot a pixel image on linear networkeval.linim evaluate expression involving imageslinfun function defined on linear networkmethods.linfun conversion facilities

V. MODEL FITTING (SPATIAL LOGISTIC REGRESSION)

Logistic regressionPixel-based spatial logistic regression is an alternative technique for analysing spatial point patternsthat is widely used in Geographical Information Systems. It is approximately equivalent to fitting aPoisson point process model.

In pixel-based logistic regression, the spatial domain is divided into small pixels, the presenceor absence of a data point in each pixel is recorded, and logistic regression is used to model thepresence/absence indicators as a function of any covariates.

Facilities for performing spatial logistic regression are provided in spatstat for comparison pur-poses.

Fitting a spatial logistic regressionSpatial logistic regression is performed by the function slrm. Its result is an object of class "slrm".There are many methods for this class, including methods for print, fitted, predict, simulate,anova, coef, logLik, terms, update, formula and vcov.

For example, if X is a point pattern (class "ppp"):

command modelslrm(X ~ 1) Complete Spatial Randomnessslrm(X ~ x) Poisson process with

intensity loglinear in x coordinateslrm(X ~ Z) Poisson process with

intensity loglinear in covariate Z

Page 21: Spat Stat Quick Ref

spatstat-package 21

Manipulating a fitted spatial logistic regression

anova.slrm Analysis of deviancecoef.slrm Extract fitted coefficientsvcov.slrm Variance-covariance matrix of fitted coefficientsfitted.slrm Compute fitted probabilities or intensitylogLik.slrm Evaluate loglikelihood of fitted modelplot.slrm Plot fitted probabilities or intensitypredict.slrm Compute predicted probabilities or intensity with new datasimulate.slrm Simulate model

There are many other undocumented methods for this class, including methods for print, update,formula and terms. Stepwise model selection is possible using step or stepAIC.

VI. SIMULATION

There are many ways to generate a random point pattern, line segment pattern, pixel image ortessellation in spatstat.Random point patterns:

runifpoint generate n independent uniform random pointsrpoint generate n independent random pointsrmpoint generate n independent multitype random pointsrpoispp simulate the (in)homogeneous Poisson point processrmpoispp simulate the (in)homogeneous multitype Poisson point processrunifdisc generate n independent uniform random points in discrstrat stratified random sample of pointsrsyst systematic random sample (grid) of pointsrMaternI simulate the Matérn Model I inhibition processrMaternII simulate the Matérn Model II inhibition processrSSI simulate Simple Sequential Inhibition processrStrauss simulate Strauss process (perfect simulation)rNeymanScott simulate a general Neyman-Scott processrMatClust simulate the Matérn Cluster processrThomas simulate the Thomas processrLGCP simulate the log-Gaussian Cox processrGaussPoisson simulate the Gauss-Poisson cluster processrCauchy simulate Neyman-Scott process with Cauchy clustersrVarGamma simulate Neyman-Scott process with Variance Gamma clustersrcell simulate the Baddeley-Silverman cell processrunifpointOnLines generate n random points along specified line segmentsrpoisppOnLines generate Poisson random points along specified line segments

Resampling a point pattern:

quadratresample block resamplingrjitter apply random displacements to points in a patternrshift random shifting of (subsets of) points

Page 22: Spat Stat Quick Ref

22 spatstat-package

rthin random thinning

See also varblock for estimating the variance of a summary statistic by block resampling, andlohboot 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.

Cluster process models are fitted by the function kppm yielding an object of class "kppm". Togenerate one or more simulated realisations of this fitted model, use simulate.kppm.

Gibbs point process models are fitted by the function ppm yielding an object of class "ppm". Togenerate a simulated realisation of this fitted model, use rmh. To generate one or more simulatedrealisations of the fitted model, use simulate.ppm.

Other random patterns:

rlinegrid generate a random array of parallel lines through a windowrpoisline simulate the Poisson line process within a windowrpoislinetess generate random tessellation using Poisson line processrMosaicSet generate random set by selecting some tiles of a tessellationrMosaicField generate random pixel image by assigning random values in each tile of a tessellation

Simulation-based inference

envelope critical envelope for Monte Carlo test of goodness-of-fitqqplot.ppm diagnostic plot for interpoint interactionscan.test spatial scan statistic/test

VII. TESTS AND DIAGNOSTICS

Classical hypothesis tests:

quadrat.test χ2 goodness-of-fit test on quadrat countsclarkevans.test Clark and Evans testcdf.test Spatial distribution goodness-of-fit testberman.test Berman’s goodness-of-fit testsenvelope critical envelope for Monte Carlo test of goodness-of-fitscan.test spatial scan statistic/testdclf.test Diggle-Cressie-Loosmore-Ford testmad.test Mean Absolute Deviation testdclf.progress Progress plot for DCLF testmad.progress Progress plot for MAD testanova.ppm Analysis of Deviance for point process models

Sensitivity diagnostics:Classical measures of model sensitivity such as leverage and influence have been adapted to pointprocess models.

leverage.ppm Leverage for point process model

Page 23: Spat Stat Quick Ref

spatstat-package 23

influence.ppm Influence for point process modeldfbetas.ppm Parameter influence

Diagnostics for covariate effect:Classical diagnostics for covariate effects have been adapted to point process models.

parres Partial residual plotaddvar Added variable plotrhohat Kernel estimate of covariate effectrho2hat Kernel estimate of covariate effect (bivariate)

Residual diagnostics:Residuals for a fitted point process model, and diagnostic plots based on the residuals, were intro-duced in Baddeley et al (2005) and Baddeley, Rubak and Møller (2011).

Type demo(diagnose) for a demonstration of the diagnostics features.

diagnose.ppm diagnostic plots for spatial trendqqplot.ppm diagnostic Q-Q plot for interpoint interactionresidualspaper examples from Baddeley et al (2005)Kcom model compensator of K functionGcom model compensator of G functionKres score residual of K functionGres score residual of G functionpsst pseudoscore residual of summary functionpsstA pseudoscore residual of empty space functionpsstG pseudoscore residual of G functioncompareFit compare compensators of several fitted models

Resampling and randomisation proceduresYou can build your own tests based on randomisation and resampling using the following capabili-ties:

quadratresample block resamplingrjitter apply random displacements to points in a patternrshift random shifting of (subsets of) pointsrthin random thinning

VIII. DOCUMENTATION

The online manual entries are quite detailed and should be consulted first for information about aparticular function.

The paper by Baddeley and Turner (2005a) is a brief overview of the package. Baddeley and Turner(2005b) is a more detailed explanation of how to fit point process models to data. Baddeley (2010)is a complete set of notes from a 2-day workshop on the use of spatstat.Type citation("spatstat") to get these references.

Page 24: Spat Stat Quick Ref

24 spatstat-package

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, Abdollah Jalilian, Marie-Colette van Lieshout, Tuomas Rajala, Do-minic Schuhmacher and Rasmus Waagepetersen made substantial contributions of code.

Additional contributions by Ang Qi Wei, Sandro Azaele, Malissa Baddeley, Colin Beale, MelanieBell, Thomas Bendtsen, Ricardo Bernhardt, Andrew Bevan, Brad Biggerstaff, Leanne Bischof,Roger Bivand, Jose M. Blanco Moreno, Florent Bonneu, Julian Burgos, Simon Byers, Ya-MeiChang, Jianbao Chen, Igor Chernayavsky, Y.C. Chin, Bjarke Christensen, Jean-Francois Coeur-jolly, Robin Corria Ainslie, Marcelino de la Cruz, Peter Dalgaard, Sourav Das, Peter Diggle, PatrickDonnelly, Ian Dryden, Stephen Eglen, Ahmed El-Gabbas, Olivier Flores, David Ford, Peter Forbes,Shane Frank, Janet Franklin, Funwi-Gabga Neba, Oscar Garcia, Agnes Gault, Marc Genton, Shaa-ban Ghalandarayeshi, Julian Gilbey, Jason Goldstick, Pavel Grabarnik, C. Graf, Ute Hahn, AndrewHardegen, Martin Bøgsted Hansen, Martin Hazelton, Juha Heikkinen, Mandy Hering, Markus Her-rmann, Kurt Hornik, Philipp Hunziker, Ross Ihaka, Aruna Jammalamadaka, Robert John-Chandran,Devin Johnson, Mahdieh Khanmohammadi, Peter Kovesi, Mike Kuhn, Jeff Laake, Frederic La-vancier, Tom Lawrence, Robert Lamb, Jonathan Lee, George Leser, Li Haitao, George Limitsios,Andrew Lister, Ben Madin, Kiran Marchikanti, Jeff Marcus, Robert Mark, Peter McCullagh, Mo-nia Mahling, Jorge Mateu Mahiques, Ulf Mehlig, Sebastian Wastl Meyer, Mi Xiangcheng, LoreDe Middeleer, Robin Milne, Enrique Miranda, Jesper Møller, Erika Mudrak, Gopalan Nair, Nico-letta Nava, Linda Stougaard Nielsen, Felipe Nunes, Jens Randel Nyengaard, Jens Oehlschlägel,Thierry Onkelinx, Sean O’Riordan, Evgeni Parilov, Jeff Picka, Nicolas Picard, Mike Porter, SergiyProtsiv, Adrian Raftery, Suman Rakshit, Pablo Ramon, Xavier Raynaud, Matt Reiter, Ian Renner,Tom Richardson, Brian Ripley, Ted Rosenbaum, Barry Rowlingson, Jason Rudokas, John Rudge,Christopher Ryan, Farzaneh Safavimanesh, Aila Särkkä, Katja Schladitz, Sebastian Schutte, BryanScott, Vadim Shcherbakov, Shen Guochun, Ida-Maria Sintorn, Yong Song, Malte Spiess, MarkStevenson, Kaspar Stucki, Michael Sumner, P. Surovy, Ben Taylor, Thordis Linda Thorarinsdottir,Berwin Turlach, Torben Tvedebrink, Kevin Ummer, Medha Uppala, Andrew van Burgel, TobiasVerbeke, Mikko Vihtakari, Alexendre Villers, Fabrice Vinatier, Sasha Voss, Hao Wang, H. Wen-drock, Jan Wild, Carl G. Witthoft, Selene Wong, Maxime Woringer, Mike Zamboni and AchimZeileis.

Author(s)

Adrian Baddeley <[email protected]> http://www.maths.uwa.edu.au/~adrian/,Rolf Turner <[email protected]> and Ege Rubak <[email protected]>.

References

Baddeley, A. (2010) Analysing spatial point patterns in R. Workshop notes. Version 4.1. CSIROonline technical publication. URL: www.uwa.edu.au/resources/pf16h.html

Baddeley, A. and Turner, R. (2005a) Spatstat: an R package for analyzing spatial point patterns.Journal of Statistical Software 12:6, 1–42. URL: www.jstatsoft.org, ISSN: 1548-7660.

Baddeley, A. and Turner, R. (2005b) Modelling spatial point patterns in R. In: A. Baddeley, P. Gre-gori, J. Mateu, R. Stoica, and D. Stoyan, editors, Case Studies in Spatial Point Pattern Modelling,

Page 25: Spat Stat Quick Ref

spatstat-package 25

Lecture Notes in Statistics number 185. Pages 23–74. Springer-Verlag, New York, 2006. ISBN:0-387-28311-0.

Baddeley, A., Turner, R., Møller, J. and Hazelton, M. (2005) Residual analysis for spatial pointprocesses. Journal of the Royal Statistical Society, Series B 67, 617–666.

Baddeley, A., Rubak, E. and Møller, J. (2011) Score, pseudo-score and residual diagnostics forspatial point process models. Statistical Science 26, 613–646.

Baddeley, A., Turner, R., Mateu, J. and Bevan, A. (2013) Hybrids of Gibbs point process modelsand their implementation. Journal of Statistical Software 55:11, 1–43. http://www.jstatsoft.org/v55/i11/

Diggle, P.J. (2003) Statistical analysis of spatial point patterns, Second edition. Arnold.

Gelfand, A.E., Diggle, P.J., Fuentes, M. and Guttorp, P., editors (2010) Handbook of Spatial Statis-tics. CRC Press.

Huang, F. and Ogata, Y. (1999) Improvements of the maximum pseudo-likelihood estimators invarious spatial statistical models. Journal of Computational and Graphical Statistics 8, 510–530.

Waagepetersen, R. An estimating function approach to inference for inhomogeneous Neyman-Scottprocesses. Biometrics 63 (2007) 252–258.

Page 26: Spat Stat Quick Ref

Index

∗Topic packagespatstat-package, 1

∗Topic spatialspatstat-package, 1

[.im, 8[.layered, 11[.ppp, 5[.psp, 9[.tess, 9[<-.im, 8[<-.tess, 9

addvar, 23affine, 5, 7affine.im, 8affine.psp, 9AIC, 18allstats, 13alltypes, 14amacrine, 4anemones, 4angles.psp, 9anova.lppm, 20anova.ppm, 18, 22anova.slrm, 21ants, 4applynbd, 15area.owin, 7AreaInter, 18as.box3, 10as.data.frame.hyperframe, 11as.data.frame.im, 8as.data.frame.psp, 9as.function.im, 8as.hyperframe, 10, 11as.im, 8as.im.owin, 7as.im.ppp, 6as.interact, 18as.mask, 7

as.mask.psp, 9as.matrix.im, 8as.owin, 6as.polygonal, 7as.ppp, 3as.psp, 9as.tess, 9

BadGey, 18bdist.pixels, 7bdist.points, 7bdist.tiles, 7, 10bdspots, 4beachcolourmap, 12bei, 4berman.test, 22betacells, 4blur, 8border, 6boundingbox, 6box3, 10boxx, 10bramblecanes, 4bronzefilter, 4bw.diggle, 12bw.frac, 12bw.ppl, 12bw.relrisk, 12bw.scott, 12bw.smoothppp, 12bw.stoyan, 12by.ppp, 5

cauchy.estK, 17cauchy.estpcf, 17cbind.hyperframe, 11cdf.test, 22cells, 4centroid.owin, 7chicago, 4, 11

26

Page 27: Spat Stat Quick Ref

INDEX 27

chop.tess, 10chorley, 4clarkevans, 12clarkevans.test, 22clickbox, 6clickjoin, 11clickpoly, 6clickppp, 3clmfires, 4closing, 6clusterset, 12coef.ppm, 17coef.slrm, 21colourmap, 11commonGrid, 7, 8compareFit, 23compatible.im, 8complement.owin, 6Concom, 18connected.im, 8connected.owin, 7connected.ppp, 6contour.im, 8convexhull, 6, 7convolve.im, 8coords, 5, 10copper, 4corners, 19crossdist, 13crossdist.lpp, 15crossdist.pp3, 16crossdist.ppx, 16crossing.psp, 9cut.im, 8cut.ppp, 5, 14

data, 4dclf.progress, 22dclf.test, 22default.dummy, 19delaunay, 6, 10delaunay.distance, 6demohyper, 4demopat, 4dendrite, 4, 11density.ppp, 6, 8, 12, 13density.psp, 9deriv.fv, 13dfbetas.ppm, 23

diagnose.ppm, 23diameter.box3, 10diameter.boxx, 10diameter.owin, 7DiggleGatesStibbard, 18DiggleGratton, 18dilated.areas, 7dilation, 6dirichlet, 6, 10dirichlet.weights, 19disc, 6discretise, 6distfun, 13distfun.lpp, 15distfun.owin, 7distfun.psp, 9distmap, 13distmap.owin, 7distmap.psp, 9drop1, 18duplicated.ppp, 6

edges, 7, 9effectfun, 18Emark, 14endpoints.psp, 9envelope, 13, 20, 22envelope.lpp, 15envelope.lppm, 20envelope.pp3, 10, 16eroded.areas, 7eroded.volumes, 10eroded.volumes.boxx, 10erosion, 6eval.fasp, 13eval.fv, 13eval.im, 8eval.linim, 20exactdt, 13

F3est, 15Fest, 13Fiksel, 18Finhom, 13finpines, 4fitin, 18fitted.kppm, 16fitted.ppm, 18fitted.slrm, 21

Page 28: Spat Stat Quick Ref

28 INDEX

flipxy, 5, 7, 9flu, 4formula.ppm, 17Frame, 6fryplot, 12

G3est, 15Gcom, 23Gcross, 14Gdot, 14Gest, 13Geyer, 19Gfox, 16Ginhom, 13glm, 2Gmulti, 14gordon, 4gorillas, 5Gres, 23gridcentres, 19gridweights, 19

hamster, 5Hardcore, 19harmonise.fv, 13harmonise.im, 8Hest, 16hextess, 9hist.im, 8hsvim, 8humberside, 5Hybrid, 19hyperframe, 11hyytiala, 5

identify.ppp, 6Iest, 14im, 3, 8imcov, 8improve.kppm, 16incircle, 7influence.ppm, 23inside.owin, 7integral.im, 8intensity, 12intensity.ppm, 17intensity.quadratcount, 12interp.colourmap, 12interp.im, 8

intersect.owin, 7intersect.tess, 10iplot, 5is.convex, 7is.hybrid, 18is.im, 8is.mask, 7is.polygonal, 7is.psp, 9is.rectangle, 7is.subset.owin, 7istat, 12

japanesepines, 5Jcross, 14Jdot, 14Jest, 13Jfox, 16Jinhom, 13Jmulti, 14

K3est, 15Kcom, 23Kcross, 14Kcross.inhom, 14Kdot, 14Kdot.inhom, 14Kest, 13Kest.fft, 13Kinhom, 13Kmark, 14Kmeasure, 8, 13Kmodel.kppm, 16Kmodel.ppm, 18Kmulti, 14kppm, 16, 22Kres, 23Kscaled, 13Ksector, 13

lansing, 5layered, 11Lcross, 14Lcross.inhom, 14Ldot, 14Ldot.inhom, 14lengths.psp, 9LennardJones, 19Lest, 13

Page 29: Spat Stat Quick Ref

INDEX 29

letterR, 6levelset, 8leverage.ppm, 22lgcp.estK, 16lgcp.estpcf, 16lineardisc, 11linearK, 15linearKcross, 15linearKcross.inhom, 15linearKdot, 15linearKdot.inhom, 15linearKinhom, 15linearmarkconnect, 15linearmarkequal, 15linearpcf, 15linearpcfcross, 15linearpcfcross.inhom, 15linearpcfdot, 15linearpcfdot.inhom, 15linearpcfinhom, 15linfun, 20Linhom, 13linim, 20linnet, 11lm, 2localK, 13localKinhom, 13localL, 13localLinhom, 13localpcf, 13localpcfinhom, 13logLik.ppm, 18logLik.slrm, 21lohboot, 13, 22longleaf, 5lpp, 3, 11lppm, 20

mad.progress, 22mad.test, 22markconnect, 14markcorr, 14markmean, 14marks, 5marks.psp, 9marks<-, 3marks<-.psp, 9markstat, 15marktable, 15

markvar, 14markvario, 14matclust.estK, 17matclust.estpcf, 17mean.im, 8methods.linfun, 20methods.linnet, 11methods.lpp, 11midpoints.psp, 9mincontrast, 17miplot, 12model.depends, 18model.frame.ppm, 18model.images, 18mucosa, 5MultiHard, 19MultiStrauss, 19MultiStraussHard, 19murchison, 5

nbfires, 5nearest.raster.point, 7nearestsegment, 9nnclean, 12nncross, 9, 13nncross.lpp, 15nncross.pp3, 16nndist, 13nndist.lpp, 15nndist.pp3, 16nndist.ppx, 16nnfun, 13nnfun.lpp, 15nnmap, 13nnmark, 6nnmean, 14nnvario, 14nnwhich, 13nnwhich.lpp, 15nnwhich.pp3, 16nnwhich.ppx, 16npoints, 5, 10nztrees, 5

opening, 6Ord, 19OrdThresh, 19osteo, 5owin, 3, 6

Page 30: Spat Stat Quick Ref

30 INDEX

pairdist, 13pairdist.lpp, 15pairdist.pp3, 16pairdist.ppx, 16PairPiece, 19Pairwise, 19paracou, 5parres, 23pcf, 12, 13pcf3est, 15pcfcross, 14pcfcross.inhom, 14pcfdot, 14pcfdot.inhom, 14pcfinhom, 13pcfmodel.kppm, 16pcfmodel.ppm, 18pcfmulti, 14perimeter, 7periodify, 5, 7, 9persp.im, 8pixelcentres, 8pixellate, 8pixellate.owin, 7pixellate.ppp, 6pixellate.psp, 9pixelquad, 19plot.colourmap, 12plot.fv, 13plot.hyperframe, 11plot.im, 8plot.kppm, 16plot.layered, 11plot.linim, 20plot.owin, 6plot.pp3, 10plot.ppm, 17plot.ppp, 5plot.psp, 9plot.slrm, 21plot.tess, 9pointsOnLines, 9Poisson, 18ponderosa, 5pp3, 3, 10ppm, 17, 22ppp, 3pppdist, 15

ppx, 3, 10predict.kppm, 16predict.lppm, 20predict.ppm, 17predict.slrm, 21print.ppm, 18print.psp, 9project.ppm, 18project2segment, 9psp, 3, 9psst, 23psstA, 23psstG, 23pyramidal, 5

qqplot.ppm, 22, 23quad, 19quadrat.test, 22quadratcount, 12quadratresample, 4, 21, 23quadrats, 9quadscheme, 19quantess, 9quantile.im, 8

raster.x, 7raster.y, 7rbind.hyperframe, 11rCauchy, 4, 16, 21rcell, 4, 21rDGS, 3rDiggleGratton, 3redwood, 5redwoodfull, 5reflect, 5relrisk, 12, 14residuals.ppm, 18residualspaper, 5, 23rGaussPoisson, 4, 21rgbim, 8rHardcore, 3rho2hat, 12, 23rhohat, 12, 23ripras, 6rjitter, 3, 4, 21, 23rknn, 14rlabel, 4rLGCP, 16, 21rlinegrid, 9, 22

Page 31: Spat Stat Quick Ref

INDEX 31

rMatClust, 4, 16, 21rMaternI, 3, 21rMaternII, 3, 21rmh, 4, 22rmh.ppm, 18, 20rMosaicField, 22rMosaicSet, 22rmpoint, 3, 21rmpoispp, 3, 21rNeymanScott, 3, 21rotate, 5, 7rotate.im, 8rotate.psp, 9rpoint, 3, 21rpoisline, 9, 22rpoislinetess, 10, 22rpoislpp, 11, 15rpoispp, 3, 21rpoispp3, 10rpoisppOnLines, 4, 21rpoisppx, 10rPoissonCluster, 4rshift, 4, 21, 23rSSI, 3, 21rstrat, 3, 19, 21rStrauss, 3, 21rsyst, 3, 21rthin, 4, 22, 23rThomas, 4, 16, 21runifdisc, 3, 21runiflpp, 11, 15runifpoint, 3, 21runifpoint3, 10runifpointOnLines, 4, 21runifpointx, 10rVarGamma, 4, 16, 21

SatPiece, 19Saturated, 19scalardilate, 6scaletointerval, 8scan.test, 14, 22selfcrossing.psp, 9setcov, 7, 8setminus.owin, 7shapley, 5sharpen.ppp, 6, 12, 14shift, 5, 7shift.im, 8

shift.psp, 9shortside.box3, 10shortside.boxx, 10simdat, 5simplenet, 11simplify.owin, 7simulate.kppm, 16, 22simulate.ppm, 4, 18, 20, 22simulate.slrm, 21slrm, 20Smooth.fv, 13Smooth.im, 8Smooth.ppp, 6, 12, 14Softcore, 19solutionset, 8spatialcdf, 12spatstat (spatstat-package), 1spatstat-package, 1spatstat.options, 6, 7, 18spiders, 5, 11split.ppp, 5spokes, 19sporophores, 5spruces, 5square, 6step, 18Strauss, 19StraussHard, 19subset.lpp, 11subset.pp3, 10subset.ppp, 5subset.ppx, 10summary, 8, 12, 19summary.ppm, 18summary.psp, 9superimpose, 5, 9swedishpines, 5

tess, 3, 9thomas.estK, 17thomas.estpcf, 17tile.areas, 10tiles, 9transect.im, 8Triplets, 19Tstat, 13tweak.colourmap, 12

union.owin, 7

Page 32: Spat Stat Quick Ref

32 INDEX

unique.ppp, 6unitname.box3, 10unitname.pp3, 10unitname.ppx, 10unmark, 5unmark.psp, 9update.kppm, 16update.ppm, 18urkiola, 5

valid.ppm, 18varblock, 13, 22vargamma.estK, 17vargamma.estpcf, 17vcov.kppm, 16vcov.ppm, 18vcov.slrm, 21Vmark, 14volume.box3, 10volume.boxx, 10

waka, 5waterstriders, 5Window, 6with.fv, 13with.hyperframe, 11

zapsmall.im, 8