Learn R Programming

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

spatstat (version 1.13-0)

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.13-0

License

GPL (>= 2)

Maintainer

Adrian Baddeley

Last Published

March 22nd, 2025

Functions in spatstat (1.13-0)

Kmeasure

Reduced Second Moment Measure
Geyer

Geyer's Saturation Point Process Model
BadGey

Hybrid Geyer Point Process Model
fv.object

Data Frames of Function Values
as.owin

Convert Data To Class owin
DiggleGratton

Diggle-Gratton model
pairdist.default

Pairwise distances
amacrine

Hughes' Amacrine Cell Data
Jcross

Multitype J Function (i-to-j)
Strauss

The Strauss Point Process Model
Jdot

Multitype J Function (i-to-any)
inforder.family

Infinite Order Interaction Family
distmap.ppp

Distance Map of Point Pattern
markstat

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

Plot Function Valuesn
anemones

Beadlet Anemones Data
Gmulti

Marked Nearest Neighbour Distance Function
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
eval.im

Evaluate Expression Involving Pixel Images
as.matrix.im

Convert Pixel Image to Matrix
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
bounding.box.xy

Convex Hull of Points
Jest

Estimate the J-function
allstats

Calculate four standard summary functions of a point pattern.
SatPiece

Piecewise Constant Saturated Pairwise Interaction Point Process Model
spatstat

The Spatstat Package
plot.listof

Plot a List of Things
print.ppp

Print Brief Details of a Point Pattern Dataset
Fest

Estimate the empty space function F
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
bdist.points

Distance to Boundary of Window
Gest

Nearest Neighbour Distance Function G
Gcross

Multitype Nearest Neighbour Distance Function (i-to-j)
nearest.raster.point

Find Pixel Nearest to a Given Point
Poisson

Poisson Point Process Model
append.psp

Combine Two Line Segment Patterns
nbfires

Point Patterns of New Brunswick Forest Fires
Kdot.inhom

Inhomogeneous Multitype K Dot Function
MultiStrauss

The Multitype Strauss Point Process Model
im.object

Class of Images
Pairwise

Generic Pairwise Interaction model
default.dummy

Generate a Default Pattern of Dummy Points
LennardJones

The Lennard-Jones Potential
Kcross.inhom

Inhomogeneous Cross K Function
nncross

Nearest Neighbour in Another Point Pattern
as.data.frame.ppp

Coerce Point Pattern to a Data Frame
summary.im

Summarizing a Pixel Image
Kinhom

Inhomogeneous K-function
rescale.ppp

Convert Point Pattern to Another Unit of Length
Kcross

Multitype K Function (Cross-type)
expand.owin

Expand Window By Factor
multiplicity.ppp

Count Multiplicity of Duplicate Points
as.mask

Pixel Image Approximation of a Window
as.im

Convert to Pixel Image
crossdist

Pairwise distances
plot.hyperframe

Plot Entries in a Hyperframe
owin.object

Class owin
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
Linhom

L-function
crossdist.psp

Pairwise distances between two different line segment patterns
pairdist.ppp

Pairwise distances
anova.ppm

ANOVA for Fitted Point Process Models
affine.psp

Apply Affine Transformation To Line Segment Pattern
compatible.im

Test Whether Two Pixel Images Are Compatible
erode.owin

Erode a Window
centroid.owin

Centroid of a window
bounding.box

Bounding Box of a Window or Point Pattern
is.owin

Test Whether An Object Is A Window
complement.owin

Take Complement of a Window
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
quadratcount

Quadrat counting for a point pattern
rpoispp

Generate Poisson Point Pattern
Ord

Generic Ord Interaction model
Gdot

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

Distance Between Two Point Patterns
runifdisc

Generate N Uniform Random Points in a Disc
japanesepines

Japanese Pines Point Pattern
smooth.ppp

Spatial smoothing of observations at irregular points
quadrat.test

