Learn R Programming

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

spatstat (version 1.12-6)

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.12-6

License

GPL (>= 2)

Maintainer

Adrian Baddeley

Last Published

March 22nd, 2025

Functions in spatstat (1.12-6)

MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
Poisson

Poisson Point Process Model
as.im

Convert to Pixel Image
Gest

Nearest Neighbour Distance Function G
Gdot

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

Estimate the J-function
Kdot

Multitype K Function (i-to-any)
coef.ppm

Coefficients of Fitted Point Process Model
Linhom

L-function
Jcross

Multitype J Function (i-to-j)
Softcore

The Soft Core Point Process Model
fitted.ppm

Fitted Conditional Intensity for Point Process Model
spatstat-deprecated

Deprecated spatstat functions
Gcross

Multitype Nearest Neighbour Distance Function (i-to-j)
bdist.pixels

Distance to Boundary of Window
as.psp

Convert Data To Class psp
Kmeasure

Reduced Second Moment Measure
allstats

Calculate four standard summary functions of a point pattern.
as.data.frame.ppp

Coerce Point Pattern to a Data Frame
plot.hyperframe

Plot Entries in a Hyperframe
affine.owin

Apply Affine Transformation To Window
crossdist.psp

Pairwise distances between two different line segment patterns
density.ppp

Kernel Smoothed Intensity of Point Pattern
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
affine.psp

Apply Affine Transformation To Line Segment Pattern
rMaternI

Simulate Matern Model I
lansing

Lansing Woods Point Pattern
append.psp

Combine Two Line Segment Patterns
alltypes

Calculate Statistic for All Types in a Multitype Point Pattern
Fest

Estimate the empty space function F
plot.ppp

plot a Spatial Point Pattern
DiggleGratton

Diggle-Gratton model
compatible.fv

Test Whether Two Function Objects Are Compatible
affine.ppp

Apply Affine Transformation To Point Pattern
AreaInter

The Area Interaction Point Process Model
bdist.points

Distance to Boundary of Window
default.dummy

Generate a Default Pattern of Dummy Points
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
Gmulti

Marked Nearest Neighbour Distance Function
gridweights

Compute Quadrature Weights Based on Grid Counts
Saturated

Saturated Pairwise Interaction model
OrdThresh

Ord's Interaction model
as.rectangle

Window Frame
LennardJones

The Lennard-Jones Potential
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
is.marked.ppm

Test Whether A Point Process Model is Marked
midpoints.psp

Midpoints of Line Segment Pattern
Pairwise

Generic Pairwise Interaction model
spatstat

The Spatstat Package
japanesepines

Japanese Pines Point Pattern
convexhull.xy

Convex Hull of Points
copper

Berman-Huntington points and lines data
Lest

L-function
density.psp

Kernel Smoothing of Line Segment Pattern
nndist.psp

Nearest neighbour distances between line segments
Iest

Estimate the I-function
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
bei

Tropical rain forest trees
eval.fv

Evaluate Expression Involving Functions
ewcdf

Weighted Empirical Cumulative Distribution Function
fitin.ppm

Extract the Interaction from a Fitted Point Process Model
ants

Harkness-Isham ants' nests data
envelope

Simulation envelopes of summary function
contour.im

Contour plot of pixel image
crossdist

Pairwise distances
anemones

Beadlet Anemones Data
clarkevans

Clark and Evans Aggregation Index
as.matrix.im

Convert Pixel Image to Matrix
superimpose

Superimpose Several Point Patterns
betacells

Beta Ganglion Cells in Cat Retina
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
identify.ppp

Identify Points in a Point Pattern
affine

Apply Affine Transformation
expand.owin

Expand Window By Factor
MultiStrauss

The Multitype Strauss Point Process Model
as.ppp

Convert Data To Class ppp
cells

Biological Cells Point Pattern
hist.im

Histogram of Pixel Values in an Image
anova.ppm

