Learn R Programming

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

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

16,015

Version

1.10-3

License

GPL version 2 or newer

Maintainer

Adrian Baddeley

Last Published

March 22nd, 2025

Functions in spatstat (1.10-3)

Jdot

Multitype J Function (i-to-any)
as.matrix.im

Convert Pixel Image to Matrix
cells

Biological Cells Point Pattern
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
hamster

Aherne's hamster tumour data
Kcross

Multitype K Function (Cross-type)
bei

Tropical rain forest trees
diameter

Diameter of a Window Frame
rmhmodel

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

Test Whether An Object Is A Pixel Image
distmap.psp

Distance Map of Line Segment Pattern
rpoint

Generate N Random Points
shift.im

Apply Vector Translation To Pixel Image
is.multitype.ppm

Test Whether A Point Process Model is Multitype
Gdot

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

Simulate Matern Model II
angles.psp

Orientation Angles of Line Segments
concatxy

Concatenate x,y Coordinate Vectors
eem

Exponential Energy Marks
MultiStrauss

The Multitype Strauss Point Process Model
selfcrossing.psp

Crossing Points in a Line Segment Pattern
lengths.psp

Lengths of Line Segments
pcf.fv

Pair Correlation Function obtained from K Function
plot.ppp

plot a Spatial Point Pattern
as.owin

Convert Data To Class owin
density.psp

Kernel Smoothing of Line Segment Pattern
Kest.fft

K-function using FFT
fasp.object

Function Arrays for Spatial Patterns
spokes

Spokes pattern of dummy points
longleaf

Longleaf Pines Point Pattern
Kest

K-function
psp

Create a Line Segment Pattern
Kcross.inhom

Inhomogeneous Cross K Function
runifpoint

Generate N Uniform Random Points
Jest

Estimate the J-function
bdist.points

Distance to Boundary of Window
rNeymanScott

Simulate Neyman-Scott Process
bounding.box

Bounding Box of a Window
print.quad

Print a Quadrature Scheme
LennardJones

The Lennard-Jones Potential
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
rlabel

Random Re-Labelling of Point Pattern
rshift.psp

Randomly Shift a Line Segment Pattern
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
pairwise.family

Pairwise Interaction Process Family
Jmulti

Marked J Function
subset.fv

Extract Subset of Function Values
is.multitype

Test whether Object is Multitype
nnwhich

Nearest neighbour
lurking

Lurking variable plot
bramblecanes

Hutchings' Bramble Canes data
setcov

Set Covariance of a Window
superimpose

Superimpose Several Point Patterns
print.psp

Print Brief Details of a Line Segment Pattern Dataset
rcell

Simulate Baddeley-Silverman Cell Process
cut.ppp

Convert Point Pattern Marks from Numeric to Factor
copper

Berman-Huntington points and lines data
dilate.owin

Dilate a Window
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
is.ppp

Test Whether An Object Is A Point Pattern
im.object

Class of Images
pairdist

Pairwise distances
is.marked.ppp

Test Whether A Point Pattern is Marked
spatstat.options

Internal Options in Spatstat Package
rmh.default

Simulate Point Process Models using the Metropolis-Hastings Algorithm.
ord.family

Ord Interaction Process Family
fitted.ppm

Fitted Conditional Intensity for Point Process Model
swedishpines

Swedish Pines Point Pattern
quadrat.test

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

Summarise Marks in Every Neighbourhood in a Point Pattern
unmark

Remove Marks from a Marked Point Pattern
lansing

Lansing Woods Point Pattern
subset.fasp

Extract Subset of Function Array
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
persp.im

Perspective Plot of Pixel Image
is.owin

Test Whether An Object Is A Window
plot.listof

Plot a List of Things
suffstat

Sufficient Statistic of Point Process Model
raster.x

Cartesian Coordinates for a Pixel Raster
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
plot.im

Plot a Pixel Image
plot.ppm

plot a Fitted Point Process Model
Saturated

Saturated Pairwise Interaction model
scanpp

Read Point Pattern From Data File
rsyst

Simulate systematic random point pattern
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
Fest

Estimate the empty space function F
summary.quad

Summarizing a Quadrature Scheme
plot.psp

plot a Spatial Line Segment Pattern
subset.im

Extract Subset of Image
compatible.fv

Test Whether Two Function Objects Are Compatible
compatible.im

Test Whether Two Pixel Images Are Compatible
density.ppp

