Learn R Programming

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

spatstat (version 1.9-4)

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

18,534

Version

1.9-4

License

GPL version 2 or newer

Maintainer

Adrian Baddeley

Last Published

March 22nd, 2025

Functions in spatstat (1.9-4)

Jdot

Multitype J Function (i-to-any)
Fest

Estimate the empty space function F
corners

Corners of a rectangle
anova.ppm

ANOVA for Fitted Point Process Models
LennardJones

The Lennard-Jones Potential
Softcore

The Soft Core Point Process Model
DiggleGratton

Diggle-Gratton model
Iest

Estimate the I-function
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
ants

Harkness-Isham ants' nests data
betacells

Beta Ganglion Cells in Cat Retina
Jest

Estimate the J-function
allstats

Calculate four standard summary functions of a point pattern.
alltypes

Calculate Statistic for All Types in a Multitype Point Pattern
Saturated

Saturated Pairwise Interaction model
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
Kcross

Multitype K Function (Cross-type)
Pairwise

Generic Pairwise Interaction model
Gcross

Multitype Nearest Neighbour Distance Function (i-to-j)
angles.psp

Orientation Angles of Line Segments
im

Create a Pixel Image Object
crossdist.ppp

Pairwise distances between two different point patterns
Kest

K-function
affine.ppp

Apply Affine Transformation To Point Pattern
copper

Berman-Huntington points and lines data
Geyer

Geyer's Saturation Point Process Model
OrdThresh

Ord's Interaction model
affine.psp

Apply Affine Transformation To Line Segment Pattern
bdist.points

Distance to Boundary of Window
expand.owin

Expand Window By Factor
bounding.box

Bounding Box of a Window
fv.object

Data Frames of Function Values
as.im

Convert to Pixel Image
erode.owin

Erode a Window
Kmeasure

Reduced Second Moment Measure
demopat

Artificial Data Point Pattern
plot.im

Plot a Pixel Image
rMaternII

Simulate Matern Model II
owin

Create a Window
endpoints.psp

Endpoints of Line Segment Pattern
append.psp

Combine Two Line Segment Patterns
as.matrix.im

Convert Pixel Image to Matrix
quadscheme

Generate a Quadrature Scheme from a Point Pattern
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
eval.fv

Evaluate Expression Involving Functions
pairwise.family

Pairwise Interaction Process Family
is.subset.owin

Determine Whether One Window is Contained In Another
centroid.owin

Centroid of a window
hist.im

Histogram of Pixel Values in an Image
plot.owin

Plot a Spatial Window
Poisson

Poisson Point Process Model
letterR

Window in Shape of Letter R
owin.object

Class owin
rThomas

Simulate Thomas Process
chorley

Chorley-Ribble Cancer Data
pairdist.default

Pairwise distances
predict.ppm

Prediction from a Fitted Point Process Model
cells

Biological Cells Point Pattern
ripras

Estimate window from points alone
shift.ppp

Apply Vector Translation To Point Pattern
quantile.im

Sample Quantiles of Pixel Image
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
envelope

Simulation envelopes of summary function
multiplicity.ppp

Count Multiplicity of Duplicate Points
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
spatstat

The Spatstat Package
data.ppm

Extract Original Data from a Fitted Point Process Model
crossdist

Pairwise distances
rpoint

Generate N Random Points
gridcentres

Rectangular grid of points
MultiStrauss

The Multitype Strauss Point Process Model
pcf

Pair Correlation Function
simdat

Simulated Point Pattern
plot.plotppm

Plot a plotppm Object Created by plot.ppm
print.ppp

Print Brief Details of a Point Pattern Dataset
density.ppp

Kernel Smoothed Intensity of Point Pattern
harmonic

Basis for Harmonic Functions
pppdist

Optimal Match Between Two Point Patterns
print.owin

Print Brief Details of a Spatial Window
square

Square Window
spatstat-deprecated

Deprecated spatstat functions
complement.owin

Take Complement of a Window
density.psp

Kernel Smoothing of Line Segment Pattern
rotate.owin

Rotate a Window
eval.im

Evaluate Expression Involving Pixel Images
Gest

Nearest Neighbour Distance Function G
Kinhom

Inhomogeneous K-function
rotate.psp

Rotate a Line Segment Pattern
pairdist.ppp

Pairwise distances
selfcrossing.psp

