Learn R Programming

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

spatstat (version 1.11-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 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

18,534

Version

1.11-3

License

GPL version 2 or newer

Maintainer

Adrian Baddeley

Last Published

March 22nd, 2025

Functions in spatstat (1.11-3)

Gcross

Multitype Nearest Neighbour Distance Function (i-to-j)
bounding.box.xy

Convex Hull of Points
Gest

Nearest Neighbour Distance Function G
OrdThresh

Ord's Interaction model
centroid.owin

Centroid of a window
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
Jcross

Multitype J Function (i-to-j)
crossdist.psp

Pairwise distances between two different line segment patterns
copper

Berman-Huntington points and lines data
default.dummy

Generate a Default Pattern of Dummy Points
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
disc

Circular Window
ewcdf

Weighted Empirical Cumulative Distribution Function
density.psp

Kernel Smoothing of Line Segment Pattern
lgcp.estK

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

Rectangular grid of points
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
is.subset.owin

Determine Whether One Window is Contained In Another
psp.object

Class of Line Segment Patterns
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
pairdist

Pairwise distances
progressreport

Print Progress Reports
quadratcount

Quadrat counting for a point pattern
ppp.object

Class of Point Patterns
rescale.owin

Convert Window to Another Unit of Length
print.quad

Print a Quadrature Scheme
quadrat.test

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

Convert dataset to another unit of length
subset.fv

Extract Subset of Function Values
Gdot

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

Set Control Parameters for Metropolis-Hastings Algorithm.
spokes

Spokes pattern of dummy points
Pairwise

Generic Pairwise Interaction model
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
betacells

Beta Ganglion Cells in Cat Retina
StraussHard

The Strauss / Hard Core Point Process Model
affine.owin

Apply Affine Transformation To Window
fasp.object

Function Arrays for Spatial Patterns
Kest.fft

K-function using FFT
Ord

Generic Ord Interaction model
runifpoint

Generate N Uniform Random Points
interp.im

Interpolate a Pixel Image
MultiStrauss

The Multitype Strauss Point Process Model
rlabel

Random Re-Labelling of Point Pattern
bei

Tropical rain forest trees
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
Poisson

Poisson Point Process Model
cut.im

Convert Pixel Image from Numeric to Factor
affine.psp

Apply Affine Transformation To Line Segment Pattern
update.ppm

Update a Fitted Point Process Model
summary.listof

Summary of a List of Things
chorley

Chorley-Ribble Cancer Data
eval.fv

Evaluate Expression Involving Functions
anova.ppm

ANOVA for Fitted Point Process Models
letterR

Window in Shape of Letter R
is.owin

Test Whether An Object Is A Window
rescale.ppp

Convert Point Pattern to Another Unit of Length
print.ppm

Print a Fitted Point Process Model
is.ppp

Test Whether An Object Is A Point Pattern
expand.owin

Expand Window By Factor
diameter

Diameter of a Window
superimpose

Superimpose Several Point Patterns
Iest

Estimate the I-function
concatxy

Concatenate x,y Coordinate Vectors
plot.psp

plot a Spatial Line Segment Pattern
nbfires

Point Patterns of New Brunswick Forest Fires
harmonic

Basis for Harmonic Functions
lansing

Lansing Woods Point Pattern
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
plot.quad

plot a Spatial Quadrature Scheme
pppdist

Optimal Match Between Two Point Patterns
plot.ppm

plot a Fitted Point Process Model
qqplot.ppm

Q-Q Plot of Residuals from Fitted Point Process Model
print.ppp

Print Brief Details of a Point Pattern Dataset
plot.ppp

plot a Spatial Point Pattern
markcorr

Mark Correlation Function
rMaternII

Simulate Matern Model II
quantile.im

Sample Quantiles of Pixel Image
rmhmodel.list

Define Point Process Model for Metropolis-Hastings Simulation.
matclust.estK

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

Plot a Pixel Image
owin.object

Class owin
rMatClust

Simulate Matern Cluster Process
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
rcell

Simulate Baddeley-Silverman Cell Process
print.im

Print Brief Details of an Image
ppm.object

Class of Fitted Point Process Models
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
nncross

Nearest Neighbour in Another Point Pattern
setcov

Set Covariance of a Window
psp

Create a Line Segment Pattern
print.owin

Print Brief Details of a Spatial Window
shift.im

Apply Vector Translation To Pixel Image
selfcrossing.psp

Crossing Points in a Line Segment Pattern
subset.psp

Extract Subset of Line Segment Pattern
as.matrix.im

Convert Pixel Image to Matrix
plot.owin

Plot a Spatial Window
rpoisline

Generate Poisson Random Line Process
summary.quad

Summarizing a Quadrature Scheme
rthin

Random Thinning
rshift.psp

Randomly Shift a Line Segment Pattern
rshift.ppp

Randomly Shift a Point Pattern
vertices

Vertices of a Window
summary.splitppp

Summary of a Split Point Pattern
identify.ppp

Identify Points in a Point Pattern
unique.ppp

Extract Unique Points from a Spatial Point Pattern
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
mean.im

Mean Pixel Value in an Image
is.marked.ppp

Test Whether A Point Pattern is Marked
shift.ppp

Apply Vector Translation To Point Pattern
persp.im

Perspective Plot of Pixel Image
corners

Corners of a rectangle
crossing.psp

Crossing Points of Two Line Segment Patterns
solutionset

Evaluate Logical Expression Involving Pixel Images and Return Region Where Expression is True
rescue.rectangle

Convert Window Back To Rectangle
spatstat-internal

Internal spatstat functions
Saturated

Saturated Pairwise Interaction model
as.psp

Convert Data To Class psp
rstrat

Simulate Stratified Random Point Pattern
bounding.box

Bounding Box of a Window or Point Pattern
shift.owin

Apply Vector Translation To Window
unmark

Remove Marks from a Marked Point Pattern
ripras

Estimate window from points alone
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
Kest

K-function
Fest

Estimate the empty space function F
endpoints.psp

Endpoints of Line Segment Pattern
demopat

Artificial Data Point Pattern
is.im

Test Whether An Object Is A Pixel Image
nndist

Nearest neighbour distances
pcf.ppp

Pair Correlation Function of Point Pattern
plot.plotppm

Plot a plotppm Object Created by plot.ppm
ppp

Create a Point Pattern
ants

Harkness-Isham ants' nests data
as.owin

Convert Data To Class owin
rMaternI

Simulate Matern Model I
bramblecanes

Hutchings' Bramble Canes data
rpoint

Generate N Random Points
compatible.im

Test Whether Two Pixel Images Are Compatible
rshift

Random Shift
Kmeasure

Reduced Second Moment Measure
rStrauss

Perfect Simulation of the Strauss Process
bdist.pixels

Distance to Boundary of Window
rotate.owin

Rotate a Window
split.ppp

Divide Point Pattern into Sub-patterns
profilepl

Profile Maximum Pseudolikelihood
as.im

Convert to Pixel Image
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
crossdist

Pairwise distances
residuals.ppm

Residuals for Fitted Point Process Model
subset.listof

Extract or Replace Subset of a List of Things
crossdist.default

Pairwise distances between two different sets of points
distmap.ppp

Distance Map of Point Pattern
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
envelope

Simulation envelopes of summary function
im.object

Class of Images
rshift.splitppp

Randomly Shift a List of Point Patterns
amacrine

Hughes' Amacrine Cell Data
summary.im

Summarizing a Pixel Image
union.quad

Union of Data and Dummy Points
subset.fasp

Extract Subset of Function Array
gridweights

Compute Quadrature Weights Based on Grid Counts
append.psp

Combine Two Line Segment Patterns
rsyst

Simulate systematic random point pattern
trim.rectangle

Cut margins from rectangle
as.rectangle

Window Frame
suffstat

Sufficient Statistic of Point Process Model
compatible.fv

Test Whether Two Function Objects Are Compatible
eval.im

Evaluate Expression Involving Pixel Images
convexhull.xy

Convex Hull of Points
inside.owin

Test Whether Points Are Inside A Window
is.marked

Test Whether Marks Are Present
pcf.fasp

Pair Correlation Function obtained from array of K functions
is.marked.ppm

Test Whether A Point Process Model is Marked
pairsat.family

Saturated Pairwise Interaction Point Process Family
rmh.default

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

Level Set of a Pixel Image
density.ppp

Kernel Smoothed Intensity of Point Pattern
fitted.ppm

Fitted Conditional Intensity for Point Process Model
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
pcf.fv

Pair Correlation Function obtained from K Function
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
reach

Interaction Distance of a Point Process
rmhmodel.default

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

Summarizing a Fitted Point Process Model
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
redwood

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

Apply Vector Translation To Line Segment Pattern
square

Square Window
subsetget.im

Reset Values in Subset of Image
Kdot

Multitype K Function (i-to-any)
Geyer

Geyer's Saturation Point Process Model
affine.ppp

Apply Affine Transformation To Point Pattern
angles.psp

Orientation Angles of Line Segments
anemones

Beadlet Anemones Data
as.ppp

Convert Data To Class ppp
contour.im

Contour plot of pixel image
hist.im

Histogram of Pixel Values in an Image
erode.owin

Erode a Window
im

Create a Pixel Image Object
is.multitype

Test whether Object is Multitype
japanesepines

Japanese Pines Point Pattern
ks.test.ppm

Kolmogorov-Smirnov Test for Point Process Model
plot.fasp

Plot a Function Array
ord.family

Ord Interaction Process Family
quadscheme

Generate a Quadrature Scheme from a Point Pattern
quad.object

Class of Quadrature Schemes
rmpoispp

Generate Multitype Poisson Point Pattern
rotate

Rotate
subset.ppp

Extract or Replace Subset of Point Pattern
Gmulti

Marked Nearest Neighbour Distance Function
Kdot.inhom

Inhomogeneous Multitype K Dot Function
Strauss

The Strauss Point Process Model
Softcore

The Soft Core Point Process Model
area.owin

Area of a Window
DiggleGratton

Diggle-Gratton model
complement.owin

Take Complement of a Window
eroded.areas

Areas of Morphological Erosions
Jmulti

Marked J Function
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
nnwhich

Nearest neighbour
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
pairwise.family

Pairwise Interaction Process Family
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
reduced.sample

Reduced Sample Estimator using Histogram Data
rSSI

Simulate Simple Sequential Inhibition
summary.owin

Summary of a Spatial Window
rmhmodel

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

Coefficients of Fitted Point Process Model
dilate.owin

Dilate a Window
finpines

Pine saplings in Finland.
scanpp

Read Point Pattern From Data File
intersect.owin

Intersection or Union of Two Windows
setmarks

Set or Reset the Marks in a Point Pattern
hamster

Aherne's hamster tumour data
spruces

Spruces Point Pattern
shift

Apply Vector Translation
is.ppm

Test Whether An Object Is A Fitted Point Process Model
longleaf

Longleaf Pines Point Pattern
mincontrast

Method of Minimum Contrast
plot.fv

Plot Function Valuesn
rmhmodel.ppm

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

Rotate a Point Pattern
units

Name for Unit of Length
Jdot

Multitype J Function (i-to-any)
Kcross.inhom

Inhomogeneous Cross K Function
Kmulti

Marked K-Function
allstats

Calculate four standard summary functions of a point pattern.
bdist.points

Distance to Boundary of Window
data.ppm

Extract Original Data from a Fitted Point Process Model
distmap

Distance Map
midpoints.psp

Midpoints of Line Segment Pattern
nztrees

New Zealand Trees Point Pattern
pcf

Pair Correlation Function
plot.listof

Plot a List of Things
predict.ppm

Prediction from a Fitted Point Process Model
print.psp

Print Brief Details of a Line Segment Pattern Dataset
rNeymanScott

Simulate Neyman-Scott Process
rThomas

Simulate Thomas Process
runifdisc

Generate N Uniform Random Points in a Disc
simdat

Simulated Point Pattern
Kinhom

Inhomogeneous K-function
Kcross

Multitype K Function (Cross-type)
LennardJones

The Lennard-Jones Potential
clickpoly

Interactively Define a Polygon
eem

Exponential Energy Marks
distmap.owin

Distance Map of Window
multiplicity.ppp

Count Multiplicity of Duplicate Points
rpoispp

Generate Poisson Point Pattern
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
swedishpines

Swedish Pines Point Pattern
Jest

Estimate the J-function
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
affine

Apply Affine Transformation
alltypes

Calculate Statistic for All Types in a Multitype Point Pattern
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
crossdist.ppp

Pairwise distances between two different point patterns
cells

Biological Cells Point Pattern
cut.ppp

Convert Point Pattern Marks from Numeric to Factor
clickppp

Interactively Add Points
is.multitype.ppp

Test Whether A Point Pattern is Multitype
lengths.psp

Lengths of Line Segments
lurking

Lurking variable plot
plot.splitppp

Plot a List of Point Patterns
rmh.ppm

Simulate from a Fitted Point Process Model
rmpoint

Generate N Random Multitype Points
rotate.psp

Rotate a Line Segment Pattern
subset.splitppp

Extract or Replace Sub-Patterns
summary.ppp

Summary of a Point Pattern Dataset
spatstat

The Spatstat Package
as.mask

Pixel Image Approximation of a Window
spatstat-deprecated

Deprecated spatstat functions
distmap.psp

Distance Map of Line Segment Pattern
fv.object

Data Frames of Function Values
is.multitype.ppm

Test Whether A Point Process Model is Multitype
pairdist.default

Pairwise distances
owin

Create a Window
pairdist.psp

Pairwise distances between line segments
pairdist.ppp

Pairwise distances
ppm

Fit Point Process Model to Data
nearest.raster.point

Find Pixel Nearest to a Given Point
raster.x

Cartesian Coordinates for a Pixel Raster
subset.im

Extract Subset of Image
spatstat.options

Internal Options in Spatstat Package
summary.psp

Summary of a Line Segment Pattern Dataset