Learn R Programming

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

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

License

GPL version 2 or newer

Maintainer

Adrian Baddeley

Last Published

March 22nd, 2025

Functions in spatstat (1.11-6)

DiggleGratton

Diggle-Gratton model
Kdot

Multitype K Function (i-to-any)
as.ppp

Convert Data To Class ppp
concatxy

Concatenate x,y Coordinate Vectors
crossdist.default

Pairwise distances between two different sets of points
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
bdist.points

Distance to Boundary of Window
is.im

Test Whether An Object Is A Pixel Image
distmap.ppp

Distance Map of Point Pattern
intersect.owin

Intersection or Union of Two Windows
ks.test.ppm

Kolmogorov-Smirnov Test for Point Process Model
pcf.ppp

Pair Correlation Function of Point Pattern
Gdot

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

Plot a Function Array
plot.splitppp

Plot a List of Point Patterns
ppp

Create a Point Pattern
Fest

Estimate the empty space function F
plot.fv

Plot Function Valuesn
Iest

Estimate the I-function
append.psp

Combine Two Line Segment Patterns
print.quad

Print a Quadrature Scheme
print.psp

Print Brief Details of a Line Segment Pattern Dataset
data.ppm

Extract Original Data from a Fitted Point Process Model
bounding.box.xy

Convex Hull of Points
ewcdf

Weighted Empirical Cumulative Distribution Function
rStrauss

Perfect Simulation of the Strauss Process
rMaternII

Simulate Matern Model II
raster.x

Cartesian Coordinates for a Pixel Raster
compatible.im

Test Whether Two Pixel Images Are Compatible
letterR

Window in Shape of Letter R
default.dummy

Generate a Default Pattern of Dummy Points
rotate

Rotate
setmarks

Set or Reset the Marks in a Point Pattern
erode.owin

Erode a Window
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
unique.ppp

Extract Unique Points from a Spatial Point Pattern
residuals.ppm

Residuals for Fitted Point Process Model
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
rmhmodel.list

Define Point Process Model for Metropolis-Hastings Simulation.
eroded.areas

Areas of Morphological Erosions
pairdist.default

Pairwise distances
spatstat.options

Internal Options in Spatstat Package
plot.psp

plot a Spatial Line Segment Pattern
subset.fasp

Extract Subset of Function Array
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
is.marked

Test Whether Marks Are Present
subset.listof

Extract or Replace Subset of a List of Things
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
nncross

Nearest Neighbour in Another Point Pattern
density.psp

Kernel Smoothing of Line Segment Pattern
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
rThomas

Simulate Thomas Process
summary.owin

Summary of a Spatial Window
distmap.psp

Distance Map of Line Segment Pattern
bdist.pixels

Distance to Boundary of Window
alltypes

Calculate Statistic for All Types in a Multitype Point Pattern
rpoisline

Generate Poisson Random Line Process
Kcross.inhom

Inhomogeneous Cross K Function
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
crossing.psp

Crossing Points of Two Line Segment Patterns
plot.owin

Plot a Spatial Window
rmh.ppm

Simulate from a Fitted Point Process Model
quantile.im

Sample Quantiles of Pixel Image
affine.psp

Apply Affine Transformation To Line Segment Pattern
rSSI

Simulate Simple Sequential Inhibition
density.ppp

Kernel Smoothed Intensity of Point Pattern
as.im

Convert to Pixel Image
dummy.ppm

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

Rotate a Point Pattern
is.ppp

Test Whether An Object Is A Point Pattern
subset.ppp

Extract or Replace Subset of Point Pattern
owin.object

Class owin
crossdist.psp

Pairwise distances between two different line segment patterns
Kcross

Multitype K Function (Cross-type)
quad.object

Class of Quadrature Schemes
copper

Berman-Huntington points and lines data
fitin.ppm

Extract the Interaction from a Fitted Point Process Model
superimpose

Superimpose Several Point Patterns
Saturated

Saturated Pairwise Interaction model
angles.psp

Orientation Angles of Line Segments
spatstat-internal

Internal spatstat functions
is.marked.ppp

Test Whether A Point Pattern is Marked
rmpoispp

Generate Multitype Poisson Point Pattern
rotate.psp

Rotate a Line Segment Pattern
disc

Circular Window
Gcross

Multitype Nearest Neighbour Distance Function (i-to-j)
shift.ppp

Apply Vector Translation To Point Pattern
longleaf

Longleaf Pines Point Pattern
hamster

Aherne's hamster tumour data
mean.im

Mean Pixel Value in an Image
gridcentres

Rectangular grid of points
hist.im

Histogram of Pixel Values in an Image
rmhmodel.ppm

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

Interpolate a Pixel Image
spatstat

The Spatstat Package
spokes

Spokes pattern of dummy points
japanesepines