Crossing Points in a Line Segment Pattern
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
lengths.psp

Lengths of Line Segments
rotate.ppp

Rotate a Point Pattern
Gdot

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

Extract Subset of Function Array
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
levelset

Level Set of a Pixel Image
identify.ppp

Identify Points in a Point Pattern
is.owin

Test Whether An Object Is A Window
bdist.pixels

Distance to Boundary of Window
rshift

Random Shift
nztrees

New Zealand Trees Point Pattern
pairdist

Pairwise distances
rmh.default

Simulate Point Process Models using the Metropolis-Hastings Algorithm.
as.psp

Convert Data To Class psp
affine.owin

Apply Affine Transformation To Window
pcf.ppp

Pair Correlation Function of Point Pattern
is.ppm

Test Whether An Object Is A Fitted Point Process Model
rthin

Random Thinning
markcorr

Mark Correlation Function
shift.psp

Apply Vector Translation To Line Segment Pattern
compatible.im

Test Whether Two Pixel Images Are Compatible
rstrat

Simulate Stratified Random Point Pattern
crossdist.psp

Pairwise distances between two different line segment patterns
mean.im

Mean Pixel Value in an Image
print.im

Print Brief Details of an Image
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
shift.owin

Apply Vector Translation To Window
rmh.ppm

Simulate from a Fitted Point Process Model
cut.ppp

Convert Point Pattern Marks from Numeric to Factor
area.owin

Area of a Window
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
as.ppp

Convert Data To Class ppp
eem

Exponential Energy Marks
is.marked

Test Whether Marks Are Present
cut.im

Convert Pixel Image from Numeric to Factor
ganglia

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

Intersection or Union of Two Windows
hamster

Aherne's hamster tumour data
is.marked.ppp

Test Whether A Point Pattern is Marked
Gmulti

Marked Nearest Neighbour Distance Function
Kdot

Multitype K Function (i-to-any)
ord.family

Ord Interaction Process Family
Kest.fft

K-function using FFT
pairdist.psp

Pairwise distances between line segments
Ord

Generic Ord Interaction model
amacrine

Hughes' Amacrine Cell Data
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
as.mask

Pixel Image Approximation of a Window
plot.psp

plot a Spatial Line Segment Pattern
psp

Create a Line Segment Pattern
nndist

Nearest neighbour distances
as.rectangle

Window Frame
ppp

Create a Point Pattern
bramblecanes

Hutchings' Bramble Canes data
quadratcount

Quadrat counting for a point pattern
residuals.ppm

Residuals for Fitted Point Process Model
unique.ppp

Extract Unique Points from a Spatial Point Pattern
rNeymanScott

Simulate Neyman-Scott Process
summary.im

Summarizing a Pixel Image
setcov

Set Covariance of a Window
rcell

Simulate Baddeley-Silverman Cell Process
nnwhich

Nearest neighbour
crossdist.default

Pairwise distances between two different sets of points
finpines

Pine saplings in Finland.
is.ppp

Test Whether An Object Is A Point Pattern
ppp.object

Class of Point Patterns
nearest.raster.point

Find Pixel Nearest to a Given Point
rpoisline

Generate Poisson Random Line Process
rMatClust

Simulate Matern Cluster Process
mincontrast

Method of Minimum Contrast
spatstat.options

Internal Options in Spatstat Package
shift

Apply Vector Translation
subset.ppp

Extract or Replace Subset of Point Pattern
rpoispp

Generate Poisson Point Pattern
crossing.psp

Crossing Points of Two Line Segment Patterns
fasp.object

Function Arrays for Spatial Patterns
is.im

Test Whether An Object Is A Pixel Image
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
coef.ppm

Coefficients of Fitted Point Process Model
concatxy

Concatenate x,y Coordinate Vectors
gridweights

Compute Quadrature Weights Based on Grid Counts
distmap

Distance Map
ppm

Fit Point Process Model to Data
rMaternI

Simulate Matern Model I
superimpose

Superimpose Several Point Patterns
reduced.sample

Reduced Sample Estimator using Histogram Data
summary.quad

Summarizing a Quadrature Scheme
midpoints.psp

Midpoints of Line Segment Pattern
union.quad

Union of Data and Dummy Points
setmarks

Set or Reset the Marks in a Point Pattern
persp.im

