Learn R Programming

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

spatstat (version 1.11-5)

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 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,015

Version

1.11-5

License

GPL version 2 or newer

Maintainer

Adrian Baddeley

Last Published

March 22nd, 2025

Functions in spatstat (1.11-5)

Jmulti

Marked J Function
Kcross

Multitype K Function (Cross-type)
as.im

Convert to Pixel Image
crossing.psp

Crossing Points of Two Line Segment Patterns
OrdThresh

Ord's Interaction model
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
Gest

Nearest Neighbour Distance Function G
nndist.psp

Nearest neighbour distances between line segments
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
cut.im

Convert Pixel Image from Numeric to Factor
as.matrix.im

Convert Pixel Image to Matrix
Gmulti

Marked Nearest Neighbour Distance Function
mincontrast

Method of Minimum Contrast
as.psp

Convert Data To Class psp
disc

Circular Window
density.ppp

Kernel Smoothed Intensity of Point Pattern
inside.owin

Test Whether Points Are Inside A Window
compatible.fv

Test Whether Two Function Objects Are Compatible
intersect.owin

Intersection or Union of Two Windows
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
allstats

Calculate four standard summary functions of a point pattern.
ripras

Estimate window from points alone
Softcore

The Soft Core Point Process Model
ppp.object

Class of Point Patterns
corners

Corners of a rectangle
is.multitype.ppp

Test Whether A Point Pattern is Multitype
clickppp

Interactively Add Points
centroid.owin

Centroid of a window
plot.plotppm

Plot a plotppm Object Created by plot.ppm
Gdot

Multitype Nearest Neighbour Distance Function (i-to-any)
is.subset.owin

Determine Whether One Window is Contained In Another
plot.fasp

Plot a Function Array
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
distmap.psp

Distance Map of Line Segment Pattern
amacrine

Hughes' Amacrine Cell Data
reach

Interaction Distance of a Point Process
append.psp

Combine Two Line Segment Patterns
rpoint

Generate N Random Points
area.owin

Area of a Window
default.dummy

Generate a Default Pattern of Dummy Points
Poisson

Poisson Point Process Model
convexhull.xy

Convex Hull of Points
print.im

Print Brief Details of an Image
compatible.im

Test Whether Two Pixel Images Are Compatible
bounding.box.xy

Convex Hull of Points
Jest

Estimate the J-function
crossdist.ppp

Pairwise distances between two different point patterns
distmap.owin

Distance Map of Window
subset.fasp

Extract Subset of Function Array
fitted.ppm

Fitted Conditional Intensity for Point Process Model
rmh.default

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

Compute Quadrature Weights Based on Grid Counts
expand.owin

Expand Window By Factor
demopat

Artificial Data Point Pattern
identify.ppp

Identify Points in a Point Pattern
eroded.areas

Areas of Morphological Erosions
fitin.ppm

Extract the Interaction from a Fitted Point Process Model
Kinhom

Inhomogeneous K-function
Fest

Estimate the empty space function F
Saturated

Saturated Pairwise Interaction model
affine

Apply Affine Transformation
distmap

Distance Map
bramblecanes

Hutchings' Bramble Canes data
Kmulti

Marked K-Function
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
nearest.raster.point

Find Pixel Nearest to a Given Point
Kdot

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

Randomly Shift a Line Segment Pattern
spatstat

The Spatstat Package
as.mask

Pixel Image Approximation of a Window
crossdist.default

Pairwise distances between two different sets of points
ants

Harkness-Isham ants' nests data
affine.psp

Apply Affine Transformation To Line Segment Pattern
is.multitype.ppm

Test Whether A Point Process Model is Multitype
solutionset

Evaluate Logical Expression Involving Pixel Images and Return Region Where Expression is True
spatstat-deprecated

Deprecated spatstat functions
is.im

Test Whether An Object Is A Pixel Image
crossdist.psp

Pairwise distances between two different line segment patterns
complement.owin

Take Complement of a Window
is.marked

Test Whether Marks Are Present
as.ppp

Convert Data To Class ppp
longleaf

Longleaf Pines Point Pattern
rsyst

Simulate systematic random point pattern
DiggleGratton

Diggle-Gratton model
is.multitype

Test whether Object is Multitype
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
is.ppm

Test Whether An Object Is A Fitted Point Process Model
ppp

Create a Point Pattern
StraussHard

The Strauss / Hard Core Point Process Model
LennardJones

The Lennard-Jones Potential
print.owin

Print Brief Details of a Spatial Window
betacells

Beta Ganglion Cells in Cat Retina
bdist.points

Distance to Boundary of Window
selfcrossing.psp

Crossing Points in a Line Segment Pattern
dilate.owin

Dilate a Window
nbfires

Point Patterns of New Brunswick Forest Fires
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
owin

Create a Window
spatstat-internal

Internal spatstat functions
subset.listof