Chi-Squared Dispersion Test for Spatial Point Pattern Based on Quadrat Counts
crossdist.default

Pairwise distances between two different sets of points
print.psp

Print Brief Details of a Line Segment Pattern Dataset
distmap.owin

Distance Map of Window
ants

Harkness-Isham ants' nests data
is.subset.owin

Determine Whether One Window is Contained In Another
rMaternI

Simulate Matern Model I
AreaInter

The Area Interaction Point Process Model
eval.fv

Evaluate Expression Involving Functions
bdist.pixels

Distance to Boundary of Window
Kmulti

Marked K-Function
data.ppm

Extract Original Data from a Fitted Point Process Model
clickpoly

Interactively Define a Polygon
StraussHard

The Strauss / Hard Core Point Process Model
gridcentres

Rectangular grid of points
betacells

Beta Ganglion Cells in Cat Retina
im

Create a Pixel Image Object
plot.fasp

Plot a Function Array
bramblecanes

Hutchings' Bramble Canes data
as.ppp

Convert Data To Class ppp
bei

Tropical rain forest trees
clarkevans

Clark and Evans Aggregation Index
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
endpoints.psp

Endpoints of Line Segment Pattern
Jmulti

Marked J Function
coef.ppm

Coefficients of Fitted Point Process Model
crossing.psp

Crossing Points of Two Line Segment Patterns
pppmatching

Create a Point Matching
lengths.psp

Lengths of Line Segments
discretise

Safely Convert Point Pattern Window to Binary Mask
rmhmodel.default

Build Point Process Model for Metropolis-Hastings Simulation.
quad.object

Class of Quadrature Schemes
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
eem

Exponential Energy Marks
rmpoint

Generate N Random Multitype Points
residuals.ppm

Residuals for Fitted Point Process Model
quantile.im

Sample Quantiles of Pixel Image
Kdot

Multitype K Function (i-to-any)
Lest

L-function
finpines

Pine saplings in Finland.
shift.psp

Apply Vector Translation To Line Segment Pattern
ponderosa

Ponderosa Pine Tree Point Pattern
envelope

Simulation envelopes of summary function
contour.im

Contour plot of pixel image
summary.ppp

Summary of a Point Pattern Dataset
as.rectangle

Window Frame
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
pcf.fasp

Pair Correlation Function obtained from array of K functions
diameter

Diameter of a Window
inside.owin

Test Whether Points Are Inside A Window
letterR

Window in Shape of Letter R
ppm

Fit Point Process Model to Data
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
distmap.psp

Distance Map of Line Segment Pattern
markcorr

Mark Correlation Function
eval.hyper

Evaluate an Expression in Each Row of a Hyperframe
pairdist.psp

Pairwise distances between line segments
rNeymanScott

Simulate Neyman-Scott Process
fasp.object

Function Arrays for Spatial Patterns
ewcdf

Weighted Empirical Cumulative Distribution Function
Saturated

Saturated Pairwise Interaction model
lurking

Lurking variable plot
lansing

Lansing Woods Point Pattern
rmh.ppm

Simulate from a Fitted Point Process Model
marktable

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

The Soft Core Point Process Model
OrdThresh

Ord's Interaction model
Iest

Estimate the I-function
convexhull.xy

Convex Hull of Points
as.psp

Convert Data To Class psp
copper

Berman-Huntington points and lines data
hist.im

Histogram of Pixel Values in an Image
model.matrix.ppm

Extract Design Matrix from Point Process Model
rescale.owin

Convert Window to Another Unit of Length
vertices

Vertices of a Window
setmarks

Set or Reset the Marks in a Point Pattern
subset.psp

Extract Subset of Line Segment Pattern
cut.im

Convert Pixel Image from Numeric to Factor
corners

Corners of a rectangle
identify.ppp

Identify Points in a Point Pattern
density.psp

Kernel Smoothing of Line Segment Pattern
spatstat.options

Internal Options in Spatstat Package
plot.quad