ANOVA for Fitted Point Process Models
eval.im

Evaluate Expression Involving Pixel Images
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
discretise

Safely Convert Point Pattern Window to Binary Mask
quadratcount

Quadrat counting for a point pattern
eem

Exponential Energy Marks
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
eval.hyper

Evaluate an Expression in Each Row of a Hyperframe
complement.owin

Take Complement of a Window
corners

Corners of a rectangle
crossing.psp

Crossing Points of Two Line Segment Patterns
area.owin

Area of a Window
Ord

Generic Ord Interaction model
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
Jdot

Multitype J Function (i-to-any)
concatxy

Concatenate x,y Coordinate Vectors
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
areadiff

Difference of Disc Areas
is.multitype

Test whether Object is Multitype
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
inside.owin

Test Whether Points Are Inside A Window
im.object

Class of Images
Kdot.inhom

Inhomogeneous Multitype K Dot Function
Kcross

Multitype K Function (Cross-type)
profilepl

Profile Maximum Pseudolikelihood
im

Create a Pixel Image Object
print.im

Print Brief Details of an Image
data.ppm

Extract Original Data from a Fitted Point Process Model
angles.psp

Orientation Angles of Line Segments
StraussHard

The Strauss / Hard Core Point Process Model
pairdist.default

Pairwise distances
is.im

Test Whether An Object Is A Pixel Image
matchingdist

Distance for a Point Pattern Matching
fasp.object

Function Arrays for Spatial Patterns
levelset

Level Set of a Pixel Image
plot.splitppp

Plot a List of Point Patterns
print.owin

Print Brief Details of a Spatial Window
fv.object

Data Frames of Function Values
chorley

Chorley-Ribble Cancer Data
quantile.im

Sample Quantiles of Pixel Image
ord.family

Ord Interaction Process Family
runifdisc

Generate N Uniform Random Points in a Disc
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
diameter

Diameter of a Window
crossdist.default

Pairwise distances between two different sets of points
nearest.raster.point

Find Pixel Nearest to a Given Point
hyperframe

Hyper Data Frame
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
print.ppm

Print a Fitted Point Process Model
pairdist.psp

Pairwise distances between line segments
gridcentres

Rectangular grid of points
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
compatible.im

Test Whether Two Pixel Images Are Compatible
inforder.family

Infinite Order Interaction Family
pcf.fasp

Pair Correlation Function obtained from array of K functions
Kinhom

Inhomogeneous K-function
dilate.owin

Dilate a Window
disc

Circular Window
rmpoispp

Generate Multitype Poisson Point Pattern
print.quad

Print a Quadrature Scheme
interp.im

Interpolate a Pixel Image
rshift.splitppp

Randomly Shift a List of Point Patterns
distmap.psp

Distance Map of Line Segment Pattern
pcf

Pair Correlation Function
plot.fv

Plot Function Valuesn
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
pppmatching

Create a Point Matching
plot.ppm

plot a Fitted Point Process Model
rescale

Convert dataset to another unit of length
setmarks

Set or Reset the Marks in a Point Pattern
solutionset

Evaluate Logical Expression Involving Pixel Images and Return Region Where Expression is True
quad.object

Class of Quadrature Schemes
pairdist.ppp

Pairwise distances
rlinegrid

Generate grid of parallel lines with random displacement
eroded.areas

Areas of Morphological Erosions
plot.psp

plot a Spatial Line Segment Pattern
nztrees

New Zealand Trees Point Pattern
ppm.object

Class of Fitted Point Process Models
psp

Create a Line Segment Pattern
bounding.box

Bounding Box of a Window or Point Pattern
rotate.ppp

Rotate a Point Pattern
rshift.ppp

Randomly Shift a Point Pattern
logLik.ppm

Log Likelihood for Poisson Point Process Model
ppp

Create a Point Pattern
as.owin

Convert Data To Class owin
rpoint

Generate N Random Points
lurking

Lurking variable plot
finpines