Extract or Replace Subset of a List of Things
nnwhich

Nearest neighbour
profilepl

Profile Maximum Pseudolikelihood
japanesepines

Japanese Pines Point Pattern
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
subset.psp

Extract Subset of Line Segment Pattern
is.owin

Test Whether An Object Is A Window
pcf.fasp

Pair Correlation Function obtained from array of K functions
ks.test.ppm

Kolmogorov-Smirnov Test for Point Process Model
pcf.ppp

Pair Correlation Function of Point Pattern
Jcross

Multitype J Function (i-to-j)
plot.ppm

plot a Fitted Point Process Model
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
plot.ppp

plot a Spatial Point Pattern
rSSI

Simulate Simple Sequential Inhibition
Kest

K-function
shift.im

Apply Vector Translation To Pixel Image
plot.splitppp

Plot a List of Point Patterns
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
lgcp.estK

Fit a Log-Gaussian Cox Point Process by Minimum Contrast
bounding.box

Bounding Box of a Window or Point Pattern
predict.ppm

Prediction from a Fitted Point Process Model
setmarks

Set or Reset the Marks in a Point Pattern
plot.fv

Plot Function Valuesn
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
quadrat.test

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

Fit Point Process Model to Data
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
Kmeasure

Reduced Second Moment Measure
data.ppm

Extract Original Data from a Fitted Point Process Model
shift

Apply Vector Translation
psp

Create a Line Segment Pattern
qqplot.ppm

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

Generic Pairwise Interaction model
rMaternI

Simulate Matern Model I
rMaternII

Simulate Matern Model II
plot.psp

plot a Spatial Line Segment Pattern
distmap.ppp

Distance Map of Point Pattern
pairdist.ppp

Pairwise distances
is.marked.ppp

Test Whether A Point Pattern is Marked
residuals.ppm

Residuals for Fitted Point Process Model
pcf.fv

Pair Correlation Function obtained from K Function
rlabel

Random Re-Labelling of Point Pattern
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
alltypes

Calculate Statistic for All Types in a Multitype Point Pattern
setcov

Set Covariance of a Window
endpoints.psp

Endpoints of Line Segment Pattern
envelope

Simulation envelopes of summary function
cut.ppp

Convert Point Pattern Marks from Numeric to Factor
print.ppp

Print Brief Details of a Point Pattern Dataset
summary.quad

Summarizing a Quadrature Scheme
rmh.ppm

Simulate from a Fitted Point Process Model
psp.object

Class of Line Segment Patterns
rotate

Rotate
Kdot.inhom

Inhomogeneous Multitype K Dot Function
subsetget.im

Reset Values in Subset of Image
plot.listof

Plot a List of Things
units

Name for Unit of Length
ewcdf

Weighted Empirical Cumulative Distribution Function
fasp.object

Function Arrays for Spatial Patterns
summary.ppm

Summarizing a Fitted Point Process Model
Kest.fft

K-function using FFT
Kcross.inhom

Inhomogeneous Cross K Function
pairdist

Pairwise distances
copper

Berman-Huntington points and lines data
summary.ppp

Summary of a Point Pattern Dataset
progressreport

Print Progress Reports
quadscheme

Generate a Quadrature Scheme from a Point Pattern
unique.ppp

Extract Unique Points from a Spatial Point Pattern
plot.im

Plot a Pixel Image
reduced.sample

Reduced Sample Estimator using Histogram Data
plot.quad

plot a Spatial Quadrature Scheme
chorley

Chorley-Ribble Cancer Data
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
Ord

Generic Ord Interaction model
diameter

Diameter of a Window
rotate.ppp

Rotate a Point Pattern
anemones

Beadlet Anemones Data
summary.splitppp

Summary of a Split Point Pattern
eval.fv

Evaluate Expression Involving Functions
Geyer

Geyer's Saturation Point Process Model
eem

Exponential Energy Marks
angles.psp

Orientation Angles of Line Segments
as.owin

Convert Data To Class owin
Strauss

The Strauss Point Process Model
rmpoispp

Generate Multitype Poisson Point Pattern
coef.ppm

Coefficients of Fitted Point Process Model
im.object

Class of Images
concatxy

Concatenate x,y Coordinate Vectors
finpines

Pine saplings in Finland.
union.quad

Union of Data and Dummy Points
spokes

Spokes pattern of dummy points
ord.family

Ord Interaction Process Family
rcell

Simulate Baddeley-Silverman Cell Process
Gcross

Multitype Nearest Neighbour Distance Function (i-to-j)
rescale.owin

Convert Window to Another Unit of Length
vertices

Vertices of a Window
pairdist.psp

Pairwise distances between line segments
gridcentres

Rectangular grid of points
hist.im

Histogram of Pixel Values in an Image
Jdot

Multitype J Function (i-to-any)
affine.owin