plot a Spatial Quadrature Scheme
compatible.fv

Test Whether Two Function Objects Are Compatible
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
is.multitype.ppp

Test Whether A Point Pattern is Multitype
quadscheme

Generate a Quadrature Scheme from a Point Pattern
is.marked

Test Whether Marks Are Present
spatstat-internal

Internal spatstat functions
interp.im

Interpolate a Pixel Image
solutionset

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

Nearest neighbour distances
scanpp

Read Point Pattern From Data File
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
fitin.ppm

Extract the Interaction from a Fitted Point Process Model
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
mincontrast

Method of Minimum Contrast
crossdist.ppp

Pairwise distances between two different point patterns
gridweights

Compute Quadrature Weights Based on Grid Counts
summary.quad

Summarizing a Quadrature Scheme
suffstat

Sufficient Statistic of Point Process Model
is.ppm

Test Whether An Object Is A Fitted Point Process Model
rMatClust

Simulate Matern Cluster Process
is.multitype

Test whether Object is Multitype
eroded.areas

Areas of Morphological Erosions
rcell

Simulate Baddeley-Silverman Cell Process
affine.ppp

Apply Affine Transformation To Point Pattern
pairwise.family

Pairwise Interaction Process Family
pcf.fv

Pair Correlation Function obtained from K Function
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
rSSI

Simulate Simple Sequential Inhibition
demopat

Artificial Data Point Pattern
model.images

Compute Images of Constructed Covariates
disc

Circular Window
affine.owin

Apply Affine Transformation To Window
nnwhich

Nearest neighbour
pairdist

Pairwise distances
dilate.owin

Dilate a Window
clickppp

Interactively Add Points
matchingdist

Distance for a Point Pattern Matching
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
print.im

Print Brief Details of an Image
pairsat.family

Saturated Pairwise Interaction Point Process Family
ord.family

Ord Interaction Process Family
progressreport

Print Progress Reports
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
ppm.object

Class of Fitted Point Process Models
is.marked.ppp

Test Whether A Point Pattern is Marked
intersect.owin

Intersection or Union of Two Windows
is.im

Test Whether An Object Is A Pixel Image
raster.x

Cartesian Coordinates for a Pixel Raster
trim.rectangle

Cut margins from rectangle
Kest.fft

K-function using FFT
cells

Biological Cells Point Pattern
simdat

Simulated Point Pattern
plot.im

Plot a Pixel Image
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
rlabel

Random Re-Labelling of Point Pattern
union.quad

Union of Data and Dummy Points
lgcp.estK

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

Generate grid of parallel lines with random displacement
chorley

Chorley-Ribble Cancer Data
plot.ppm

plot a Fitted Point Process Model
is.multitype.ppm

Test Whether A Point Process Model is Multitype
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
hamster

Aherne's hamster tumour data
print.quad

Print a Quadrature Scheme
harmonic

Basis for Harmonic Functions
rStrauss

Perfect Simulation of the Strauss Process
ppp

Create a Point Pattern
longleaf

Longleaf Pines Point Pattern
psp.object

Class of Line Segment Patterns
rescue.rectangle

Convert Window Back To Rectangle
rotate

Rotate
logLik.ppm

Log Likelihood for Poisson Point Process Model
summary.ppm

Summarizing a Fitted Point Process Model
reach

Interaction Distance of a Point Process
spatstat-deprecated

Deprecated spatstat functions
reduced.sample

Reduced Sample Estimator using Histogram Data
rsyst

Simulate systematic random point pattern
midpoints.psp

Midpoints of Line Segment Pattern
distmap

Distance Map
rpoint

Generate N Random Points
qqplot.ppm

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

Simulate Stratified Random Point Pattern
ppp.object

Class of Point Patterns
kstest.ppm

Kolmogorov-Smirnov Test for Point Process Model
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
pppmatching.object

Class of Point Matchings
runifpoint

Generate N Uniform Random Points
superimpose

Superimpose Several Point Patterns
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
shift.owin

