Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

⚠️There's a newer version (3.3-1) of this package.Take me there.

spatstat (version 1.14-7)

Spatial Point Pattern analysis, model-fitting, simulation, tests

Description

A package for analysing spatial data, mainly Spatial Point Patterns, including multitype/marked points and spatial covariates, in any two-dimensional spatial region. Contains functions for plotting spatial data, exploratory data analysis, model-fitting, simulation, spatial sampling, model diagnostics, and formal inference. Data types include point patterns, line segment patterns, spatial windows, and pixel images. Point process models can be fitted to point pattern data. Cluster type models are fitted by the method of minimum contrast. Very general Gibbs point process models can be fitted to point pattern data using a function ppm similar to lm or glm. Models may include dependence on covariates, interpoint interaction and dependence on marks. Fitted models can be simulated automatically. Also provides facilities for formal inference (such as chi-squared tests) and model diagnostics (including simulation envelopes, residuals, residual plots and Q-Q plots).

Copy Link

Version

Install

install.packages('spatstat')

Monthly Downloads

17,668

Version

1.14-7

License

GPL (>= 2)

Maintainer

Adrian Baddeley

Last Published

March 22nd, 2025

Functions in spatstat (1.14-7)

unmark

Remove Marks
DiggleGratton

Diggle-Gratton model
Jmulti

Marked J Function
subset.psp

Extract Subset of Line Segment Pattern
AreaInter

The Area Interaction Point Process Model
MultiStrauss

The Multitype Strauss Point Process Model
suffstat

Sufficient Statistic of Point Process Model
summary.listof

Summary of a List of Things
summary.ppm

Summarizing a Fitted Point Process Model
Kest.fft

K-function using FFT
as.owin

Convert Data To Class owin
summary.ppp

Summary of a Point Pattern Dataset
unique.ppp

Extract Unique Points from a Spatial Point Pattern
summary.quad

Summarizing a Quadrature Scheme
tiles

Extract List of Tiles in a Tessellation
diameter

Diameter of a Window
effectfun

Compute Fitted Effect of a Spatial Covariate in a Point Process Model
as.data.frame.ppp

Coerce Point Pattern to a Data Frame
with.fv

Evaluate an Expression in a Function Table
summary.splitppp

Summary of a Split Point Pattern
superimposePSP

Superimpose Several Line Segment Patterns
summary.psp

Summary of a Line Segment Pattern Dataset
superimpose

