Learn R Programming

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

spatstat (version 1.13-3)

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

16,590

Version

1.13-3

License

GPL (>= 2)

Maintainer

Adrian Baddeley

Last Published

March 22nd, 2025

Functions in spatstat (1.13-3)

rSSI

Simulate Simple Sequential Inhibition
owin.object

Class owin
print.ppm

Print a Fitted Point Process Model
pcf

Pair Correlation Function
print.im

Print Brief Details of an Image
qqplot.ppm

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

Simulate Gauss-Poisson Process
rlinegrid

Generate grid of parallel lines with random displacement
rescue.rectangle

Convert Window Back To Rectangle
rpoisline

Generate Poisson Random Line Process
plot.owin

Plot a Spatial Window
pairwise.family

Pairwise Interaction Process Family
plot.quad

plot a Spatial Quadrature Scheme
rStrauss

Perfect Simulation of the Strauss Process
plot.fasp

Plot a Function Array
rshift.splitppp

Randomly Shift a List of Point Patterns
rcell

Simulate Baddeley-Silverman Cell Process
plot.hyperframe

Plot Entries in a Hyperframe
pcf.fv

Pair Correlation Function obtained from K Function
print.psp

Print Brief Details of a Line Segment Pattern Dataset
plot.psp

plot a Spatial Line Segment Pattern
rMaternII

Simulate Matern Model II
owin

Create a Window
print.owin

Print Brief Details of a Spatial Window
suffstat

Sufficient Statistic of Point Process Model
psp.object

Class of Line Segment Patterns
ppm

Fit Point Process Model to Data
psp

Create a Line Segment Pattern
rmhmodel.list

Define Point Process Model for Metropolis-Hastings Simulation.
ppm.object

Class of Fitted Point Process Models
stieltjes

Compute Integral of Function Against Cumulative Distribution
pairdist

Pairwise distances
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
ponderosa

Ponderosa Pine Tree Point Pattern
persp.im

Perspective Plot of Pixel Image
rmh.default

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

Random Shift
rpoint

Generate N Random Points
rmhmodel.default

Build Point Process Model for Metropolis-Hastings Simulation.
plot.ppp

plot a Spatial Point Pattern
redwood

