Learn R Programming

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

spatstat (version 1.11-2)

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-2

License

GPL version 2 or newer

Maintainer

Adrian Baddeley

Last Published

March 22nd, 2025

Functions in spatstat (1.11-2)

suffstat

Sufficient Statistic of Point Process Model
rescale.ppp

Convert Point Pattern to Another Unit of Length
rcell

Simulate Baddeley-Silverman Cell Process
Gcross

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

The Multitype Strauss Point Process Model
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
im

Create a Pixel Image Object
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
spatstat

The Spatstat Package
rNeymanScott

Simulate Neyman-Scott Process
multiplicity.ppp

Count Multiplicity of Duplicate Points
Jmulti

Marked J Function
lengths.psp

Lengths of Line Segments
reach

Interaction Distance of a Point Process
distmap

Distance Map
nncross

Nearest Neighbour in Another Point Pattern
japanesepines

Japanese Pines Point Pattern
endpoints.psp

Endpoints of Line Segment Pattern
is.ppp

Test Whether An Object Is A Point Pattern
compatible.im

Test Whether Two Pixel Images Are Compatible
gridcentres

Rectangular grid of points
diameter

Diameter of a Window
ants

Harkness-Isham ants' nests data
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
lgcp.estK

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

Compute Quadrature Weights Based on Grid Counts
Pairwise

Generic Pairwise Interaction model
im.object

Class of Images
eem

Exponential Energy Marks
clickppp

Interactively Add Points
is.owin

Test Whether An Object Is A Window
is.im

Test Whether An Object Is A Pixel Image
complement.owin

Take Complement of a Window
plot.im

Plot a Pixel Image
bounding.box

Bounding Box of a Window or Point Pattern
is.subset.owin

Determine Whether One Window is Contained In Another
as.mask

Pixel Image Approximation of a Window
rescale.owin

Convert Window to Another Unit of Length
superimpose

Superimpose Several Point Patterns
profilepl

Profile Maximum Pseudolikelihood
quadratcount

Quadrat counting for a point pattern
ord.family

Ord Interaction Process Family
Kmulti

Marked K-Function
rshift

Random Shift
Jcross

Multitype J Function (i-to-j)
levelset

Level Set of a Pixel Image
as.psp

Convert Data To Class psp
centroid.owin

Centroid of a window
copper

Berman-Huntington points and lines data
print.psp

Print Brief Details of a Line Segment Pattern Dataset
crossdist.default

Pairwise distances between two different sets of points
spatstat-internal

Internal spatstat functions
Jest

Estimate the J-function
split.ppp

Divide Point Pattern into Sub-patterns
Saturated

Saturated Pairwise Interaction model
Gdot

Multitype Nearest Neighbour Distance Function (i-to-any)
plot.ppp

plot a Spatial Point Pattern
affine

Apply Affine Transformation
solutionset

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

Random Thinning
eroded.areas

Areas of Morphological Erosions
shift.im

Apply Vector Translation To Pixel Image
crossdist

Pairwise distances
print.ppp

Print Brief Details of a Point Pattern Dataset
owin.object

Class owin
Strauss

The Strauss Point Process Model
rmh.ppm

Simulate from a Fitted Point Process Model
is.multitype.ppm

Test Whether A Point Process Model is Multitype
print.im

Print Brief Details of an Image
anova.ppm

ANOVA for Fitted Point Process Models
lansing

Lansing Woods Point Pattern
subset.psp

Extract Subset of Line Segment Pattern
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
distmap.ppp

Distance Map of Point Pattern
summary.psp

Summary of a Line Segment Pattern Dataset
rotate.psp

Rotate a Line Segment Pattern
density.psp

Kernel Smoothing of Line Segment Pattern
fv.object

Data Frames of Function Values
as.ppp

Convert Data To Class ppp
hamster

Aherne's hamster tumour data
convexhull.xy

Convex Hull of Points
ppp.object

Class of Point Patterns
distmap.owin

Distance Map of Window
nztrees

New Zealand Trees Point Pattern
anemones

Beadlet Anemones Data
redwood