Kernel Smoothed Intensity of Point Pattern
distmap.owin

Distance Map of Window
disc

Circular Window
inside.owin

Test Whether Points Are Inside A Window
finpines

Pine saplings in Finland.
rshift.ppp

Randomly Shift a Point Pattern
area.owin

Area of a Window
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
shift

Apply Vector Translation
Softcore

The Soft Core Point Process Model
reach

Interaction Distance of a Point Process
trim.rectangle

Cut margins from rectangle
contour.im

Contour plot of pixel image
distmap.ppp

Distance Map of Point Pattern
mean.im

Mean Pixel Value in an Image
multiplicity.ppp

Count Multiplicity of Duplicate Points
nearest.raster.point

Find Pixel Nearest to a Given Point
nztrees

New Zealand Trees Point Pattern
plot.plotppm

Plot a plotppm Object Created by plot.ppm
setmarks

Set or Reset the Marks in a Point Pattern
rescale

Convert dataset to another unit of length
quadscheme

Generate a Quadrature Scheme from a Point Pattern
rotate

Rotate
OrdThresh

Ord's Interaction model
affine.ppp

Apply Affine Transformation To Point Pattern
is.ppm

Test Whether An Object Is A Fitted Point Process Model
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
Jcross

Multitype J Function (i-to-j)
japanesepines

Japanese Pines Point Pattern
Poisson

Poisson Point Process Model
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
pairdist.default

Pairwise distances
betacells

Beta Ganglion Cells in Cat Retina
demopat

Artificial Data Point Pattern
profilepl

Profile Maximum Pseudolikelihood
redwood

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

Rotate a Line Segment Pattern
Gest

Nearest Neighbour Distance Function G
gridweights

Compute Quadrature Weights Based on Grid Counts
lgcp.estK

Fit a Log-Gaussian Cox Point Process by Minimum Contrast
plot.fasp

Plot a Function Array
DiggleGratton

Diggle-Gratton model
ppp.object

Class of Point Patterns
crossdist

Pairwise distances
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
plot.quad

plot a Spatial Quadrature Scheme
as.im

Convert to Pixel Image
Gcross

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

Rectangular grid of points
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
summary.ppp

Summary of a Point Pattern Dataset
affine.psp

Apply Affine Transformation To Line Segment Pattern
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
clickppp

Interactively Add Points
default.dummy

Generate a Default Pattern of Dummy Points
complement.owin

Take Complement of a Window
cut.im

Convert Pixel Image from Numeric to Factor
print.ppm

Print a Fitted Point Process Model
pairsat.family

Saturated Pairwise Interaction Point Process Family
print.owin

Print Brief Details of a Spatial Window
as.mask

Pixel Image Approximation of a Window
ppp

Create a Point Pattern
print.im

Print Brief Details of an Image
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
eval.im

Evaluate Expression Involving Pixel Images
rSSI

Simulate Simple Sequential Inhibition
quadratcount

Quadrat counting for a point pattern
midpoints.psp

Midpoints of Line Segment Pattern
update.ppm

Update a Fitted Point Process Model
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
rStrauss

Perfect Simulation of the Strauss Process
rpoispp

Generate Poisson Point Pattern
rshift

Random Shift
owin.object

Class owin
unique.ppp

Extract Unique Points from a Spatial Point Pattern
rotate.ppp

Rotate a Point Pattern
rescale.owin

Convert Window to Another Unit of Length
split.ppp

Divide Point Pattern into Sub-patterns
units

Name for Unit of Length
summary.owin

Summary of a Spatial Window
Iest

Estimate the I-function
Kinhom

Inhomogeneous K-function
Ord

Generic Ord Interaction model
Pairwise

Generic Pairwise Interaction model
Kmulti

Marked K-Function
eval.fv

Evaluate Expression Involving Functions
amacrine

Hughes' Amacrine Cell Data
letterR

Window in Shape of Letter R
corners

Corners of a rectangle
pcf.fasp

Pair Correlation Function obtained from array of K functions
markcorr

Mark Correlation Function
centroid.owin

Centroid of a window
is.marked

Test Whether Marks Are Present
nncross

Nearest Neighbour in Another Point Pattern
plot.owin

Plot a Spatial Window
ppm

Fit Point Process Model to Data
rMaternI

Simulate Matern Model I
pairdist.psp

Pairwise distances between line segments
ripras

Estimate window from points alone
rshift.splitppp

Randomly Shift a List of Point Patterns
pcf.ppp