Perspective Plot of Pixel Image
summary.psp

Summary of a Line Segment Pattern Dataset
redwood

California Redwoods Point Pattern (Ripley's Subset)
runifpoint

Generate N Uniform Random Points
summary.ppm

Summarizing a Fitted Point Process Model
rshift.psp

Randomly Shift a Line Segment Pattern
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
shift.im

Apply Vector Translation To Pixel Image
subset.fv

Extract Subset of Function Values
split.ppp

Divide Point Pattern into Sub-patterns
Jcross

Multitype J Function (i-to-j)
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
unmark

Remove Marks from a Marked Point Pattern
distmap.owin

Distance Map of Window
im.object

Class of Images
lgcp.estK

Fit a Log-Gaussian Cox Point Process by Minimum Contrast
print.ppm

Print a Fitted Point Process Model
psp.object

Class of Line Segment Patterns
rStrauss

Perfect Simulation of the Strauss Process
print.quad

Print a Quadrature Scheme
scanpp

Read Point Pattern From Data File
suffstat

Sufficient Statistic of Point Process Model
spruces

Spruces Point Pattern
rsyst

Simulate systematic random point pattern
update.ppm

Update a Fitted Point Process Model
subset.psp

Extract Subset of Line Segment Pattern
Kmulti

Marked K-Function
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
StraussHard

The Strauss / Hard Core Point Process Model
inside.owin

Test Whether Points Are Inside A Window
lurking

Lurking variable plot
plot.fv

Plot Function Valuesn
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
eroded.areas

Areas of Morphological Erosions
Jmulti

Marked J Function
fitted.ppm

Fitted Conditional Intensity for Point Process Model
is.marked.ppm

Test Whether A Point Process Model is Marked
nncross

Nearest Neighbour in Another Point Pattern
plot.quad

plot a Spatial Quadrature Scheme
plot.ppp

plot a Spatial Point Pattern
profilepl

Profile Maximum Pseudolikelihood
quad.object

Class of Quadrature Schemes
rmpoint

Generate N Random Multitype Points
lansing

Lansing Woods Point Pattern
spokes

Spokes pattern of dummy points
rescue.rectangle

Convert Window Back To Rectangle
affine

Apply Affine Transformation
as.owin

Convert Data To Class owin
default.dummy

Generate a Default Pattern of Dummy Points
clickppp

Interactively Add Points
compatible.fv

Test Whether Two Function Objects Are Compatible
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
dilate.owin

Dilate a Window
bei

Tropical rain forest trees
diameter

Diameter of a Window Frame
print.psp

Print Brief Details of a Line Segment Pattern Dataset
distmap.ppp

Distance Map of Point Pattern
Kcross.inhom

Inhomogeneous Cross K Function
Kdot.inhom

Inhomogeneous Multitype K Dot Function
Strauss

The Strauss Point Process Model
summary.ppp

Summary of a Point Pattern Dataset
rshift.splitppp

Randomly Shift a List of Point Patterns
ppm.object

Class of Fitted Point Process Models
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
rSSI

Simulate Simple Sequential Inhibition
plot.fasp

Plot a Function Array
pairsat.family

Saturated Pairwise Interaction Point Process Family
pcf.fv

Pair Correlation Function obtained from K Function
plot.ppm

plot a Fitted Point Process Model
japanesepines

Japanese Pines Point Pattern
raster.x

Cartesian Coordinates for a Pixel Raster
spatstat-internal

Internal spatstat functions
longleaf

Longleaf Pines Point Pattern
rshift.ppp

Randomly Shift a Point Pattern
quadrat.test

Chi-Squared Dispersion Test for Spatial Point Pattern Based on Quadrat Counts
qqplot.ppm

Q-Q Plot of Residuals from Fitted Point Process Model
distmap.psp

Distance Map of Line Segment Pattern
rmpoispp

Generate Multitype Poisson Point Pattern
plot.splitppp

Plot a List of Point Patterns
swedishpines

Swedish Pines Point Pattern
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
rlabel

Random Re-Labelling of Point Pattern
summary.owin

Summary of a Spatial Window
subset.im

Extract Subset of Image
solutionset

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

California Redwoods Point Pattern (Entire Dataset)
rotate

Rotate
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
pcf.fasp

Pair Correlation Function obtained from array of K functions
reach

Interaction Distance of a Point Process