Learn R Programming

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

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

17,668

Version

1.10-2

License

GPL version 2 or newer

Maintainer

Adrian Baddeley

Last Published

March 22nd, 2025

Functions in spatstat (1.10-2)

compatible.fv

Test Whether Two Function Objects Are Compatible
data.ppm

Extract Original Data from a Fitted Point Process Model
density.psp

Kernel Smoothing of Line Segment Pattern
chorley

Chorley-Ribble Cancer Data
distmap.psp

Distance Map of Line Segment Pattern
is.multitype.ppm

Test Whether A Point Process Model is Multitype
lansing

Lansing Woods Point Pattern
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
plot.splitppp

Plot a List of Point Patterns
quadratcount

Quadrat counting for a point pattern
redwood

California Redwoods Point Pattern (Ripley's Subset)
rotate

Rotate
subset.im

Extract Subset of Image
spatstat

The Spatstat Package
spokes

Spokes pattern of dummy points
unique.ppp

Extract Unique Points from a Spatial Point Pattern
MultiStrauss

The Multitype Strauss Point Process Model
alltypes

Calculate Statistic for All Types in a Multitype Point Pattern
area.owin

Area of a Window
crossing.psp

Crossing Points of Two Line Segment Patterns
envelope

Simulation envelopes of summary function
cut.ppp

Convert Point Pattern Marks from Numeric to Factor
is.im

Test Whether An Object Is A Pixel Image
pairdist.default

Pairwise distances
rMaternII

Simulate Matern Model II
plot.owin

Plot a Spatial Window
selfcrossing.psp

Crossing Points in a Line Segment Pattern
harmonic

Basis for Harmonic Functions
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
rcell

Simulate Baddeley-Silverman Cell Process
affine.owin

Apply Affine Transformation To Window
rpoint

Generate N Random Points
summary.ppp

Summary of a Point Pattern Dataset
as.im

Convert to Pixel Image
quantile.im

Sample Quantiles of Pixel Image
pcf.fasp

Pair Correlation Function obtained from array of K functions
superimpose

Superimpose Several Point Patterns
Kmulti

Marked K-Function
StraussHard

The Strauss / Hard Core Point Process Model
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
profilepl

Profile Maximum Pseudolikelihood
psp.object

Class of Line Segment Patterns
quad.object

Class of Quadrature Schemes
rshift.splitppp

Randomly Shift a List of Point Patterns
runifpoint

Generate N Uniform Random Points
pairdist.ppp

Pairwise distances
rshift.ppp

Randomly Shift a Point Pattern
ppp.object

Class of Point Patterns
summary.quad

Summarizing a Quadrature Scheme
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
as.ppp

Convert Data To Class ppp
coef.ppm

Coefficients of Fitted Point Process Model
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
distmap.owin

Distance Map of Window
Gdot

Multitype Nearest Neighbour Distance Function (i-to-any)
affine.ppp

Apply Affine Transformation To Point Pattern
is.marked

Test Whether Marks Are Present
Kest

K-function
betacells

Beta Ganglion Cells in Cat Retina
complement.owin

Take Complement of a Window
nnwhich

Nearest neighbour
eem

Exponential Energy Marks
spatstat-internal

Internal spatstat functions
lengths.psp

Lengths of Line Segments
crossdist.psp

Pairwise distances between two different line segment patterns
levelset

Level Set of a Pixel Image
density.ppp

Kernel Smoothed Intensity of Point Pattern
Jdot

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

Print Brief Details of a Point Pattern Dataset
lgcp.estK

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

Generate a Quadrature Scheme from a Point Pattern
Kmeasure

Reduced Second Moment Measure
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
letterR

Window in Shape of Letter R
runifdisc

Generate N Uniform Random Points in a Disc
crossdist.ppp

Pairwise distances between two different point patterns
shift.im

Apply Vector Translation To Pixel Image
anova.ppm

ANOVA for Fitted Point Process Models
japanesepines

Japanese Pines Point Pattern
demopat

Artificial Data Point Pattern
lurking

Lurking variable plot
subset.fasp

Extract Subset of Function Array
pairdist.psp

Pairwise distances between line segments
Saturated

Saturated Pairwise Interaction model
rMaternI

Simulate Matern Model I
rpoispp

Generate Poisson Point Pattern
append.psp

Combine Two Line Segment Patterns
swedishpines

Swedish Pines Point Pattern
as.matrix.im

Convert Pixel Image to Matrix
subset.ppp

Extract or Replace Subset of Point Pattern
bei

Tropical rain forest trees
rThomas

Simulate Thomas Process
suffstat

Sufficient Statistic of Point Process Model
rstrat

Simulate Stratified Random Point Pattern
spatstat-deprecated

Deprecated spatstat functions
expand.owin

Expand Window By Factor
Iest

Estimate the I-function
dilate.owin

Dilate a Window
Softcore

The Soft Core Point Process Model
Kest.fft

K-function using FFT
identify.ppp

Identify Points in a Point Pattern
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
midpoints.psp

Midpoints of Line Segment Pattern
Strauss

The Strauss Point Process Model
summary.psp

Summary of a Line Segment Pattern Dataset
Jcross

Multitype J Function (i-to-j)
print.ppm

Print a Fitted Point Process Model
square

Square Window
shift

Apply Vector Translation
trim.rectangle

Cut margins from rectangle
rmh.default

Simulate Point Process Models using the Metropolis-Hastings Algorithm.
pcf.fv

Pair Correlation Function obtained from K Function
crossdist.default

Pairwise distances between two different sets of points
fv.object

Data Frames of Function Values
unmark

Remove Marks from a Marked Point Pattern
plot.fasp

Plot a Function Array
ord.family

Ord Interaction Process Family
qqplot.ppm

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

Determine Initial State for Metropolis-Hastings Simulation.
print.psp

Print Brief Details of a Line Segment Pattern Dataset
raster.x

Cartesian Coordinates for a Pixel Raster
shift.psp

Apply Vector Translation To Line Segment Pattern
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
pppdist

Optimal Match Between Two Point Patterns
shift.ppp

Apply Vector Translation To Point Pattern
rotate.psp

Rotate a Line Segment Pattern
clickppp

Interactively Add Points
summary.owin

Summary of a Spatial Window
summary.ppm

Summarizing a Fitted Point Process Model
copper

Berman-Huntington points and lines data
subset.fv

Extract Subset of Function Values
distmap

Distance Map
rNeymanScott

Simulate Neyman-Scott Process
diameter

Diameter of a Window Frame
eval.fv

Evaluate Expression Involving Functions
intersect.owin

Intersection or Union of Two Windows
Kdot.inhom

Inhomogeneous Multitype K Dot Function
matclust.estK

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

plot a Spatial Point Pattern
print.owin

Print Brief Details of a Spatial Window
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
Kcross

Multitype K Function (Cross-type)
as.mask

Pixel Image Approximation of a Window
LennardJones

The Lennard-Jones Potential
crossdist

Pairwise distances
default.dummy

Generate a Default Pattern of Dummy Points
gridcentres

Rectangular grid of points
fasp.object

Function Arrays for Spatial Patterns
is.ppp

Test Whether An Object Is A Point Pattern
Jest

Estimate the J-function
Poisson

Poisson Point Process Model
nearest.raster.point

Find Pixel Nearest to a Given Point
bramblecanes

Hutchings' Bramble Canes data
nztrees

New Zealand Trees Point Pattern
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
rsyst

Simulate systematic random point pattern
is.marked.ppp

Test Whether A Point Pattern is Marked
is.ppm

Test Whether An Object Is A Fitted Point Process Model
is.multitype.ppp

Test Whether A Point Pattern is Multitype
mean.im

Mean Pixel Value in an Image
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
ppp

Create a Point Pattern
scanpp

Read Point Pattern From Data File
ripras

Estimate window from points alone
shift.owin

Apply Vector Translation To Window
solutionset

Evaluate Logical Expression Involving Pixel Images and Return Region Where Expression is True
summary.im

Summarizing a Pixel Image
setcov

Set Covariance of a Window
Ord

Generic Ord Interaction model
as.psp

Convert Data To Class psp
corners

Corners of a rectangle
allstats

Calculate four standard summary functions of a point pattern.
as.owin

Convert Data To Class owin
contour.im

Contour plot of pixel image
concatxy

Concatenate x,y Coordinate Vectors
bdist.points

Distance to Boundary of Window
bdist.pixels

Distance to Boundary of Window
eroded.areas

Areas of Morphological Erosions
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
print.im

Print Brief Details of an Image
gridweights

Compute Quadrature Weights Based on Grid Counts
plot.quad

plot a Spatial Quadrature Scheme
pcf

Pair Correlation Function
ppm

Fit Point Process Model to Data
setmarks

Set or Reset the Marks in a Point Pattern
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
reduced.sample

Reduced Sample Estimator using Histogram Data
rotate.owin

Rotate a Window
Gest

Nearest Neighbour Distance Function G
Gcross

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

Harkness-Isham ants' nests data
hamster

Aherne's hamster tumour data
plot.im

Plot a Pixel Image
plot.listof

Plot a List of Things
rlabel

Random Re-Labelling of Point Pattern
pairwise.family

Pairwise Interaction Process Family
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
rotate.ppp

Rotate a Point Pattern
rmpoispp

Generate Multitype Poisson Point Pattern
split.ppp

Divide Point Pattern into Sub-patterns
update.ppm

Update a Fitted Point Process Model
Jmulti

Marked J Function
Pairwise

Generic Pairwise Interaction model
bounding.box

Bounding Box of a Window
cells

Biological Cells Point Pattern
is.subset.owin

Determine Whether One Window is Contained In Another
as.rectangle

Window Frame
owin.object

Class owin
predict.ppm

Prediction from a Fitted Point Process Model
Fest

Estimate the empty space function F
OrdThresh

Ord's Interaction model
angles.psp

Orientation Angles of Line Segments
cut.im

Convert Pixel Image from Numeric to Factor
endpoints.psp

Endpoints of Line Segment Pattern
eval.im

Evaluate Expression Involving Pixel Images
owin

Create a Window
plot.psp

plot a Spatial Line Segment Pattern
plot.ppm

plot a Fitted Point Process Model
print.quad

Print a Quadrature Scheme
spruces

Spruces Point Pattern
Gmulti

Marked Nearest Neighbour Distance Function
amacrine

Hughes' Amacrine Cell Data
disc

Circular Window
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
inside.owin

Test Whether Points Are Inside A Window
is.multitype

Test whether Object is Multitype
markcorr

Mark Correlation Function
nndist

Nearest neighbour distances
mincontrast

Method of Minimum Contrast
pairsat.family

Saturated Pairwise Interaction Point Process Family
quadrat.test

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

Class of Fitted Point Process Models
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
residuals.ppm

Residuals for Fitted Point Process Model
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
DiggleGratton

Diggle-Gratton model
affine

Apply Affine Transformation
finpines

Pine saplings in Finland.
hist.im

Histogram of Pixel Values in an Image
is.owin

Test Whether An Object Is A Window
rStrauss

Perfect Simulation of the Strauss Process
pairdist

Pairwise distances
rescue.rectangle

Convert Window Back To Rectangle
rshift.psp

Randomly Shift a Line Segment Pattern
rshift

Random Shift
Kdot

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

Distance Map of Point Pattern
Kinhom

Inhomogeneous K-function
im

Create a Pixel Image Object
is.marked.ppm

Test Whether A Point Process Model is Marked
rMatClust

Simulate Matern Cluster Process
reach

Interaction Distance of a Point Process
rmh.ppm

Simulate from a Fitted Point Process Model
rmpoint

Generate N Random Multitype Points
rthin

Random Thinning
units

Name for Unit of Length
Geyer

Geyer's Saturation Point Process Model
Kcross.inhom

Inhomogeneous Cross K Function
MultiStraussHard

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

Test Whether Two Pixel Images Are Compatible
erode.owin

Erode a Window
fitted.ppm

Fitted Conditional Intensity for Point Process Model
multiplicity.ppp

Count Multiplicity of Duplicate Points
longleaf

Longleaf Pines Point Pattern
plot.fv

Plot Function Valuesn
psp

Create a Line Segment Pattern
im.object

Class of Images
rSSI

Simulate Simple Sequential Inhibition
rpoisline

Generate Poisson Random Line Process
spatstat.options

Internal Options in Spatstat Package
vcov.ppm

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

Union of Data and Dummy Points
simdat

Simulated Point Pattern
subset.psp

Extract Subset of Line Segment Pattern
affine.psp

Apply Affine Transformation To Line Segment Pattern
centroid.owin

Centroid of a window
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
nncross

Nearest Neighbour in Another Point Pattern
persp.im

Perspective Plot of Pixel Image
rmhmodel

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

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

Pair Correlation Function of Point Pattern