Apply Affine Transformation To Window
rescue.rectangle

Convert Window Back To Rectangle
pcf

Pair Correlation Function
rmpoint

Generate N Random Multitype Points
print.psp

Print Brief Details of a Line Segment Pattern Dataset
rThomas

Simulate Thomas Process
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
eval.im

Evaluate Expression Involving Pixel Images
multiplicity.ppp

Count Multiplicity of Duplicate Points
levelset

Level Set of a Pixel Image
rotate.psp

Rotate a Line Segment Pattern
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
nndist

Nearest neighbour distances
rotate.owin

Rotate a Window
bdist.pixels

Distance to Boundary of Window
hamster

Aherne's hamster tumour data
im

Create a Pixel Image Object
pairsat.family

Saturated Pairwise Interaction Point Process Family
crossdist

Pairwise distances
fv.object

Data Frames of Function Values
markcorr

Mark Correlation Function
lurking

Lurking variable plot
subset.im

Extract Subset of Image
midpoints.psp

Midpoints of Line Segment Pattern
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
contour.im

Contour plot of pixel image
pairwise.family

Pairwise Interaction Process Family
rshift

Random Shift
runifdisc

Generate N Uniform Random Points in a Disc
bei

Tropical rain forest trees
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
quantile.im

Sample Quantiles of Pixel Image
harmonic

Basis for Harmonic Functions
pairdist.default

Pairwise distances
rthin

Random Thinning
subset.fv

Extract Subset of Function Values
owin.object

Class owin
summary.psp

Summary of a Line Segment Pattern Dataset
letterR

Window in Shape of Letter R
nncross

Nearest Neighbour in Another Point Pattern
suffstat

Sufficient Statistic of Point Process Model
swedishpines

Swedish Pines Point Pattern
as.rectangle

Window Frame
is.ppp

Test Whether An Object Is A Point Pattern
quadratcount

Quadrat counting for a point pattern
plot.owin

Plot a Spatial Window
redwood

California Redwoods Point Pattern (Ripley's Subset)
rmhmodel.list

Define Point Process Model for Metropolis-Hastings Simulation.
rmhmodel.default

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

Print a Fitted Point Process Model
rpoispp

Generate Poisson Point Pattern
shift.psp

Apply Vector Translation To Line Segment Pattern
raster.x

Cartesian Coordinates for a Pixel Raster
is.marked.ppm

Test Whether A Point Process Model is Marked
erode.owin

Erode a Window
rmhmodel.ppm

Interpret Fitted Model for Metropolis-Hastings Simulation.
rescale.ppp

Convert Point Pattern to Another Unit of Length
summary.im

Summarizing a Pixel Image
trim.rectangle

Cut margins from rectangle
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
lansing

Lansing Woods Point Pattern
rStrauss

Perfect Simulation of the Strauss Process
rshift.ppp

Randomly Shift a Point Pattern
spruces

Spruces Point Pattern
runifpoint

Generate N Uniform Random Points
superimpose

Superimpose Several Point Patterns
rNeymanScott

Simulate Neyman-Scott Process
shift.owin

Apply Vector Translation To Window
lengths.psp

Lengths of Line Segments
nztrees

New Zealand Trees Point Pattern
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
Iest

Estimate the I-function
affine.ppp

Apply Affine Transformation To Point Pattern
rstrat

Simulate Stratified Random Point Pattern
MultiStrauss

The Multitype Strauss Point Process Model
unmark

Remove Marks from a Marked Point Pattern
vcov.ppm

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

Extract Dummy Points Used to Fit a Point Process Model
shift.ppp

Apply Vector Translation To Point Pattern
mean.im

Mean Pixel Value in an Image
ppm.object

Class of Fitted Point Process Models
persp.im

Perspective Plot of Pixel Image
pppdist

Optimal Match Between Two Point Patterns
print.quad

Print a Quadrature Scheme
rMatClust

Simulate Matern Cluster Process
quad.object

Class of Quadrature Schemes
scanpp

Read Point Pattern From Data File
simdat

Simulated Point Pattern
summary.listof

Summary of a List of Things
square

Square Window
subset.ppp

Extract or Replace Subset of Point Pattern
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
update.ppm

Update a Fitted Point Process Model
anova.ppm

ANOVA for Fitted Point Process Models
cells

Biological Cells Point Pattern
clickpoly

Interactively Define a Polygon
density.psp

Kernel Smoothing of Line Segment Pattern
interp.im

Interpolate a Pixel Image
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
rescale

Convert dataset to another unit of length
rshift.splitppp

Randomly Shift a List of Point Patterns
rpoisline

Generate Poisson Random Line Process
split.ppp

Divide Point Pattern into Sub-patterns
subset.splitppp

Extract or Replace Sub-Patterns
spatstat.options

Internal Options in Spatstat Package
summary.owin

Summary of a Spatial Window