Pair Correlation Function of Point Pattern
nndist

Nearest neighbour distances
psp.object

Class of Line Segment Patterns
rescue.rectangle

Convert Window Back To Rectangle
append.psp

Combine Two Line Segment Patterns
summary.psp

Summary of a Line Segment Pattern Dataset
as.psp

Convert Data To Class psp
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
crossdist.psp

Pairwise distances between two different line segment patterns
rstrat

Simulate Stratified Random Point Pattern
harmonic

Basis for Harmonic Functions
spatstat-deprecated

Deprecated spatstat functions
rthin

Random Thinning
square

Square Window
intersect.owin

Intersection or Union of Two Windows
levelset

Level Set of a Pixel Image
is.subset.owin

Determine Whether One Window is Contained In Another
quad.object

Class of Quadrature Schemes
plot.fv

Plot Function Valuesn
anova.ppm

ANOVA for Fitted Point Process Models
Kdot.inhom

Inhomogeneous Multitype K Dot Function
bdist.pixels

Distance to Boundary of Window
crossdist.ppp

Pairwise distances between two different point patterns
rMatClust

Simulate Matern Cluster Process
rmpoint

Generate N Random Multitype Points
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
runifdisc

Generate N Uniform Random Points in a Disc
summary.im

Summarizing a Pixel Image
identify.ppp

Identify Points in a Point Pattern
spatstat-internal

Internal spatstat functions
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
ppm.object

Class of Fitted Point Process Models
quantile.im

Sample Quantiles of Pixel Image
residuals.ppm

Residuals for Fitted Point Process Model
solutionset

Evaluate Logical Expression Involving Pixel Images and Return Region Where Expression is True
shift.psp

Apply Vector Translation To Line Segment Pattern
Kmeasure

Reduced Second Moment Measure
affine.owin

Apply Affine Transformation To Window
alltypes

Calculate Statistic for All Types in a Multitype Point Pattern
as.ppp

Convert Data To Class ppp
crossing.psp

Crossing Points of Two Line Segment Patterns
fv.object

Data Frames of Function Values
is.marked.ppm

Test Whether A Point Process Model is Marked
rmh.ppm

Simulate from a Fitted Point Process Model
shift.owin

Apply Vector Translation To Window
affine

Apply Affine Transformation
distmap

Distance Map
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
endpoints.psp

Endpoints of Line Segment Pattern
pcf

Pair Correlation Function
expand.owin

Expand Window By Factor
allstats

Calculate four standard summary functions of a point pattern.
hist.im

Histogram of Pixel Values in an Image
Kdot

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

Print Brief Details of a Point Pattern Dataset
envelope

Simulation envelopes of summary function
eroded.areas

Areas of Morphological Erosions
spatstat

The Spatstat Package
im

Create a Pixel Image Object
data.ppm

Extract Original Data from a Fitted Point Process Model
erode.owin

Erode a Window
rpoisline

Generate Poisson Random Line Process
pairdist.ppp

Pairwise distances
plot.splitppp

Plot a List of Point Patterns
as.rectangle

Window Frame
union.quad

Union of Data and Dummy Points
spruces

Spruces Point Pattern
summary.ppm

Summarizing a Fitted Point Process Model
crossdist.default

Pairwise distances between two different sets of points
mincontrast

Method of Minimum Contrast
rotate.owin

Rotate a Window
predict.ppm

Prediction from a Fitted Point Process Model
coef.ppm

Coefficients of Fitted Point Process Model
subset.psp

Extract Subset of Line Segment Pattern
Geyer

Geyer's Saturation Point Process Model
simdat

Simulated Point Pattern
Strauss

The Strauss Point Process Model
Gmulti

Marked Nearest Neighbour Distance Function
qqplot.ppm

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

Chorley-Ribble Cancer Data
rmpoispp

Generate Multitype Poisson Point Pattern
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
shift.ppp

Apply Vector Translation To Point Pattern
rThomas

Simulate Thomas Process
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
pppdist

Optimal Match Between Two Point Patterns
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
reduced.sample

Reduced Sample Estimator using Histogram Data
subset.ppp

Extract or Replace Subset of Point Pattern
rescale.ppp

Convert Point Pattern to Another Unit of Length
StraussHard

The Strauss / Hard Core Point Process Model
ants

Harkness-Isham ants' nests data
is.multitype.ppp

Test Whether A Point Pattern is Multitype
owin

Create a Window