Learn R Programming

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

spatstat (version 1.12-8)

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

16,015

Version

1.12-8

License

GPL (>= 2)

Maintainer

Adrian Baddeley

Last Published

March 22nd, 2025

Functions in spatstat (1.12-8)

fasp.object

Function Arrays for Spatial Patterns
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
plot.hyperframe

Plot Entries in a Hyperframe
distmap

Distance Map
is.multitype.ppm

Test Whether A Point Process Model is Multitype
rotate.psp

Rotate a Line Segment Pattern
eroded.areas

Areas of Morphological Erosions
is.im

Test Whether An Object Is A Pixel Image
qqplot.ppm

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

Profile Maximum Pseudolikelihood
demopat

Artificial Data Point Pattern
matchingdist

Distance for a Point Pattern Matching
pairdist.default

Pairwise distances
spatstat-deprecated

Deprecated spatstat functions
hyperframe

Hyper Data Frame
plot.owin

Plot a Spatial Window
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
inforder.family

Infinite Order Interaction Family
summary.ppm

Summarizing a Fitted Point Process Model
intersect.owin

Intersection or Union of Two Windows
lansing

Lansing Woods Point Pattern
nncross

Nearest Neighbour in Another Point Pattern
finpines

Pine saplings in Finland.
unmark

Remove Marks from a Marked Point Pattern
dilate.owin

Dilate a Window
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
hist.im

Histogram of Pixel Values in an Image
identify.ppp

Identify Points in a Point Pattern
distmap.ppp

Distance Map of Point Pattern
plot.im

Plot a Pixel Image
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
nbfires

Point Patterns of New Brunswick Forest Fires
superimpose

Superimpose Several Point Patterns
spatstat-internal

Internal spatstat functions
default.dummy

Generate a Default Pattern of Dummy Points
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
logLik.ppm

Log Likelihood for Poisson Point Process Model
rThomas

Simulate Thomas Process
marktable

Tabulate Marks in Neighbourhood of Every Point in a Point Pattern
expand.owin

Expand Window By Factor
crossdist

Pairwise distances
rmh.ppm

Simulate from a Fitted Point Process Model
complement.owin

Take Complement of a Window
suffstat

Sufficient Statistic of Point Process Model
subset.psp

Extract Subset of Line Segment Pattern
persp.im

Perspective Plot of Pixel Image
ppp.object

Class of Point Patterns
interp.im

Interpolate a Pixel Image
gridweights

Compute Quadrature Weights Based on Grid Counts
plot.splitppp

Plot a List of Point Patterns
rmpoispp

Generate Multitype Poisson Point Pattern
rGaussPoisson

Simulate Gauss-Poisson Process
owin.object

Class owin
compatible.fv

Test Whether Two Function Objects Are Compatible
subset.ppp

Extract or Replace Subset of Point Pattern
rpoisline

Generate Poisson Random Line Process
update.ppm

Update a Fitted Point Process Model
rmhmodel.ppm

Interpret Fitted Model for Metropolis-Hastings Simulation.
fitin.ppm

Extract the Interaction from a Fitted Point Process Model
pairwise.family

Pairwise Interaction Process Family
nztrees

New Zealand Trees Point Pattern
owin

Create a Window
crossdist.psp

Pairwise distances between two different line segment patterns
pppmatching

Create a Point Matching
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
raster.x

Cartesian Coordinates for a Pixel Raster
eval.fv

Evaluate Expression Involving Functions
mincontrast

Method of Minimum Contrast
multiplicity.ppp

Count Multiplicity of Duplicate Points
psp

Create a Line Segment Pattern
rMaternII

Simulate Matern Model II
hamster

Aherne's hamster tumour data
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
nnwhich

Nearest neighbour
cut.im

Convert Pixel Image from Numeric to Factor
lurking

Lurking variable plot
corners

Corners of a rectangle
unique.ppp