Japanese Pines Point Pattern
Softcore

The Soft Core Point Process Model
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
affine

Apply Affine Transformation
lurking

Lurking variable plot
rsyst

Simulate systematic random point pattern
amacrine

Hughes' Amacrine Cell Data
subset.im

Extract Subset of Image
distmap.owin

Distance Map of Window
nztrees

New Zealand Trees Point Pattern
as.rectangle

Window Frame
chorley

Chorley-Ribble Cancer Data
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
rpoispp

Generate Poisson Point Pattern
cells

Biological Cells Point Pattern
solutionset

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

Remove Marks from a Marked Point Pattern
Jmulti

Marked J Function
ganglia

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

Test Whether Points Are Inside A Window
print.ppm

Print a Fitted Point Process Model
summary.quad

Summarizing a Quadrature Scheme
pairdist

Pairwise distances
Pairwise

Generic Pairwise Interaction model
crossdist.ppp

Pairwise distances between two different point patterns
pairsat.family

Saturated Pairwise Interaction Point Process Family
demopat

Artificial Data Point Pattern
profilepl

Profile Maximum Pseudolikelihood
envelope

Simulation envelopes of summary function
levelset

Level Set of a Pixel Image
pcf.fv

Pair Correlation Function obtained from K Function
nbfires

Point Patterns of New Brunswick Forest Fires
summary.im

Summarizing a Pixel Image
subset.psp

Extract Subset of Line Segment Pattern
plot.ppp

plot a Spatial Point Pattern
pppdist

Optimal Match Between Two Point Patterns
ppm

Fit Point Process Model to Data
gridweights

Compute Quadrature Weights Based on Grid Counts
multiplicity.ppp

Count Multiplicity of Duplicate Points
rescale.owin

Convert Window to Another Unit of Length
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
quadscheme

Generate a Quadrature Scheme from a Point Pattern
rmhcontrol

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

Rotate a Window
plot.listof

Plot a List of Things
psp.object

Class of Line Segment Patterns
simdat

Simulated Point Pattern
bei

Tropical rain forest trees
rNeymanScott

Simulate Neyman-Scott Process
suffstat

Sufficient Statistic of Point Process Model
shift

Apply Vector Translation
union.quad

Union of Data and Dummy Points
bramblecanes

Hutchings' Bramble Canes data
diameter

Diameter of a Window
shift.psp

Apply Vector Translation To Line Segment Pattern
Kinhom

Inhomogeneous K-function
trim.rectangle

Cut margins from rectangle
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
summary.splitppp

Summary of a Split Point Pattern
ants

Harkness-Isham ants' nests data
vertices

Vertices of a Window
lansing

Lansing Woods Point Pattern
owin

Create a Window
as.matrix.im

Convert Pixel Image to Matrix
rmhmodel.default

Build Point Process Model for Metropolis-Hastings Simulation.
Geyer

Geyer's Saturation Point Process Model
Kdot.inhom

Inhomogeneous Multitype K Dot Function
rescue.rectangle

Convert Window Back To Rectangle
endpoints.psp

Endpoints of Line Segment Pattern
finpines

Pine saplings in Finland.
Poisson

Poisson Point Process Model
harmonic

Basis for Harmonic Functions
area.owin

Area of a Window
as.owin

Convert Data To Class owin
fv.object

Data Frames of Function Values
coef.ppm

Coefficients of Fitted Point Process Model
plot.quad

plot a Spatial Quadrature Scheme
quadratcount

Quadrat counting for a point pattern
runifpoint

Generate N Uniform Random Points
dilate.owin

Dilate a Window
compatible.fv

Test Whether Two Function Objects Are Compatible
fitted.ppm

Fitted Conditional Intensity for Point Process Model
swedishpines

Swedish Pines Point Pattern
im.object

Class of Images
complement.owin

Take Complement of a Window
is.owin

Test Whether An Object Is A Window
logLik.ppm

Log Likelihood for Poisson Point Process Model
nearest.raster.point

Find Pixel Nearest to a Given Point
lgcp.estK

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

Method of Minimum Contrast
markcorr

Mark Correlation Function
nndist

Nearest neighbour distances
pairwise.family

Pairwise Interaction Process Family
plot.ppm

plot a Fitted Point Process Model
print.im

Print Brief Details of an Image
shift.im

Apply Vector Translation To Pixel Image
summary.psp

Summary of a Line Segment Pattern Dataset
rlabel

Random Re-Labelling of Point Pattern
ripras

Estimate window from points alone
scanpp

Read Point Pattern From Data File
subset.splitppp

Extract or Replace Sub-Patterns
shift.owin

Apply Vector Translation To Window
Kest

K-function
Jcross

Multitype J Function (i-to-j)
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
expand.owin