Superimpose Several Point Patterns
[.tess

Extract or Replace Subset of Tessellation
update.kppm

Update a Fitted Cluster Point Process Model
trim.rectangle

Cut margins from rectangle
inforder.family

Infinite Order Interaction Family
tess

Create a Tessellation
StraussHard

The Strauss / Hard Core Point Process Model
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
markcorr

Mark Correlation Function
summary.owin

Summary of a Spatial Window
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
union.quad

Union of Data and Dummy Points
rstrat

Simulate Stratified Random Point Pattern
persp.im

Perspective Plot of Pixel Image
summary.im

Summarizing a Pixel Image
rmh.default

Simulate Point Process Models using the Metropolis-Hastings Algorithm.
rotate

Rotate
update.ppm

Update a Fitted Point Process Model
kstest.ppm

Kolmogorov-Smirnov Test for Point Process Model
urkiola

Urkiola Woods Point Pattern
eroded.areas

Areas of Morphological Erosions
as.rectangle

Window Frame
finpines

Pine saplings in Finland.
endpoints.psp

Endpoints of Line Segment Pattern
Kdot.inhom

Inhomogeneous Multitype K Dot Function
Gmulti

Marked Nearest Neighbour Distance Function
Jcross

Multitype J Function (i-to-j)
LennardJones

The Lennard-Jones Potential
bdist.pixels

Distance to Boundary of Window
subsetget.im

Reset Values in Subset of Image
disc

Circular Window
project2segment

Move Point To Nearest Line
spatstat-deprecated

Deprecated spatstat functions
quadratcount

Quadrat counting for a point pattern
Linhom

L-function
Softcore

The Soft Core Point Process Model
simulate.kppm

Simulate a fitted cluster point process model.
Gcross

Multitype Nearest Neighbour Distance Function (i-to-j)
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
Kinhom

Inhomogeneous K-function
as.mask

Pixel Image Approximation of a Window
bramblecanes

Hutchings' Bramble Canes data
mean.im

Mean, Median and Range of Pixel Values in an Image
nearest.raster.point

Find Pixel Nearest to a Given Point
Jdot

Multitype J Function (i-to-any)
fv.object

Data Frames of Function Values
hyperframe

Hyper Data Frame
eval.im

Evaluate Expression Involving Pixel Images
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
BadGey

Hybrid Geyer Point Process Model
clickpoly

Interactively Define a Polygon
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
nncross

Nearest Neighbour in Another Point Pattern
rjitter

Random Perturbation of a Point Pattern
Lcross

Multitype L-function (cross-type)
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
corners

Corners of a rectangle
ponderosa

Ponderosa Pine Tree Point Pattern
Pairwise

Generic Pairwise Interaction model
as.psp

Convert Data To Class psp
Iest

Estimate the I-function
adaptive.density

Intensity Estimate of Point Pattern Using Tessellation
as.im

Convert to Pixel Image
compatible.fv

Test Whether Two Function Objects Are Compatible
affine.ppp

Apply Affine Transformation To Point Pattern
Lest

L-function
nearestsegment

Find Line Segment Nearest to Each Point
bdist.points

Distance to Boundary of Window
Kmulti

Marked K-Function
quad.object

Class of Quadrature Schemes
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
amacrine

Hughes' Amacrine Cell Data
Strauss

The Strauss Point Process Model
as.tess

Convert Data To Tessellation
ants

Harkness-Isham ants' nests data
pairdist.ppp

Pairwise distances
ord.family

Ord Interaction Process Family
quantile.im

Sample Quantiles of Pixel Image
distmap.psp

Distance Map of Line Segment Pattern
intersect.tess

Intersection of Two Tessellations
pppdist

Distance Between Two Point Patterns
identify.ppp

Identify Points in a Point Pattern
japanesepines

Japanese Pines Point Pattern
pairdist.psp

Pairwise distances between line segments
lgcp.estK

Fit a Log-Gaussian Cox Point Process by Minimum Contrast
density.psp

Kernel Smoothing of Line Segment Pattern
plot.tess

Plot a tessellation
rpoispp

Generate Poisson Point Pattern
psp.object

Class of Line Segment Patterns
plot.fv

Plot Function Valuesn
crossing.psp

Crossing Points of Two Line Segment Patterns
pcf.fv

Pair Correlation Function obtained from K Function
gpc2owin

Convert Polygonal Region into Different Format
convexhull.xy

Convex Hull of Points
profilepl

Profile Maximum Pseudolikelihood
pcf.ppp

Pair Correlation Function of Point Pattern
ppp.object

Class of Point Patterns
im.object

Class of Images
anova.ppm

ANOVA for Fitted Point Process Models
demopat

Artificial Data Point Pattern
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
affine.owin

Apply Affine Transformation To Window
psp

Create a Line Segment Pattern
envelope

Simulation envelopes of summary function
erode.owin

Erode a Window
centroid.owin

Centroid of a window
density.ppp

Kernel Smoothed Intensity of Point Pattern
compatible.im

Test Whether Two Pixel Images Are Compatible
is.marked.ppp

Test Whether A Point Pattern is Marked
OrdThresh

Ord's Interaction model
eval.hyper

Evaluate an Expression in Each Row of a Hyperframe
crossdist.ppp

Pairwise distances between two different point patterns
quadrat.test

Chi-Squared Dispersion Test for Spatial Point Pattern Based on Quadrat Counts
Kmeasure

Reduced Second Moment Measure
subset.splitppp

Extract or Replace Sub-Patterns
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
solutionset

Evaluate Logical Expression Involving Pixel Images and Return Region Where Expression is True
as.ppp

Convert Data To Class ppp
is.subset.owin

Determine Whether One Window is Contained In Another
murchison

Murchison gold deposits
rNeymanScott

Simulate Neyman-Scott Process
rmhmodel.default

Build Point Process Model for Metropolis-Hastings Simulation.
print.psp

Print Brief Details of a Line Segment Pattern Dataset
shift.im

Apply Vector Translation To Pixel Image
runifpoint

Generate N Uniform Random Points
eval.fv

Evaluate Expression Involving Functions
opening.owin

Morphological Opening of a Window
intersect.owin

Intersection or Union of Two Windows
shift.owin

Apply Vector Translation To Window
crossdist

Pairwise distances
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
kppm

Fit cluster point process model
cut.ppp

Classify Points in a Point Pattern
Ord

Generic Ord Interaction model
bei

Tropical rain forest trees
bounding.box

Bounding Box of a Window or Point Pattern
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
is.ppp

Test Whether An Object Is A Point Pattern
areadiff

Difference of Disc Areas
affine.psp

Apply Affine Transformation To Line Segment Pattern
delaunay

Delaunay Triangulation of Point Pattern
subset.fv

Extract Subset of Function Values
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
as.data.frame.psp

Coerce Line Segment Pattern to a Data Frame
pcf.fasp

Pair Correlation Function obtained from array of K functions
raster.x

Cartesian Coordinates for a Pixel Raster
plot.psp

plot a Spatial Line Segment Pattern
cut.im

Convert Pixel Image from Numeric to Factor
betacells

Beta Ganglion Cells in Cat Retina
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
spruces

Spruces Point Pattern
lansing

Lansing Woods Point Pattern
quadrats

Divide Region into Quadrats
interp.im

Interpolate a Pixel Image
pcfcross

Multitype pair correlation function
chorley

Chorley-Ribble Cancer Data
ppm

Fit Point Process Model to Data
swedishpines

Swedish Pines Point Pattern
selfcrossing.psp

Crossing Points in a Line Segment Pattern
matchingdist

Distance for a Point Pattern Matching
affine

Apply Affine Transformation
bounding.box.xy

Convex Hull of Points
rStrauss

Perfect Simulation of the Strauss Process
unitname

Name for Unit of Length
subset.im

Extract Subset of Image
Gest

Nearest Neighbour Distance Function G
clickppp

Interactively Add Points
pairdist

Pairwise distances
rescale

Convert dataset to another unit of length
copper

Berman-Huntington points and lines data
subset.listof

Extract or Replace Subset of a List of Things
discretise

Safely Convert Point Pattern Window to Binary Mask
lurking

Lurking variable plot
rotate.ppp

Rotate a Point Pattern
square

Square Window
reduced.sample

Reduced Sample Estimator using Histogram Data
shift.psp

Apply Vector Translation To Line Segment Pattern
spatstat-internal

Internal spatstat functions
nztrees

New Zealand Trees Point Pattern
quadratresample

Resample a Point Pattern by Resampling Quadrats
ppm.object

Class of Fitted Point Process Models
allstats

Calculate four standard summary functions of a point pattern.
[.quad

Subset of Quadrature Scheme
rmpoint

Generate N Random Multitype Points
rshift

Random Shift
nbfires

Point Patterns of New Brunswick Forest Fires
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
concatxy

Concatenate x,y Coordinate Vectors
angles.psp

Orientation Angles of Line Segments
rmpoispp

Generate Multitype Poisson Point Pattern
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
compatible.fasp

Test Whether Two Function Arrays Are Compatible
plot.plotppm

Plot a plotppm Object Created by plot.ppm
setcov

Set Covariance of a Window
spatstat.options

Internal Options in Spatstat Package
mincontrast

Method of Minimum Contrast
append.psp

Combine Two Line Segment Patterns
pairsat.family

Saturated Pairwise Interaction Point Process Family
rpoint

Generate N Random Points
spatstat

The Spatstat Package
plot.quad

plot a Spatial Quadrature Scheme
coef.ppm

Coefficients of Fitted Point Process Model
quadscheme

Generate a Quadrature Scheme from a Point Pattern
marktable

Tabulate Marks in Neighbourhood of Every Point in a Point Pattern
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
Kdot

Multitype K Function (i-to-any)
Kest

K-function
SatPiece

Piecewise Constant Saturated Pairwise Interaction Point Process Model
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
rshift.splitppp

Randomly Shift a List of Point Patterns
rmhmodel.list

Define Point Process Model for Metropolis-Hastings Simulation.
rcell

Simulate Baddeley-Silverman Cell Process
Jest

Estimate the J-function
as.matrix.im

Convert Pixel Image to Matrix
Kcross.inhom

Inhomogeneous Cross K Function
localK

Neighbourhood density function
is.owin

Test Whether An Object Is A Window
expand.owin

Expand Window By Factor
plot.ppm

plot a Fitted Point Process Model
longleaf

Longleaf Pines Point Pattern
plot.kppm

Plot a fitted cluster point process
split.im

Divide Image Into Sub-images
cells

Biological Cells Point Pattern
print.im

Print Brief Details of an Image
print.ppp

Print Brief Details of a Point Pattern Dataset
data.ppm

Extract Original Data from a Fitted Point Process Model
closing.owin

Morphological Closing of a Window
setmarks

Set or Reset the Marks in a Point Pattern
distmap.owin

Distance Map of Window
model.images

Compute Images of Constructed Covariates
Ldot

Multitype L-function (i-to-any)
is.marked

Test Whether Marks Are Present
by.ppp

Apply a Function to a Point Pattern Broken Down by Factor
Gdot

Multitype Nearest Neighbour Distance Function (i-to-any)
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
Poisson

Poisson Point Process Model
predict.kppm

Prediction from a Fitted Cluster Point Process Model
crossdist.default

Pairwise distances between two different sets of points
rotate.owin

Rotate a Window
eval.fasp

Evaluate Expression Involving Function Arrays
crossdist.psp

Pairwise distances between two different line segment patterns
by.im

Apply Function to Image Broken Down by Factor
plot.im

Plot a Pixel Image
contour.im

Contour plot of pixel image
blur

Apply Gaussian Blur to a Pixel Image
eem

Exponential Energy Marks
inside.owin

Test Whether Points Are Inside A Window
is.im

Test Whether An Object Is A Pixel Image
logLik.ppm

Log Likelihood for Poisson Point Process Model
plot.ppp

plot a Spatial Point Pattern
rlinegrid

Generate grid of parallel lines with random displacement
rMaternII

Simulate Matern Model II
rpoisline

Generate Poisson Random Line Process
hist.im

Histogram of Pixel Values in an Image
predict.ppm

Prediction from a Fitted Point Process Model
area.owin

Area of a Window
default.dummy

Generate a Default Pattern of Dummy Points
is.ppm

Test Whether An Object Is A Fitted Point Process Model
pcf

Pair Correlation Function
pairwise.family

Pairwise Interaction Process Family
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
nndist

Nearest neighbour distances
Saturated

Saturated Pairwise Interaction model
ppp

Create a Point Pattern
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
lengths.psp

Lengths of Line Segments
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
print.ppm

Print a Fitted Point Process Model
rMatClust

Simulate Matern Cluster Process
is.multitype.ppp

Test Whether A Point Pattern is Multitype
letterR

Window in Shape of Letter R
rescale.owin

Convert Window to Another Unit of Length
dirichlet

Dirichlet Tessellation of Point Pattern
rlabel

Random Re-Labelling of Point Pattern
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
harmonic

Basis for Harmonic Functions
fitted.ppm

Fitted Conditional Intensity for Point Process Model
rGaussPoisson

Simulate Gauss-Poisson Process
midpoints.psp

Midpoints of Line Segment Pattern
shift.ppp

Apply Vector Translation To Point Pattern
plot.fasp

Plot a Function Array
scanpp

Read Point Pattern From Data File
shift

Apply Vector Translation
subset.ppp

Extract or Replace Subset of Point Pattern
rThomas

Simulate Thomas Process
distmap

Distance Map
ewcdf

Weighted Empirical Cumulative Distribution Function
rmh.ppm

Simulate from a Fitted Point Process Model
nndist.psp

Nearest neighbour distances between line segments
print.quad

Print a Quadrature Scheme
pppmatching.object

Class of Point Matchings
rescale.ppp

Convert Point Pattern to Another Unit of Length
plot.listof

Plot a List of Things
rSSI

Simulate Simple Sequential Inhibition
rMaternI

Simulate Matern Model I
rescale.im

Convert Pixel Image to Another Unit of Length
plot.hyperframe

Plot Entries in a Hyperframe
pppmatching

Create a Point Matching
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
print.owin

Print Brief Details of a Spatial Window
rsyst

Simulate systematic random point pattern
residuals.ppm

Residuals for Fitted Point Process Model
split.ppp

Divide Point Pattern into Sub-patterns
stieltjes

Compute Integral of Function Against Cumulative Distribution
gridcentres

Rectangular grid of points
spokes

Spokes pattern of dummy points
Fest

Estimate the empty space function F
simdat

Simulated Point Pattern
rthin

Random Thinning
Geyer

Geyer's Saturation Point Process Model
rescue.rectangle

Convert Window Back To Rectangle
rmhmodel.ppm

Interpret Fitted Model for Metropolis-Hastings Simulation.
anemones

Beadlet Anemones Data
levelset

Level Set of a Pixel Image
Kcross

Multitype K Function (Cross-type)
alltypes

Calculate Summary Statistic for All Types in a Multitype Point Pattern
pairdist.default

Pairwise distances
subset.fasp

Extract Subset of Function Array
incircle

Find Largest Circle Inside Window
owin.object

Class owin
complement.owin

Take Complement of a Window
hamster

Aherne's hamster tumour data
nnwhich

Nearest neighbour
pixelquad

Quadrature Scheme Based on Pixel Grid
clarkevans

Clark and Evans Aggregation Index
is.multitype.ppm

Test Whether A Point Process Model is Multitype
dilate.owin

Dilate a Window
is.multitype

Test whether Object is Multitype
distmap.ppp

Distance Map of Point Pattern
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
im

Create a Pixel Image Object
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
reach

Interaction Distance of a Point Process
fasp.object

Function Arrays for Spatial Patterns
is.marked.ppm

Test Whether A Point Process Model is Marked
plot.splitppp

Plot a List of Point Patterns
owin

Create a Window
rshift.psp

Randomly Shift a Line Segment Pattern
plot.owin

Plot a Spatial Window
runifdisc

Generate N Uniform Random Points in a Disc
model.matrix.ppm

Extract Design Matrix from Point Process Model
multiplicity.ppp

Count Multiplicity of Duplicate Points
rshift.ppp

Randomly Shift a Point Pattern
rotate.psp

Rotate a Line Segment Pattern
qqplot.ppm

Q-Q Plot of Residuals from Fitted Point Process Model
ripras

Estimate window from points alone
progressreport

Print Progress Reports
fitin.ppm

Extract the Interaction from a Fitted Point Process Model
gridweights

Compute Quadrature Weights Based on Grid Counts
redwood

California Redwoods Point Pattern (Ripley's Subset)
smooth.ppp

Spatial smoothing of observations at irregular points
vertices

Vertices of a Window