Extract Unique Points from a Spatial Point Pattern
is.owin

Test Whether An Object Is A Window
is.marked.ppm

Test Whether A Point Process Model is Marked
print.owin

Print Brief Details of a Spatial Window
redwood

California Redwoods Point Pattern (Ripley's Subset)
rshift

Random Shift
eval.im

Evaluate Expression Involving Pixel Images
subsetget.im

Reset Values in Subset of Image
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
fv.object

Data Frames of Function Values
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
eem

Exponential Energy Marks
contour.im

Contour plot of pixel image
is.ppp

Test Whether An Object Is A Point Pattern
predict.ppm

Prediction from a Fitted Point Process Model
plot.ppm

plot a Fitted Point Process Model
solutionset

Evaluate Logical Expression Involving Pixel Images and Return Region Where Expression is True
ppm.object

Class of Fitted Point Process Models
density.ppp

Kernel Smoothed Intensity of Point Pattern
residuals.ppm

Residuals for Fitted Point Process Model
ewcdf

Weighted Empirical Cumulative Distribution Function
rmh.default

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

Nearest-Neighbour Correlation of Marked Point Pattern
gridcentres

Rectangular grid of points
pppdist

Distance Between Two Point Patterns
print.psp

Print Brief Details of a Line Segment Pattern Dataset
markcorr

Mark Correlation Function
rstrat

Simulate Stratified Random Point Pattern
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
discretise

Safely Convert Point Pattern Window to Binary Mask
selfcrossing.psp

Crossing Points in a Line Segment Pattern
runifdisc

Generate N Uniform Random Points in a Disc
crossdist.ppp

Pairwise distances between two different point patterns
rcell

Simulate Baddeley-Silverman Cell Process
pcf.fv

Pair Correlation Function obtained from K Function
shift.im

Apply Vector Translation To Pixel Image
nearest.raster.point

Find Pixel Nearest to a Given Point
localK

Neighbourhood density function
levelset

Level Set of a Pixel Image
midpoints.psp

Midpoints of Line Segment Pattern
concatxy

Concatenate x,y Coordinate Vectors
is.multitype.ppp

Test Whether A Point Pattern is Multitype
distmap.owin

Distance Map of Window
diameter

Diameter of a Window
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
rmhmodel.default

Build Point Process Model for Metropolis-Hastings Simulation.
quadratcount

Quadrat counting for a point pattern
plot.ppp

plot a Spatial Point Pattern
simdat

Simulated Point Pattern
reduced.sample

Reduced Sample Estimator using Histogram Data
im.object

Class of Images
crossing.psp

Crossing Points of Two Line Segment Patterns
mean.im

Mean Pixel Value in an Image
convexhull.xy

Convex Hull of Points
pairdist

Pairwise distances
pairdist.psp

Pairwise distances between line segments
letterR

Window in Shape of Letter R
rotate.ppp

Rotate a Point Pattern
summary.im

Summarizing a Pixel Image
distmap.psp

Distance Map of Line Segment Pattern
rshift.splitppp

Randomly Shift a List of Point Patterns
pcf.fasp

Pair Correlation Function obtained from array of K functions
japanesepines

Japanese Pines Point Pattern
is.marked.ppp

Test Whether A Point Pattern is Marked
setcov

Set Covariance of a Window
print.im

Print Brief Details of an Image
is.ppm

Test Whether An Object Is A Fitted Point Process Model
plot.fasp

Plot a Function Array
rescue.rectangle

Convert Window Back To Rectangle
is.subset.owin

Determine Whether One Window is Contained In Another
rescale.ppp

Convert Point Pattern to Another Unit of Length
plot.quad

plot a Spatial Quadrature Scheme
rmpoint

Generate N Random Multitype Points
endpoints.psp

Endpoints of Line Segment Pattern
rotate.owin

Rotate a Window
print.quad

Print a Quadrature Scheme
summary.ppp

Summary of a Point Pattern Dataset
rpoispp

Generate Poisson Point Pattern
pairdist.ppp

Pairwise distances
spruces

Spruces Point Pattern
quad.object

Class of Quadrature Schemes
data.ppm

Extract Original Data from a Fitted Point Process Model
rescale

Convert dataset to another unit of length
shift.owin

Apply Vector Translation To Window
ppp

Create a Point Pattern
rlabel

Random Re-Labelling of Point Pattern
harmonic

Basis for Harmonic Functions
print.ppm

Print a Fitted Point Process Model
erode.owin

Erode a Window
scanpp

Read Point Pattern From Data File
is.multitype

Test whether Object is Multitype
rescale.owin

Convert Window to Another Unit of Length
kstest.ppm

Kolmogorov-Smirnov Test for Point Process Model
rMaternI

Simulate Matern Model I
inside.owin

Test Whether Points Are Inside A Window
pppmatching.object

Class of Point Matchings
rNeymanScott

Simulate Neyman-Scott Process
print.ppp

Print Brief Details of a Point Pattern Dataset
envelope

Simulation envelopes of summary function
rthin

Random Thinning
subset.fasp

Extract Subset of Function Array
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
copper

Berman-Huntington points and lines data
subset.splitppp

Extract or Replace Sub-Patterns
nndist.psp

Nearest neighbour distances between line segments
runifpoint

Generate N Uniform Random Points
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
shift.psp

Apply Vector Translation To Line Segment Pattern
rsyst

Simulate systematic random point pattern
quantile.im

Sample Quantiles of Pixel Image
fitted.ppm

Fitted Conditional Intensity for Point Process Model
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
nndist

Nearest neighbour distances
rpoint

Generate N Random Points
rmhmodel.list

Define Point Process Model for Metropolis-Hastings Simulation.
plot.listof

Plot a List of Things
unitname

Name for Unit of Length
subset.im

Extract Subset of Image
psp.object

Class of Line Segment Patterns
rshift.psp

Randomly Shift a Line Segment Pattern
as.owin

Convert Data To Class owin
rshift.ppp

Randomly Shift a Point Pattern
OrdThresh

Ord's Interaction model
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
rMatClust

Simulate Matern Cluster Process
crossdist.default

Pairwise distances between two different sets of points
rSSI

Simulate Simple Sequential Inhibition
ord.family

Ord Interaction Process Family
shift

Apply Vector Translation
trim.rectangle

Cut margins from rectangle
Softcore

The Soft Core Point Process Model
progressreport

Print Progress Reports
smooth.ppp

Spatial smoothing of observations at irregular points
Kdot.inhom

Inhomogeneous Multitype K Dot Function
vertices

Vertices of a Window
applynbd

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

Extract or Replace Subset of a List of Things
Fest

Estimate the empty space function F
DiggleGratton

Diggle-Gratton model
Poisson

Poisson Point Process Model
spokes

Spokes pattern of dummy points
summary.owin

Summary of a Spatial Window
quadscheme

Generate a Quadrature Scheme from a Point Pattern
Geyer

Geyer's Saturation Point Process Model
coef.ppm

Coefficients of Fitted Point Process Model
as.ppp

Convert Data To Class ppp
Lest

L-function
subset.fv

Extract Subset of Function Values
betacells

Beta Ganglion Cells in Cat Retina
as.psp

Convert Data To Class psp
AreaInter

The Area Interaction Point Process Model
Gdot

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

Generic Ord Interaction model
bounding.box.xy

Convex Hull of Points
anemones

Beadlet Anemones Data
affine

Apply Affine Transformation
pcf.ppp

Pair Correlation Function of Point Pattern
split.ppp

Divide Point Pattern into Sub-patterns
as.data.frame.ppp

Coerce Point Pattern to a Data Frame
bramblecanes

Hutchings' Bramble Canes data
clickpoly

Interactively Define a Polygon
summary.quad

Summarizing a Quadrature Scheme
Jest

Estimate the J-function
angles.psp

Orientation Angles of Line Segments
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
Gcross

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

Marked Nearest Neighbour Distance Function
anova.ppm

ANOVA for Fitted Point Process Models
MultiStrauss

The Multitype Strauss Point Process Model
affine.ppp

Apply Affine Transformation To Point Pattern
as.im

Convert to Pixel Image
Linhom

L-function
append.psp

Combine Two Line Segment Patterns
LennardJones

The Lennard-Jones Potential
Kmulti

Marked K-Function
bounding.box

Bounding Box of a Window or Point Pattern
ppm

Fit Point Process Model to Data
setmarks

Set or Reset the Marks in a Point Pattern
Kmeasure

Reduced Second Moment Measure
areadiff

Difference of Disc Areas
affine.owin

Apply Affine Transformation To Window
Jcross

Multitype J Function (i-to-j)
as.mask

Pixel Image Approximation of a Window
Kdot

Multitype K Function (i-to-any)
centroid.owin

Centroid of a window
amacrine

Hughes' Amacrine Cell Data
cells

Biological Cells Point Pattern
area.owin

Area of a Window
swedishpines

Swedish Pines Point Pattern
summary.psp

Summary of a Line Segment Pattern Dataset
Gest

Nearest Neighbour Distance Function G
Kcross

Multitype K Function (Cross-type)
StraussHard

The Strauss / Hard Core Point Process Model
Pairwise

Generic Pairwise Interaction model
union.quad

Union of Data and Dummy Points
as.matrix.im

Convert Pixel Image to Matrix
Kest

K-function
chorley

Chorley-Ribble Cancer Data
Kest.fft

K-function using FFT
as.rectangle

Window Frame
allstats

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

Distance to Boundary of Window
Kcross.inhom

Inhomogeneous Cross K Function
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
clarkevans

Clark and Evans Aggregation Index
alltypes

Calculate Statistic for All Types in a Multitype Point Pattern
bei

Tropical rain forest trees
quadrat.test

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

The Strauss Point Process Model
Kinhom

Inhomogeneous K-function
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
density.psp

Kernel Smoothing of Line Segment Pattern
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
disc

Circular Window
ponderosa

Ponderosa Pine Tree Point Pattern
longleaf

Longleaf Pines Point Pattern
im

Create a Pixel Image Object
plot.psp

plot a Spatial Line Segment Pattern
is.marked

Test Whether Marks Are Present
plot.fv

Plot Function Valuesn
reach

Interaction Distance of a Point Process
rlinegrid

Generate grid of parallel lines with random displacement
ripras

Estimate window from points alone
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
Saturated

Saturated Pairwise Interaction model
Jmulti

Marked J Function
Iest

Estimate the I-function
pairsat.family

Saturated Pairwise Interaction Point Process Family
summary.listof

Summary of a List of Things
square

Square Window
rStrauss

Perfect Simulation of the Strauss Process
lgcp.estK

Fit a Log-Gaussian Cox Point Process by Minimum Contrast
summary.splitppp

Summary of a Split Point Pattern
Jdot

Multitype J Function (i-to-any)
ants

Harkness-Isham ants' nests data
bdist.pixels

Distance to Boundary of Window
clickppp

Interactively Add Points
compatible.im

Test Whether Two Pixel Images Are Compatible
eval.hyper

Evaluate an Expression in Each Row of a Hyperframe
cut.ppp

Convert Point Pattern Marks from Numeric to Factor
plot.plotppm

Plot a plotppm Object Created by plot.ppm
lengths.psp

Lengths of Line Segments
pcf

Pair Correlation Function
spatstat.options

Internal Options in Spatstat Package
shift.ppp

Apply Vector Translation To Point Pattern
rotate

Rotate
spatstat

The Spatstat Package
affine.psp

Apply Affine Transformation To Line Segment Pattern