Expand Window By Factor
Kest.fft

K-function using FFT
betacells

Beta Ganglion Cells in Cat Retina
im

Create a Pixel Image Object
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
plot.im

Plot a Pixel Image
rescale

Convert dataset to another unit of length
anova.ppm

ANOVA for Fitted Point Process Models
MultiStrauss

The Multitype Strauss Point Process Model
clickpoly

Interactively Define a Polygon
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
rstrat

Simulate Stratified Random Point Pattern
summary.ppp

Summary of a Point Pattern Dataset
ord.family

Ord Interaction Process Family
summary.ppm

Summarizing a Fitted Point Process Model
is.marked.ppm

Test Whether A Point Process Model is Marked
psp

Create a Line Segment Pattern
rMatClust

Simulate Matern Cluster Process
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
rthin

Random Thinning
rshift.splitppp

Randomly Shift a List of Point Patterns
split.ppp

Divide Point Pattern into Sub-patterns
square

Square Window
units

Name for Unit of Length
fasp.object

Function Arrays for Spatial Patterns
eval.fv

Evaluate Expression Involving Functions
is.multitype

Test whether Object is Multitype
is.subset.owin

Determine Whether One Window is Contained In Another
pcf

Pair Correlation Function
Ord

Generic Ord Interaction model
contour.im

Contour plot of pixel image
ppm.object

Class of Fitted Point Process Models
corners

Corners of a rectangle
cut.im

Convert Pixel Image from Numeric to Factor
print.owin

Print Brief Details of a Spatial Window
rescale.psp

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

Convert Point Pattern to Another Unit of Length
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
spatstat-deprecated

Deprecated spatstat functions
eval.im

Evaluate Expression Involving Pixel Images
lengths.psp

Lengths of Line Segments
rshift.ppp

Randomly Shift a Point Pattern
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
setcov

Set Covariance of a Window
nnwhich

Nearest neighbour
plot.plotppm

Plot a plotppm Object Created by plot.ppm
predict.ppm

Prediction from a Fitted Point Process Model
rMaternI

Simulate Matern Model I
rcell

Simulate Baddeley-Silverman Cell Process
reach

Interaction Distance of a Point Process
redwood

California Redwoods Point Pattern (Ripley's Subset)
runifdisc

Generate N Uniform Random Points in a Disc
rmpoint

Generate N Random Multitype Points
spruces

Spruces Point Pattern
selfcrossing.psp

Crossing Points in a Line Segment Pattern
Gest

Nearest Neighbour Distance Function G
Jest

Estimate the J-function
Gmulti

Marked Nearest Neighbour Distance Function
Strauss

The Strauss Point Process Model
affine.owin

Apply Affine Transformation To Window
allstats

Calculate four standard summary functions of a point pattern.
bounding.box

Bounding Box of a Window or Point Pattern
convexhull.xy

Convex Hull of Points
centroid.owin

Centroid of a window
cut.ppp

Convert Point Pattern Marks from Numeric to Factor
as.mask

Pixel Image Approximation of a Window
is.multitype.ppm

Test Whether A Point Process Model is Multitype
nndist.psp

Nearest neighbour distances between line segments
is.multitype.ppp

Test Whether A Point Pattern is Multitype
pairdist.ppp

Pairwise distances
pairdist.psp

Pairwise distances between line segments
pcf.fasp

Pair Correlation Function obtained from array of K functions
persp.im

Perspective Plot of Pixel Image
print.ppp

Print Brief Details of a Point Pattern Dataset
update.ppm

Update a Fitted Point Process Model
Jdot

Multitype J Function (i-to-any)
anemones

Beadlet Anemones Data
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
distmap

Distance Map
eem

Exponential Energy Marks
is.ppm

Test Whether An Object Is A Fitted Point Process Model
midpoints.psp

Midpoints of Line Segment Pattern
ppp.object

Class of Point Patterns
rpoint

Generate N Random Points
subset.fv

Extract Subset of Function Values
LennardJones

The Lennard-Jones Potential
Kmulti

Marked K-Function
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
quadrat.test

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

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

Random Shift
rshift.psp

Randomly Shift a Line Segment Pattern
subsetget.im

Reset Values in Subset of Image
OrdThresh

Ord's Interaction model
affine.ppp

Apply Affine Transformation To Point Pattern
Kmeasure

Reduced Second Moment Measure
StraussHard

The Strauss / Hard Core Point Process Model
as.psp

Convert Data To Class psp
clickppp

Interactively Add Points
crossdist

Pairwise distances
identify.ppp

Identify Points in a Point Pattern
progressreport

Print Progress Reports
qqplot.ppm

Q-Q Plot of Residuals from Fitted Point Process Model
reduced.sample

Reduced Sample Estimator using Histogram Data
summary.listof

Summary of a List of Things