California Redwoods Point Pattern (Ripley's Subset)
pairdist.psp

Pairwise distances between line segments
rmpoint

Generate N Random Multitype Points
swedishpines

Swedish Pines Point Pattern
runifdisc

Generate N Uniform Random Points in a Disc
ppp.object

Class of Point Patterns
scanpp

Read Point Pattern From Data File
quantile.im

Sample Quantiles of Pixel Image
quadscheme

Generate a Quadrature Scheme from a Point Pattern
ripras

Estimate window from points alone
rescale.ppp

Convert Point Pattern to Another Unit of Length
pppmatching.object

Class of Point Matchings
pppdist

Distance Between Two Point Patterns
summary.ppp

Summary of a Point Pattern Dataset
rpoispp

Generate Poisson Point Pattern
rThomas

Simulate Thomas Process
reduced.sample

Reduced Sample Estimator using Histogram Data
pppmatching

Create a Point Matching
rshift.ppp

Randomly Shift a Point Pattern
plot.fv

Plot Function Valuesn
shift.ppp

Apply Vector Translation To Point Pattern
quad.object

Class of Quadrature Schemes
plot.listof

Plot a List of Things
rlabel

Random Re-Labelling of Point Pattern
subset.ppp

Extract or Replace Subset of Point Pattern
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
plot.ppm

plot a Fitted Point Process Model
plot.im

Plot a Pixel Image
plot.splitppp

Plot a List of Point Patterns
rsyst

Simulate systematic random point pattern
summary.im

Summarizing a Pixel Image
rMatClust

Simulate Matern Cluster Process
residuals.ppm

Residuals for Fitted Point Process Model
rNeymanScott

Simulate Neyman-Scott Process
rescale

Convert dataset to another unit of length
progressreport

Print Progress Reports
setmarks

Set or Reset the Marks in a Point Pattern
profilepl

Profile Maximum Pseudolikelihood
rMaternI

Simulate Matern Model I
smooth.ppp

Spatial smoothing of observations at irregular points
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
simdat

Simulated Point Pattern
spatstat.options

Internal Options in Spatstat Package
summary.ppm

Summarizing a Fitted Point Process Model
rmhmodel.ppm

Interpret Fitted Model for Metropolis-Hastings Simulation.
pairdist.default

Pairwise distances
print.ppp

Print Brief Details of a Point Pattern Dataset
subset.listof

Extract or Replace Subset of a List of Things
plot.plotppm

Plot a plotppm Object Created by plot.ppm
quadrat.test

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

Rotate
vertices

Vertices of a Window
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
shift

Apply Vector Translation
rmh.ppm

Simulate from a Fitted Point Process Model
summary.listof

Summary of a List of Things
rotate.ppp

Rotate a Point Pattern
summary.splitppp

Summary of a Split Point Pattern
rstrat

Simulate Stratified Random Point Pattern
rotate.owin

Rotate a Window
pairsat.family

Saturated Pairwise Interaction Point Process Family
quadratcount

Quadrat counting for a point pattern
predict.ppm

Prediction from a Fitted Point Process Model
superimpose

Superimpose Several Point Patterns
spruces

Spruces Point Pattern
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
pairdist.ppp

Pairwise distances
setcov

Set Covariance of a Window
rshift.psp

Randomly Shift a Line Segment Pattern
rescale.owin

Convert Window to Another Unit of Length
unique.ppp

Extract Unique Points from a Spatial Point Pattern
rotate.psp

Rotate a Line Segment Pattern
subset.fasp

Extract Subset of Function Array
runifpoint

Generate N Uniform Random Points
reach

Interaction Distance of a Point Process
shift.im

Apply Vector Translation To Pixel Image
pcf.ppp

Pair Correlation Function of Point Pattern
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
ppp

Create a Point Pattern
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
subset.im

Extract Subset of Image
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
unmark

Remove Marks from a Marked Point Pattern
raster.x

Cartesian Coordinates for a Pixel Raster
selfcrossing.psp

Crossing Points in a Line Segment Pattern
shift.owin

Apply Vector Translation To Window
subset.fv

Extract Subset of Function Values
shift.psp

Apply Vector Translation To Line Segment Pattern
summary.quad

Summarizing a Quadrature Scheme
pcf.fasp

Pair Correlation Function obtained from array of K functions
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
rjitter

Random Perturbation of a Point Pattern
rmpoispp

Generate Multitype Poisson Point Pattern
split.ppp

Divide Point Pattern into Sub-patterns
spatstat

The Spatstat Package
Jdot

Multitype J Function (i-to-any)
Kmulti

Marked K-Function
rthin

Random Thinning
with.fv

Evaluate an Expression in a Function Table
spokes

Spokes pattern of dummy points
summary.psp

Summary of a Line Segment Pattern Dataset
trim.rectangle

Cut margins from rectangle
update.ppm

Update a Fitted Point Process Model
subsetget.im

Reset Values in Subset of Image
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
Poisson

Poisson Point Process Model
summary.owin

Summary of a Spatial Window
as.ppp

Convert Data To Class ppp
unitname

Name for Unit of Length
union.quad

Union of Data and Dummy Points
inforder.family

Infinite Order Interaction Family
print.quad

Print a Quadrature Scheme
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
Kcross.inhom

Inhomogeneous Cross K Function
subset.psp

Extract Subset of Line Segment Pattern
solutionset

Evaluate Logical Expression Involving Pixel Images and Return Region Where Expression is True
square

Square Window
interp.im

Interpolate a Pixel Image
subset.splitppp

Extract or Replace Sub-Patterns
Softcore

The Soft Core Point Process Model
is.subset.owin

Determine Whether One Window is Contained In Another
model.matrix.ppm

Extract Design Matrix from Point Process Model
betacells

Beta Ganglion Cells in Cat Retina
Kinhom

Inhomogeneous K-function
blur

Apply Gaussian Blur to a Pixel Image
bounding.box.xy

Convex Hull of Points
Gdot

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

Apply Function to Every Neighbourhood in a Point Pattern
concatxy

Concatenate x,y Coordinate Vectors
Kdot.inhom

Inhomogeneous Multitype K Dot Function
Fest

Estimate the empty space function F
cut.ppp

Convert Point Pattern Marks from Numeric to Factor
Gcross

Multitype Nearest Neighbour Distance Function (i-to-j)
Lcross

Multitype L-function (cross-type)
Kest

K-function
AreaInter

The Area Interaction Point Process Model
DiggleGratton

Diggle-Gratton model
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
gridcentres

Rectangular grid of points
Gest

Nearest Neighbour Distance Function G
SatPiece

Piecewise Constant Saturated Pairwise Interaction Point Process Model
Ldot

Multitype L-function (i-to-any)
affine.psp

Apply Affine Transformation To Line Segment Pattern
contour.im

Contour plot of pixel image
distmap.owin

Distance Map of Window
envelope

Simulation envelopes of summary function
clickppp

Interactively Add Points
hamster

Aherne's hamster tumour data
BadGey

Hybrid Geyer Point Process Model
Linhom

L-function
Pairwise

Generic Pairwise Interaction model
area.owin

Area of a Window
japanesepines

Japanese Pines Point Pattern
anemones

Beadlet Anemones Data
localK

Neighbourhood density function
Lest

L-function
letterR

Window in Shape of Letter R
append.psp

Combine Two Line Segment Patterns
Kdot

Multitype K Function (i-to-any)
as.psp

Convert Data To Class psp
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
Strauss

The Strauss Point Process Model
kstest.ppm

Kolmogorov-Smirnov Test for Point Process Model
im.object

Class of Images
is.multitype.ppp

Test Whether A Point Pattern is Multitype
LennardJones

The Lennard-Jones Potential
compatible.fasp

Test Whether Two Function Arrays Are Compatible
alltypes

Calculate Summary Statistic for All Types in a Multitype Point Pattern
compatible.fv

Test Whether Two Function Objects Are Compatible
eroded.areas

Areas of Morphological Erosions
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
finpines

Pine saplings in Finland.
density.psp

Kernel Smoothing of Line Segment Pattern
allstats

Calculate four standard summary functions of a point pattern.
bramblecanes

Hutchings' Bramble Canes data
corners

Corners of a rectangle
bdist.pixels

Distance to Boundary of Window
as.matrix.im

Convert Pixel Image to Matrix
as.owin

Convert Data To Class owin
mean.im

Mean Pixel Value in an Image
endpoints.psp

Endpoints of Line Segment Pattern
crossdist.psp

Pairwise distances between two different line segment patterns
Gmulti

Marked Nearest Neighbour Distance Function
is.ppp

Test Whether An Object Is A Point Pattern
distmap

Distance Map
is.marked.ppp

Test Whether A Point Pattern is Marked
affine.owin

Apply Affine Transformation To Window
amacrine

Hughes' Amacrine Cell Data
centroid.owin

Centroid of a window
Geyer

Geyer's Saturation Point Process Model
chorley

Chorley-Ribble Cancer Data
Jcross

Multitype J Function (i-to-j)
dilate.owin

Dilate a Window
data.ppm

Extract Original Data from a Fitted Point Process Model
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
discretise

Safely Convert Point Pattern Window to Binary Mask
complement.owin

Take Complement of a Window
Iest

Estimate the I-function
fv.object

Data Frames of Function Values
nztrees

New Zealand Trees Point Pattern
ewcdf

Weighted Empirical Cumulative Distribution Function
eval.hyper

Evaluate an Expression in Each Row of a Hyperframe
is.im

Test Whether An Object Is A Pixel Image
bdist.points

Distance to Boundary of Window
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
harmonic

Basis for Harmonic Functions
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
anova.ppm

ANOVA for Fitted Point Process Models
is.marked

Test Whether Marks Are Present
Kcross

Multitype K Function (Cross-type)
crossdist.ppp

Pairwise distances between two different point patterns
lengths.psp

Lengths of Line Segments
eval.fv

Evaluate Expression Involving Functions
is.marked.ppm

Test Whether A Point Process Model is Marked
default.dummy

Generate a Default Pattern of Dummy Points
levelset

Level Set of a Pixel Image
expand.owin

Expand Window By Factor
eem

Exponential Energy Marks
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
model.images

Compute Images of Constructed Covariates
fitted.ppm

Fitted Conditional Intensity for Point Process Model
Kest.fft

K-function using FFT
crossdist.default

Pairwise distances between two different sets of points
im

Create a Pixel Image Object
multiplicity.ppp

Count Multiplicity of Duplicate Points
nndist.psp

Nearest neighbour distances between line segments
ord.family

Ord Interaction Process Family
affine.ppp

Apply Affine Transformation To Point Pattern
angles.psp

Orientation Angles of Line Segments
Jest

Estimate the J-function
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
nbfires

Point Patterns of New Brunswick Forest Fires
Jmulti

Marked J Function
cells

Biological Cells Point Pattern
as.rectangle

Window Frame
matchingdist

Distance for a Point Pattern Matching
Kmeasure

Reduced Second Moment Measure
fasp.object

Function Arrays for Spatial Patterns
areadiff

Difference of Disc Areas
demopat

Artificial Data Point Pattern
nnwhich

Nearest neighbour
logLik.ppm

Log Likelihood for Poisson Point Process Model
hist.im

Histogram of Pixel Values in an Image
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
clarkevans

Clark and Evans Aggregation Index
compatible.im

Test Whether Two Pixel Images Are Compatible
cut.im

Convert Pixel Image from Numeric to Factor
gridweights

Compute Quadrature Weights Based on Grid Counts
distmap.psp

Distance Map of Line Segment Pattern
as.im

Convert to Pixel Image
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
Saturated

Saturated Pairwise Interaction model
MultiStrauss

The Multitype Strauss Point Process Model
crossing.psp

Crossing Points of Two Line Segment Patterns
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
as.mask

Pixel Image Approximation of a Window
is.multitype.ppm

Test Whether A Point Process Model is Multitype
clickpoly

Interactively Define a Polygon
StraussHard

The Strauss / Hard Core Point Process Model
distmap.ppp

Distance Map of Point Pattern
spatstat-deprecated

Deprecated spatstat functions
bei

Tropical rain forest trees
convexhull.xy

Convex Hull of Points
crossdist

Pairwise distances
mincontrast

Method of Minimum Contrast
Ord

Generic Ord Interaction model
nncross

Nearest Neighbour in Another Point Pattern
OrdThresh

Ord's Interaction model
is.multitype

Test whether Object is Multitype
lurking

Lurking variable plot
ants

Harkness-Isham ants' nests data
affine

Apply Affine Transformation
eval.fasp

Evaluate Expression Involving Function Arrays
eval.im

Evaluate Expression Involving Pixel Images
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
diameter

Diameter of a Window
longleaf

Longleaf Pines Point Pattern
nearest.raster.point

Find Pixel Nearest to a Given Point
hyperframe

Hyper Data Frame
erode.owin

Erode a Window
coef.ppm

Coefficients of Fitted Point Process Model
intersect.owin

Intersection or Union of Two Windows
copper

Berman-Huntington points and lines data
as.data.frame.ppp

Coerce Point Pattern to a Data Frame
density.ppp

Kernel Smoothed Intensity of Point Pattern
bounding.box

Bounding Box of a Window or Point Pattern
fitin.ppm

Extract the Interaction from a Fitted Point Process Model
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
identify.ppp

Identify Points in a Point Pattern
is.ppm

Test Whether An Object Is A Fitted Point Process Model
disc

Circular Window
lgcp.estK

Fit a Log-Gaussian Cox Point Process by Minimum Contrast
lansing

Lansing Woods Point Pattern
is.owin

Test Whether An Object Is A Window
spatstat-internal

Internal spatstat functions
marktable

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

Nearest neighbour distances
inside.owin

Test Whether Points Are Inside A Window
midpoints.psp

Midpoints of Line Segment Pattern
markcorr

Mark Correlation Function