Pine saplings in Finland.
nncross

Nearest Neighbour in Another Point Pattern
persp.im

Perspective Plot of Pixel Image
bounding.box.xy

Convex Hull of Points
multiplicity.ppp

Count Multiplicity of Duplicate Points
centroid.owin

Centroid of a window
suffstat

Sufficient Statistic of Point Process Model
summary.quad

Summarizing a Quadrature Scheme
reach

Interaction Distance of a Point Process
shift.owin

Apply Vector Translation To Window
spatstat-internal

Internal spatstat functions
trim.rectangle

Cut margins from rectangle
pcf.ppp

Pair Correlation Function of Point Pattern
plot.plotppm

Plot a plotppm Object Created by plot.ppm
localK

Neighbourhood density function
rmhmodel.ppm

Interpret Fitted Model for Metropolis-Hastings Simulation.
subsetget.im

Reset Values in Subset of Image
pairwise.family

Pairwise Interaction Process Family
is.ppp

Test Whether An Object Is A Point Pattern
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
owin

Create a Window
plot.owin

Plot a Spatial Window
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
pairsat.family

Saturated Pairwise Interaction Point Process Family
plot.im

Plot a Pixel Image
lgcp.estK

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

Rotate a Line Segment Pattern
erode.owin

Erode a Window
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
ripras

Estimate window from points alone
nnwhich

Nearest neighbour
is.subset.owin

Determine Whether One Window is Contained In Another
summary.splitppp

Summary of a Split Point Pattern
rmhmodel.default

Build Point Process Model for Metropolis-Hastings Simulation.
update.ppm

Update a Fitted Point Process Model
subset.listof

Extract or Replace Subset of a List of Things
subset.ppp

Extract or Replace Subset of Point Pattern
rcell

Simulate Baddeley-Silverman Cell Process
rlabel

Random Re-Labelling of Point Pattern
rGaussPoisson

Simulate Gauss-Poisson Process
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
rstrat

Simulate Stratified Random Point Pattern
summary.im

Summarizing a Pixel Image
rsyst

Simulate systematic random point pattern
marktable

Tabulate Marks in Neighbourhood of Every Point in a Point Pattern
subset.psp

Extract Subset of Line Segment Pattern
setcov

Set Covariance of a Window
scanpp

Read Point Pattern From Data File
vertices

Vertices of a Window
plot.quad

plot a Spatial Quadrature Scheme
rStrauss

Perfect Simulation of the Strauss Process
rthin

Random Thinning
rNeymanScott

Simulate Neyman-Scott Process
summary.owin

Summary of a Spatial Window
nbfires

Point Patterns of New Brunswick Forest Fires
mincontrast

Method of Minimum Contrast
subset.fv

Extract Subset of Function Values
square

Square Window
swedishpines

Swedish Pines Point Pattern
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
pairdist

Pairwise distances
unmark

Remove Marks from a Marked Point Pattern
shift.im

Apply Vector Translation To Pixel Image
plot.listof

Plot a List of Things
summary.ppm

Summarizing a Fitted Point Process Model
nndist

Nearest neighbour distances
rpoispp

Generate Poisson Point Pattern
rshift.psp

Randomly Shift a Line Segment Pattern
pppdist

Distance Between Two Point Patterns
mean.im

Mean Pixel Value in an Image
markcorr

Mark Correlation Function
summary.ppp

Summary of a Point Pattern Dataset
spruces

Spruces Point Pattern
letterR

Window in Shape of Letter R
rMaternII

Simulate Matern Model II
psp.object

Class of Line Segment Patterns
redwood

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

Print Brief Details of a Point Pattern Dataset
ponderosa

Ponderosa Pine Tree Point Pattern
summary.psp

Summary of a Line Segment Pattern Dataset
predict.ppm

Prediction from a Fitted Point Process Model
rshift

Random Shift
is.owin

Test Whether An Object Is A Window
progressreport