Apply Vector Translation To Window
print.owin

Print Brief Details of a Spatial Window
hyperframe

Hyper Data Frame
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
subsetget.im

Reset Values in Subset of Image
affine

Apply Affine Transformation
ripras

Estimate window from points alone
localK

Neighbourhood density function
rGaussPoisson

Simulate Gauss-Poisson Process
summary.listof

Summary of a List of Things
area.owin

Area of a Window
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
rshift.ppp

Randomly Shift a Point Pattern
rmhmodel.ppm

Interpret Fitted Model for Metropolis-Hastings Simulation.
areadiff

Difference of Disc Areas
fitted.ppm

Fitted Conditional Intensity for Point Process Model
setcov

Set Covariance of a Window
nztrees

New Zealand Trees Point Pattern
summary.owin

Summary of a Spatial Window
cut.ppp

Convert Point Pattern Marks from Numeric to Factor
predict.ppm

Prediction from a Fitted Point Process Model
print.ppm

Print a Fitted Point Process Model
levelset

Level Set of a Pixel Image
unmark

Remove Marks from a Marked Point Pattern
nndist.psp

Nearest neighbour distances between line segments
persp.im

Perspective Plot of Pixel Image
rpoisline

Generate Poisson Random Line Process
shift.ppp

Apply Vector Translation To Point Pattern
rmpoispp

Generate Multitype Poisson Point Pattern
rshift

Random Shift
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
Kest

K-function
redwood

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

Orientation Angles of Line Segments
rotate.ppp

Rotate a Point Pattern
plot.psp

plot a Spatial Line Segment Pattern
rshift.splitppp

Randomly Shift a List of Point Patterns
plot.plotppm

Plot a plotppm Object Created by plot.ppm
density.ppp

Kernel Smoothed Intensity of Point Pattern
subset.fasp

Extract Subset of Function Array
psp

Create a Line Segment Pattern
subset.fv

Extract Subset of Function Values
rotate.psp

Rotate a Line Segment Pattern
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
subset.im

Extract Subset of Image
rshift.psp

Randomly Shift a Line Segment Pattern
is.ppp

Test Whether An Object Is A Point Pattern
selfcrossing.psp

Crossing Points in a Line Segment Pattern
plot.splitppp

Plot a List of Point Patterns
pcf.ppp

Pair Correlation Function of Point Pattern
profilepl

Profile Maximum Pseudolikelihood
spruces

Spruces Point Pattern
split.ppp

Divide Point Pattern into Sub-patterns
rescale

Convert dataset to another unit of length
rThomas

Simulate Thomas Process
rotate.owin

Rotate a Window
shift

Apply Vector Translation
rmh.default

Simulate Point Process Models using the Metropolis-Hastings Algorithm.
summary.splitppp

Summary of a Split Point Pattern
unique.ppp

Extract Unique Points from a Spatial Point Pattern
concatxy

Concatenate x,y Coordinate Vectors
is.marked.ppm

Test Whether A Point Process Model is Marked
alltypes

Calculate Statistic for All Types in a Multitype Point Pattern
shift.im

Apply Vector Translation To Pixel Image
mean.im

Mean Pixel Value in an Image
square

Square Window
spokes

Spokes pattern of dummy points
owin

Create a Window
subset.listof

Extract or Replace Subset of a List of Things
swedishpines

Swedish Pines Point Pattern
summary.psp

Summary of a Line Segment Pattern Dataset
unitname

Name for Unit of Length
pcf

Pair Correlation Function
plot.owin

Plot a Spatial Window
plot.ppp

plot a Spatial Point Pattern
rMaternII

Simulate Matern Model II
rmhmodel.list

Define Point Process Model for Metropolis-Hastings Simulation.
rthin

Random Thinning
subset.ppp

Extract or Replace Subset of Point Pattern
subset.splitppp

Extract or Replace Sub-Patterns
update.ppm

Update a Fitted Point Process Model