California Redwoods Point Pattern (Ripley's Subset)
nbfires

Point Patterns of New Brunswick Forest Fires
rpoisline

Generate Poisson Random Line Process
coef.ppm

Coefficients of Fitted Point Process Model
mean.im

Mean Pixel Value in an Image
ripras

Estimate window from points alone
clickpoly

Interactively Define a Polygon
append.psp

Combine Two Line Segment Patterns
erode.owin

Erode a Window
rotate

Rotate
summary.ppp

Summary of a Point Pattern Dataset
rshift.psp

Randomly Shift a Line Segment Pattern
plot.psp

plot a Spatial Line Segment Pattern
longleaf

Longleaf Pines Point Pattern
summary.splitppp

Summary of a Split Point Pattern
pppdist

Optimal Match Between Two Point Patterns
setmarks

Set or Reset the Marks in a Point Pattern
simdat

Simulated Point Pattern
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
rMaternI

Simulate Matern Model I
trim.rectangle

Cut margins from rectangle
distmap.psp

Distance Map of Line Segment Pattern
midpoints.psp

Midpoints of Line Segment Pattern
psp.object

Class of Line Segment Patterns
spokes

Spokes pattern of dummy points
ppm.object

Class of Fitted Point Process Models
rescale

Convert dataset to another unit of length
quadrat.test

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

Create a Line Segment Pattern
Kcross

Multitype K Function (Cross-type)
Jdot

Multitype J Function (i-to-any)
Gest

Nearest Neighbour Distance Function G
Kest.fft

K-function using FFT
as.owin

Convert Data To Class owin
cells

Biological Cells Point Pattern
print.quad

Print a Quadrature Scheme
shift.owin

Apply Vector Translation To Window
subset.fv

Extract Subset of Function Values
eval.fv

Evaluate Expression Involving Functions
as.im

Convert to Pixel Image
rpoint

Generate N Random Points
pcf.ppp

Pair Correlation Function of Point Pattern
DiggleGratton

Diggle-Gratton model
summary.quad

Summarizing a Quadrature Scheme
Softcore

The Soft Core Point Process Model
area.owin

Area of a Window
scanpp

Read Point Pattern From Data File
raster.x

Cartesian Coordinates for a Pixel Raster
cut.ppp

Convert Point Pattern Marks from Numeric to Factor
Kest

K-function
concatxy

Concatenate x,y Coordinate Vectors
crossdist.psp

Pairwise distances between two different line segment patterns
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
letterR

Window in Shape of Letter R
as.matrix.im

Convert Pixel Image to Matrix
chorley

Chorley-Ribble Cancer Data
fasp.object

Function Arrays for Spatial Patterns
hist.im

Histogram of Pixel Values in an Image
inside.owin

Test Whether Points Are Inside A Window
Kmeasure

Reduced Second Moment Measure
amacrine

Hughes' Amacrine Cell Data
rmh.default

Simulate Point Process Models using the Metropolis-Hastings Algorithm.
compatible.fv

Test Whether Two Function Objects Are Compatible
is.multitype

Test whether Object is Multitype
is.multitype.ppp

Test Whether A Point Pattern is Multitype
plot.splitppp

Plot a List of Point Patterns
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
shift

Apply Vector Translation
is.marked.ppp

Test Whether A Point Pattern is Marked
ppm

Fit Point Process Model to Data
plot.listof

Plot a List of Things
pairdist.default

Pairwise distances
nearest.raster.point

Find Pixel Nearest to a Given Point
is.ppm

Test Whether An Object Is A Fitted Point Process Model
print.ppm

Print a Fitted Point Process Model
progressreport

Print Progress Reports
contour.im

Contour plot of pixel image
affine.ppp

Apply Affine Transformation To Point Pattern
vcov.ppm

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

Update a Fitted Point Process Model
runifdisc

Generate N Uniform Random Points in a Disc
rpoispp

Generate Poisson Point Pattern
setcov

Set Covariance of a Window
alltypes

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

Pair Correlation Function obtained from K Function
shift.ppp

Apply Vector Translation To Point Pattern
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
rotate.owin

Rotate a Window
owin

Create a Window
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
selfcrossing.psp

Crossing Points in a Line Segment Pattern
pairdist.psp

Pairwise distances between line segments
ewcdf

Weighted Empirical Cumulative Distribution Function
plot.plotppm

Plot a plotppm Object Created by plot.ppm
summary.im

Summarizing a Pixel Image
Fest

Estimate the empty space function F
rmpoint

Generate N Random Multitype Points
plot.owin

Plot a Spatial Window
OrdThresh

Ord's Interaction model
default.dummy

Generate a Default Pattern of Dummy Points
summary.owin

Summary of a Spatial Window
spruces

Spruces Point Pattern
residuals.ppm

Residuals for Fitted Point Process Model
affine.psp

Apply Affine Transformation To Line Segment Pattern
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
unique.ppp

Extract Unique Points from a Spatial Point Pattern
bei

Tropical rain forest trees
shift.psp

Apply Vector Translation To Line Segment Pattern
rotate.ppp

Rotate a Point Pattern
pairsat.family

Saturated Pairwise Interaction Point Process Family
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
bramblecanes

Hutchings' Bramble Canes data
harmonic

Basis for Harmonic Functions
rshift.splitppp

Randomly Shift a List of Point Patterns
rSSI

Simulate Simple Sequential Inhibition
demopat

Artificial Data Point Pattern
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
subset.splitppp

Extract or Replace Sub-Patterns
square

Square Window
LennardJones

The Lennard-Jones Potential
unmark

Remove Marks from a Marked Point Pattern
expand.owin

Expand Window By Factor
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
persp.im

Perspective Plot of Pixel Image
spatstat.options

Internal Options in Spatstat Package
crossdist.ppp

Pairwise distances between two different point patterns
eval.im

Evaluate Expression Involving Pixel Images
lurking

Lurking variable plot
mincontrast

Method of Minimum Contrast
disc

Circular Window
cut.im

Convert Pixel Image from Numeric to Factor
plot.quad

plot a Spatial Quadrature Scheme
bounding.box.xy

Convex Hull of Points
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
bdist.pixels

Distance to Boundary of Window
finpines

Pine saplings in Finland.
intersect.owin

Intersection or Union of Two Windows
print.owin

Print Brief Details of a Spatial Window
rlabel

Random Re-Labelling of Point Pattern
swedishpines

Swedish Pines Point Pattern
rescue.rectangle

Convert Window Back To Rectangle
quad.object

Class of Quadrature Schemes
subsetget.im

Reset Values in Subset of Image
data.ppm

Extract Original Data from a Fitted Point Process Model
allstats

Calculate four standard summary functions of a point pattern.
Gmulti

Marked Nearest Neighbour Distance Function
Iest

Estimate the I-function
bdist.points

Distance to Boundary of Window
fitted.ppm

Fitted Conditional Intensity for Point Process Model
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
is.marked

Test Whether Marks Are Present
envelope

Simulation envelopes of summary function
identify.ppp

Identify Points in a Point Pattern
quantile.im

Sample Quantiles of Pixel Image
spatstat-deprecated

Deprecated spatstat functions
Kdot

Multitype K Function (i-to-any)
markcorr

Mark Correlation Function
ppp

Create a Point Pattern
pairwise.family

Pairwise Interaction Process Family
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
quadscheme

Generate a Quadrature Scheme from a Point Pattern
is.marked.ppm

Test Whether A Point Process Model is Marked
rshift.ppp

Randomly Shift a Point Pattern
summary.ppm

Summarizing a Fitted Point Process Model
affine.owin

Apply Affine Transformation To Window
corners

Corners of a rectangle
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
ks.test.ppm

Kolmogorov-Smirnov Test for Point Process Model
nndist

Nearest neighbour distances
Geyer

Geyer's Saturation Point Process Model
nnwhich

Nearest neighbour
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
pcf.fasp

Pair Correlation Function obtained from array of K functions
subset.fasp

Extract Subset of Function Array
summary.listof

Summary of a List of Things
Kcross.inhom

Inhomogeneous Cross K Function
StraussHard

The Strauss / Hard Core Point Process Model
Kinhom

Inhomogeneous K-function
crossing.psp

Crossing Points of Two Line Segment Patterns
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
plot.fv

Plot Function Valuesn
rStrauss

Perfect Simulation of the Strauss Process
runifpoint

Generate N Uniform Random Points
rmpoispp

Generate Multitype Poisson Point Pattern
reduced.sample

Reduced Sample Estimator using Histogram Data
plot.ppm

plot a Fitted Point Process Model
rMatClust

Simulate Matern Cluster Process
Kdot.inhom

Inhomogeneous Multitype K Dot Function
as.rectangle

Window Frame
rThomas

Simulate Thomas Process
betacells

Beta Ganglion Cells in Cat Retina
Poisson

Poisson Point Process Model
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
predict.ppm

Prediction from a Fitted Point Process Model
pairdist

Pairwise distances
pcf

Pair Correlation Function
rsyst

Simulate systematic random point pattern
plot.fasp

Plot a Function Array
subset.im

Extract Subset of Image
rstrat

Simulate Stratified Random Point Pattern
vertices

Vertices of a Window
rMaternII

Simulate Matern Model II
dilate.owin

Dilate a Window
subset.ppp

Extract or Replace Subset of Point Pattern
rmhstart

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

Orientation Angles of Line Segments
density.ppp

Kernel Smoothed Intensity of Point Pattern
pairdist.ppp

Pairwise distances
qqplot.ppm

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

Generic Ord Interaction model
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
union.quad

Union of Data and Dummy Points
units

Name for Unit of Length
subset.listof

Extract or Replace Subset of a List of Things