Learn R Programming

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

spatstat (version 1.9-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, 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.9-2

License

GPL version 2 or newer

Maintainer

Adrian Baddeley

Last Published

March 22nd, 2025

Functions in spatstat (1.9-2)

betacells

Beta Ganglion Cells in Cat Retina
as.rectangle

Window Frame
append.psp

Combine Two Line Segment Patterns
midpoints.psp

Midpoints of Line Segment Pattern
Saturated

Saturated Pairwise Interaction model
corners

Corners of a rectangle
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
Gmulti

Marked Nearest Neighbour Distance Function
pairwise.family

Pairwise Interaction Process Family
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
eem

Exponential Energy Marks
is.marked.ppp

Test Whether A Point Pattern is Marked
centroid.owin

Centroid of a window
rmpoispp

Generate Multitype Poisson Point Pattern
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
cut.ppp

Convert Point Pattern Marks from Numeric to Factor
distmap.ppp

Distance Map of Point Pattern
markcorr

Mark Correlation Function
Iest

Estimate the I-function
pcf.fasp

Pair Correlation Function obtained from array of K functions
Strauss

The Strauss Point Process Model
Kdot

Multitype K Function (i-to-any)
eval.fv

Evaluate Expression Involving Functions
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
raster.x

Cartesian Coordinates for a Pixel Raster
predict.ppm

Prediction from a Fitted Point Process Model
shift.psp

Apply Vector Translation To Line Segment Pattern
ppm.object

Class of Fitted Point Process Models
owin

Create a Window
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
rotate.psp

Rotate a Line Segment Pattern
Gest

Nearest Neighbour Distance Function G
as.mask

Pixel Image Approximation of a Window
rshift

Random Shift
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
copper

Berman-Huntington points and lines data
suffstat

Sufficient Statistic of Point Process Model
km.rs

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

Orientation Angles of Line Segments
mean.im

Mean Pixel Value in an Image
plot.plotppm

Plot a plotppm Object Created by plot.ppm
solutionset

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

Estimate the J-function
as.im

Convert to Pixel Image
bdist.points

Distance to Boundary of Window
complement.owin

Take Complement of a Window
is.subset.owin

Determine Whether One Window is Contained In Another
crossing.psp

Crossing Points of Two Line Segment Patterns
print.owin

Print Brief Details of a Spatial Window
diameter

Diameter of a Window Frame
ppp.object

Class of Point Patterns
rlabel

Random Re-Labelling of Point Pattern
Ord

Generic Ord Interaction model
setmarks

Set or Reset the Marks in a Point Pattern
compatible.fv

Test Whether Two Function Objects Are Compatible
rotate.owin

Rotate a Window
cells

Biological Cells Point Pattern
longleaf

Longleaf Pines Point Pattern
runifpoint

Generate N Uniform Random Points
erode.owin

Erode a Window
Kest

K-function
finpines

Pine saplings in Finland.
spatstat

The Spatstat Package
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
crossdist

Pairwise distances
density.psp

Kernel Smoothing of Line Segment Pattern
cut.im

Convert Pixel Image from Numeric to Factor
profilepl

Profile Maximum Pseudolikelihood
distmap.psp

Distance Map of Line Segment Pattern
pairdist.psp

Pairwise distances between line segments
levelset

Level Set of a Pixel Image
rMaternII

Simulate Matern Model II
reach

Interaction Distance of a Point Process
update.ppm

Update a Fitted Point Process Model
Fest

Estimate the empty space function F
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
LennardJones

The Lennard-Jones Potential
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
psp

Create a Line Segment Pattern
rstrat

Stratified random point pattern
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
DiggleGratton

Diggle-Gratton model
Gcross

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

Generic Pairwise Interaction model
Kmeasure

Reduced Second Moment Measure
expand.owin

Expand Window By Factor
Poisson

Poisson Point Process Model
dilate.owin

Dilate a Window
mincontrast

Method of Minimum Contrast
area.owin

Area of a Window
is.im

Test Whether An Object Is A Pixel Image
print.im

Print Brief Details of an Image
pairsat.family

Saturated Pairwise Interaction Point Process Family
print.quad

Print a Quadrature Scheme
as.psp

Convert Data To Class psp
crossdist.ppp

Pairwise distances between two different point patterns
rSSI

Simple Sequential Inhibition
rMaternI

Simulate Matern Model I
union.quad

Union of Data and Dummy Points
plot.fasp

Plot a Function Array
swedishpines

Swedish Pines Point Pattern
redwood

California Redwoods Point Pattern (Ripley's Subset)
summary.quad

Summarizing a Quadrature Scheme
fv.object

Data Frames of Function Values
Jcross

Multitype J Function (i-to-j)
harmonic

Basis for Harmonic Functions
gridweights

Compute Quadrature Weights Based on Grid Counts
subset.fv

Extract Subset of Function Values
ripras

Estimate window from points alone
StraussHard

The Strauss / Hard Core Point Process Model
im

Create a Pixel Image Object
nndist

Nearest neighbour distances
reduced.sample

Reduced Sample Estimator using Histogram Data
OrdThresh

Ord's Interaction model
demopat

Artificial Data Point Pattern
quad.object

Class of Quadrature Schemes
compatible.im

Test Whether Two Pixel Images Are Compatible
pairdist.default

Pairwise distances
rshift.psp

Randomly Shift a Line Segment Pattern
setcov

Set Covariance of a Window
quadrat.test

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

Set Control Parameters for Metropolis-Hastings Algorithm.
envelope

Simulation envelopes of summary function
ppp

Create a Point Pattern
ppm

Fit Point Process Model to Data
Gdot

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

Spruces Point Pattern
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
density.ppp

Kernel Smoothed Intensity of Point Pattern
rpoint

Generate N Random Points
Geyer

Geyer's Saturation Point Process Model
unique.ppp

Extract Unique Points from a Spatial Point Pattern
Jdot

Multitype J Function (i-to-any)
data.ppm

Extract Original Data from a Fitted Point Process Model
Kdot.inhom

Inhomogeneous Multitype K Dot Function
subset.im

Extract Subset of Image
Kcross

Multitype K Function (Cross-type)
MultiStrauss

The Multitype Strauss Point Process Model
rThomas

Simulate Thomas Process
Kinhom

Inhomogeneous K-function
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
eroded.areas

Areas of Morphological Erosions
as.matrix.im

Convert Pixel Image to Matrix
plot.ppm

plot a Fitted Point Process Model
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
Kmulti

Marked K-Function
bramblecanes

Hutchings' Bramble Canes data
subset.fasp

Extract Subset of Function Array
affine.psp

Apply Affine Transformation To Line Segment Pattern
as.owin

Convert Data To Class owin
pairdist

Pairwise distances
lurking

Lurking variable plot
affine

Apply Affine Transformation
plot.ppp

plot a Spatial Point Pattern
crossdist.default

Pairwise distances between two different sets of points
pcf

Pair Correlation Function
concatxy

Concatenate x,y Coordinate Vectors
print.psp

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

Coefficients of Fitted Point Process Model
crossdist.psp

Pairwise distances between two different line segment patterns
spatstat-deprecated

Deprecated spatstat functions
hamster

Aherne's hamster tumour data
subset.psp

Extract Subset of Line Segment Pattern
alltypes

Calculate Statistic for All Types in a Multitype Point Pattern
MultiStraussHard

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

Apply Vector Translation To Pixel Image
rNeymanScott

Simulate Neyman-Scott Process
rmh.default

Simulate Point Process Models using the Metropolis-Hastings Algorithm.
affine.owin

Apply Affine Transformation To Window
plot.psp

plot a Spatial Line Segment Pattern
lengths.psp

Lengths of Line Segments
rpoisline

Generate Poisson Random Line Process
summary.ppm

Summarizing a Fitted Point Process Model
anova.ppm

ANOVA for Fitted Point Process Models
allstats

Calculate four standard summary functions of a point pattern.
shift.ppp

Apply Vector Translation To Point Pattern
nearest.raster.point

Find Pixel Nearest to a Given Point
multiplicity.ppp

Count Multiplicity of Duplicate Points
rcell

Simulate Baddeley-Silverman Cell Process
residuals.ppm

Residuals for Fitted Point Process Model
identify.ppp

Identify Points in a Point Pattern
summary.psp

Summary of a Line Segment Pattern Dataset
Kest.fft

K-function using FFT
gridcentres

Rectangular grid of points
distmap.owin

Distance Map of Window
endpoints.psp

Endpoints of Line Segment Pattern
inside.owin

Test Whether Points Are Inside A Window
is.ppp

Test Whether An Object Is A Point Pattern
square

Square Window
is.marked

Test Whether Marks Are Present
is.ppm

Test Whether An Object Is A Fitted Point Process Model
intersect.owin

Intersection or Union of Two Windows
default.dummy

Generate a Default Pattern of Dummy Points
summary.im

Summarizing a Pixel Image
plot.im

Plot a Pixel Image
japanesepines

Japanese Pines Point Pattern
Kcross.inhom

Inhomogeneous Cross K Function
simdat

Simulated Point Pattern
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
qqplot.ppm

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

Pairwise distances
spokes

Spokes pattern of dummy points
as.ppp

Convert Data To Class ppp
plot.quad

plot a Spatial Quadrature Scheme
bounding.box

Bounding Box of a Window
quadratcount

Quadrat counting for a point pattern
summary.owin

Summary of a Spatial Window
owin.object

Class owin
im.object

Class of Images
spatstat-internal

Internal spatstat functions
nztrees

New Zealand Trees Point Pattern
rotate

Rotate
lansing

Lansing Woods Point Pattern
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
letterR

Window in Shape of Letter R
chorley

Chorley-Ribble Cancer Data
unmark

Remove Marks from a Marked Point Pattern
lgcp.estK

Fit a Log-Gaussian Cox Point Process by Minimum Contrast
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
rshift.ppp

Randomly Shift a Point Pattern
plot.owin

Plot a Spatial Window
rpoispp

Generate Poisson Point Pattern
nnwhich

Nearest neighbour
superimpose

Superimpose Several Point Patterns
eval.im

Evaluate Expression Involving Pixel Images
rmh.ppm

Simulate from a Fitted Point Process Model
Jmulti

Marked J Function
is.owin

Test Whether An Object Is A Window
plot.splitppp

Plot a List of Point Patterns
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
rmpoint

Generate N Random Multitype Points
shift

Apply Vector Translation
shift.owin

Apply Vector Translation To Window
split.ppp

Divide Point Pattern into Sub-patterns
amacrine

Hughes' Amacrine Cell Data
distmap

Distance Map
rMatClust

Simulate Matern Cluster Process
rshift.splitppp

Randomly Shift a List of Point Patterns
hist.im

Histogram of Pixel Values in an Image
rthin

Random Thinning
spatstat.options

Internal Options in Spatstat Package
rsyst

Systematic random point pattern
subset.ppp

Extract or Replace Subset of Point Pattern
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
persp.im

Perspective Plot of Pixel Image
plot.fv

Plot Function Valuesn
pcf.fv

Pair Correlation Function obtained from K Function
pcf.ppp

Pair Correlation Function of Point Pattern
selfcrossing.psp

Crossing Points in a Line Segment Pattern
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
print.ppp

Print Brief Details of a Point Pattern Dataset
Softcore

The Soft Core Point Process Model
scanpp

Read Point Pattern From Data File
quadscheme

Generate a Quadrature Scheme from a Point Pattern
quantile.im

Sample Quantiles of Pixel Image
affine.ppp

Apply Affine Transformation To Point Pattern
ants

Harkness-Isham ants' nests data
rescue.rectangle

Convert Window Back To Rectangle
bdist.pixels

Distance to Boundary of Window
fitted.ppm

Fitted Conditional Intensity for Point Process Model
rotate.ppp

Rotate a Point Pattern
fasp.object

Function Arrays for Spatial Patterns
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
is.marked.ppm

Test Whether A Point Process Model is Marked
ord.family

Ord Interaction Process Family
print.ppm

Print a Fitted Point Process Model
psp.object

Class of Line Segment Patterns
summary.ppp

Summary of a Point Pattern Dataset