Print Progress Reports
is.multitype.ppm

Test Whether A Point Process Model is Multitype
shift.ppp

Apply Vector Translation To Point Pattern
subset.splitppp

Extract or Replace Sub-Patterns
rescale.owin

Convert Window to Another Unit of Length
rMatClust

Simulate Matern Cluster Process
spatstat.options

Internal Options in Spatstat Package
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
rmpoint

Generate N Random Multitype Points
spokes

Spokes pattern of dummy points
print.psp

Print Brief Details of a Line Segment Pattern Dataset
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
residuals.ppm

Residuals for Fitted Point Process Model
subset.im

Extract Subset of Image
raster.x

Cartesian Coordinates for a Pixel Raster
ppm

Fit Point Process Model to Data
unique.ppp

Extract Unique Points from a Spatial Point Pattern
is.marked

Test Whether Marks Are Present
quadrat.test

Chi-Squared Dispersion Test for Spatial Point Pattern Based on Quadrat Counts
reduced.sample

Reduced Sample Estimator using Histogram Data
hamster

Aherne's hamster tumour data
selfcrossing.psp

Crossing Points in a Line Segment Pattern
cut.im

Convert Pixel Image from Numeric to Factor
simdat

Simulated Point Pattern
rmhmodel.list

Define Point Process Model for Metropolis-Hastings Simulation.
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
runifpoint

Generate N Uniform Random Points
shift

Apply Vector Translation
split.ppp

Divide Point Pattern into Sub-patterns
rescue.rectangle

Convert Window Back To Rectangle
subset.fasp

Extract Subset of Function Array
harmonic

Basis for Harmonic Functions
rSSI

Simulate Simple Sequential Inhibition
distmap.ppp

Distance Map of Point Pattern
rmh.default

Simulate Point Process Models using the Metropolis-Hastings Algorithm.
shift.psp

Apply Vector Translation To Line Segment Pattern
intersect.owin

Intersection or Union of Two Windows
unitname

Name for Unit of Length
clickppp

Interactively Add Points
Kest

K-function
cut.ppp

Convert Point Pattern Marks from Numeric to Factor
ganglia

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

Distance Map of Window
ppp.object

Class of Point Patterns
lengths.psp

Lengths of Line Segments
smooth.ppp

Spatial smoothing of observations at irregular points
pppmatching.object

Class of Point Matchings
qqplot.ppm

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

Simulate Thomas Process
union.quad

Union of Data and Dummy Points
rmh.ppm

Simulate from a Fitted Point Process Model
Kcross.inhom

Inhomogeneous Cross K Function
clickpoly

Interactively Define a Polygon
amacrine

Hughes' Amacrine Cell Data
Kest.fft

K-function using FFT
crossdist.ppp

Pairwise distances between two different point patterns
demopat

Artificial Data Point Pattern
is.multitype.ppp

Test Whether A Point Pattern is Multitype
as.mask

Pixel Image Approximation of a Window
is.ppm

Test Whether An Object Is A Fitted Point Process Model
owin.object

Class owin
pcf.fv

Pair Correlation Function obtained from K Function
rescale.ppp

Convert Point Pattern to Another Unit of Length
Geyer

Geyer's Saturation Point Process Model
Kmulti

Marked K-Function
distmap

Distance Map
endpoints.psp

Endpoints of Line Segment Pattern
bramblecanes

Hutchings' Bramble Canes data
Jmulti

Marked J Function
is.marked.ppp

Test Whether A Point Pattern is Marked
kstest.ppm

Kolmogorov-Smirnov Test for Point Process Model
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
plot.fasp

Plot a Function Array
longleaf

Longleaf Pines Point Pattern
rotate.owin

Rotate a Window
rpoisline

Generate Poisson Random Line Process
rotate

Rotate
quadscheme

Generate a Quadrature Scheme from a Point Pattern
summary.listof

Summary of a List of Things
Strauss

The Strauss Point Process Model