Learn R Programming

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

spatstat (version 1.11-1)

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,590

Version

1.11-1

License

GPL version 2 or newer

Maintainer

Adrian Baddeley

Last Published

March 22nd, 2025

Functions in spatstat (1.11-1)

applynbd

Apply Function to Every Neighbourhood in a Point Pattern
complement.owin

Take Complement of a Window
Kmeasure

Reduced Second Moment Measure
erode.owin

Erode a Window
crossdist

Pairwise distances
spatstat

The Spatstat Package
Kmulti

Marked K-Function
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
as.ppp

Convert Data To Class ppp
density.psp

Kernel Smoothing of Line Segment Pattern
cells

Biological Cells Point Pattern
Kcross.inhom

Inhomogeneous Cross K Function
gridcentres

Rectangular grid of points
identify.ppp

Identify Points in a Point Pattern
compatible.im

Test Whether Two Pixel Images Are Compatible
Kcross

Multitype K Function (Cross-type)
Geyer

Geyer's Saturation Point Process Model
Kest.fft

K-function using FFT
cut.ppp

Convert Point Pattern Marks from Numeric to Factor
mean.im

Mean Pixel Value in an Image
distmap.ppp

Distance Map of Point Pattern
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
Kinhom

Inhomogeneous K-function
concatxy

Concatenate x,y Coordinate Vectors
MultiStrauss

The Multitype Strauss Point Process Model
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
is.owin

Test Whether An Object Is A Window
Gmulti

Marked Nearest Neighbour Distance Function
disc

Circular Window
pcf.fv

Pair Correlation Function obtained from K Function
mincontrast

Method of Minimum Contrast
density.ppp

Kernel Smoothed Intensity of Point Pattern
pairdist.default

Pairwise distances
Strauss

The Strauss Point Process Model
envelope

Simulation envelopes of summary function
print.owin

Print Brief Details of a Spatial Window
Jmulti

Marked J Function
Fest

Estimate the empty space function F
chorley

Chorley-Ribble Cancer Data
rStrauss

Perfect Simulation of the Strauss Process
as.matrix.im

Convert Pixel Image to Matrix
is.multitype.ppp

Test Whether A Point Pattern is Multitype
Softcore

The Soft Core Point Process Model
pcf

Pair Correlation Function
endpoints.psp

Endpoints of Line Segment Pattern
as.mask

Pixel Image Approximation of a Window
gridweights

Compute Quadrature Weights Based on Grid Counts
rescale.ppp

Convert Point Pattern to Another Unit of Length
finpines

Pine saplings in Finland.
qqplot.ppm

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

Ord's Interaction model
print.ppp

Print Brief Details of a Point Pattern Dataset
harmonic

Basis for Harmonic Functions
clickppp

Interactively Add Points
bramblecanes

Hutchings' Bramble Canes data
im

Create a Pixel Image Object
ants

Harkness-Isham ants' nests data
Iest

Estimate the I-function
affine.owin

Apply Affine Transformation To Window
as.psp

Convert Data To Class psp
Jest

Estimate the J-function
distmap

Distance Map
bdist.pixels

Distance to Boundary of Window
StraussHard

The Strauss / Hard Core Point Process Model
hist.im

Histogram of Pixel Values in an Image
amacrine

Hughes' Amacrine Cell Data
rescale.owin

Convert Window to Another Unit of Length
pairsat.family

Saturated Pairwise Interaction Point Process Family
inside.owin

Test Whether Points Are Inside A Window
lgcp.estK

Fit a Log-Gaussian Cox Point Process by Minimum Contrast
distmap.psp

Distance Map of Line Segment Pattern
betacells

Beta Ganglion Cells in Cat Retina
bei

Tropical rain forest trees
is.marked.ppp

Test Whether A Point Pattern is Marked
pcf.fasp

Pair Correlation Function obtained from array of K functions
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
pairdist.psp

Pairwise distances between line segments
ppm

Fit Point Process Model to Data
is.marked.ppm

Test Whether A Point Process Model is Marked
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
Poisson

Poisson Point Process Model
longleaf

Longleaf Pines Point Pattern
demopat

Artificial Data Point Pattern
plot.ppm

plot a Fitted Point Process Model
crossdist.default

Pairwise distances between two different sets of points
rshift.ppp

Randomly Shift a Point Pattern
subset.fasp

Extract Subset of Function Array
rcell

Simulate Baddeley-Silverman Cell Process
lansing

Lansing Woods Point Pattern
midpoints.psp

Midpoints of Line Segment Pattern
ripras

Estimate window from points alone
psp

Create a Line Segment Pattern
data.ppm

Extract Original Data from a Fitted Point Process Model
subset.ppp

Extract or Replace Subset of Point Pattern
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
summary.quad

Summarizing a Quadrature Scheme
plot.quad

plot a Spatial Quadrature Scheme
runifpoint

Generate N Uniform Random Points
is.ppm

Test Whether An Object Is A Fitted Point Process Model
markcorr

Mark Correlation Function
im.object

Class of Images
nearest.raster.point

Find Pixel Nearest to a Given Point
plot.plotppm

Plot a plotppm Object Created by plot.ppm
Jcross

Multitype J Function (i-to-j)
pppdist

Optimal Match Between Two Point Patterns
runifdisc

Generate N Uniform Random Points in a Disc
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
eval.im

Evaluate Expression Involving Pixel Images
rmh.default

Simulate Point Process Models using the Metropolis-Hastings Algorithm.
summary.splitppp

Summary of a Split Point Pattern
ppp.object

Class of Point Patterns
Pairwise

Generic Pairwise Interaction model
intersect.owin

Intersection or Union of Two Windows
crossdist.ppp

Pairwise distances between two different point patterns
subset.im

Extract Subset of Image
rshift

Random Shift
rescale

Convert dataset to another unit of length
fasp.object

Function Arrays for Spatial Patterns
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
hamster

Aherne's hamster tumour data
summary.owin

Summary of a Spatial Window
rmhmodel

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

Test Whether Marks Are Present
is.ppp

Test Whether An Object Is A Point Pattern
selfcrossing.psp

Crossing Points in a Line Segment Pattern
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
nztrees

New Zealand Trees Point Pattern
print.psp

Print Brief Details of a Line Segment Pattern Dataset
ord.family

Ord Interaction Process Family
angles.psp

Orientation Angles of Line Segments
shift.im

Apply Vector Translation To Pixel Image
rshift.psp

Randomly Shift a Line Segment Pattern
rstrat

Simulate Stratified Random Point Pattern
print.quad

Print a Quadrature Scheme
levelset

Level Set of a Pixel Image
shift.ppp

Apply Vector Translation To Point Pattern
subset.splitppp

Extract or Replace Sub-Patterns
shift

Apply Vector Translation
unique.ppp

Extract Unique Points from a Spatial Point Pattern
trim.rectangle

Cut margins from rectangle
superimpose

Superimpose Several Point Patterns
rsyst

Simulate systematic random point pattern
fv.object

Data Frames of Function Values
affine

Apply Affine Transformation
letterR

Window in Shape of Letter R
nbfires

Point Patterns of New Brunswick Forest Fires
update.ppm

Update a Fitted Point Process Model
Ord

Generic Ord Interaction model
rmpoispp

Generate Multitype Poisson Point Pattern
DiggleGratton

Diggle-Gratton model
spatstat-internal

Internal spatstat functions
centroid.owin

Centroid of a window
spatstat.options

Internal Options in Spatstat Package
is.multitype.ppm

Test Whether A Point Process Model is Multitype
summary.ppm

Summarizing a Fitted Point Process Model
plot.fasp

Plot a Function Array
square

Square Window
bounding.box

Bounding Box of a Window
Gdot

Multitype Nearest Neighbour Distance Function (i-to-any)
plot.owin

Plot a Spatial Window
LennardJones

The Lennard-Jones Potential
nndist

Nearest neighbour distances
as.rectangle

Window Frame
crossing.psp

Crossing Points of Two Line Segment Patterns
compatible.fv

Test Whether Two Function Objects Are Compatible
units

Name for Unit of Length
nncross

Nearest Neighbour in Another Point Pattern
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
ppm.object

Class of Fitted Point Process Models
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
ppp

Create a Point Pattern
corners

Corners of a rectangle
copper

Berman-Huntington points and lines data
print.im

Print Brief Details of an Image
fitted.ppm

Fitted Conditional Intensity for Point Process Model
Kest

K-function
quadrat.test

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

Calculate four standard summary functions of a point pattern.
psp.object

Class of Line Segment Patterns
area.owin

Area of a Window
owin.object

Class owin
reduced.sample

Reduced Sample Estimator using Histogram Data
rotate.psp

Rotate a Line Segment Pattern
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
diameter

Diameter of a Window
summary.psp

Summary of a Line Segment Pattern Dataset
rpoint

Generate N Random Points
rotate.ppp

Rotate a Point Pattern
persp.im

Perspective Plot of Pixel Image
spruces

Spruces Point Pattern
plot.fv

Plot Function Valuesn
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
plot.ppp

plot a Spatial Point Pattern
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
japanesepines

Japanese Pines Point Pattern
solutionset

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

Residuals for Fitted Point Process Model
rlabel

Random Re-Labelling of Point Pattern
reach

Interaction Distance of a Point Process
rpoisline

Generate Poisson Random Line Process
raster.x

Cartesian Coordinates for a Pixel Raster
Saturated

Saturated Pairwise Interaction model
rmpoint

Generate N Random Multitype Points
rpoispp

Generate Poisson Point Pattern
as.im

Convert to Pixel Image
default.dummy

Generate a Default Pattern of Dummy Points
suffstat

Sufficient Statistic of Point Process Model
bdist.points

Distance to Boundary of Window
expand.owin

Expand Window By Factor
lurking

Lurking variable plot
is.subset.owin

Determine Whether One Window is Contained In Another
predict.ppm

Prediction from a Fitted Point Process Model
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
redwood

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

Summary of a List of Things
contour.im

Contour plot of pixel image
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
is.im

Test Whether An Object Is A Pixel Image
is.multitype

Test whether Object is Multitype
pairdist

Pairwise distances
owin

Create a Window
plot.splitppp

Plot a List of Point Patterns
quadratcount

Quadrat counting for a point pattern
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
rotate

Rotate
scanpp

Read Point Pattern From Data File
subset.fv

Extract Subset of Function Values
vertices

Vertices of a Window
Jdot

Multitype J Function (i-to-any)
eroded.areas

Areas of Morphological Erosions
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
lengths.psp

Lengths of Line Segments
pairwise.family

Pairwise Interaction Process Family
rSSI

Simulate Simple Sequential Inhibition
print.ppm

Print a Fitted Point Process Model
rotate.owin

Rotate a Window
shift.owin

Apply Vector Translation To Window
setmarks

Set or Reset the Marks in a Point Pattern
affine.psp

Apply Affine Transformation To Line Segment Pattern
affine.ppp

Apply Affine Transformation To Point Pattern
Kdot.inhom

Inhomogeneous Multitype K Dot Function
Gcross

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

Pairwise distances between two different line segment patterns
Kdot

Multitype K Function (i-to-any)
cut.im

Convert Pixel Image from Numeric to Factor
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
eem

Exponential Energy Marks
anova.ppm

ANOVA for Fitted Point Process Models
distmap.owin

Distance Map of Window
as.owin

Convert Data To Class owin
multiplicity.ppp

Count Multiplicity of Duplicate Points
dilate.owin

Dilate a Window
rMatClust

Simulate Matern Cluster Process
rshift.splitppp

Randomly Shift a List of Point Patterns
rescue.rectangle

Convert Window Back To Rectangle
subset.psp

Extract Subset of Line Segment Pattern
swedishpines

Swedish Pines Point Pattern
setcov

Set Covariance of a Window
quantile.im

Sample Quantiles of Pixel Image
rMaternII

Simulate Matern Model II
rthin

Random Thinning
subset.listof

Extract or Replace Subset of a List of Things
Gest

Nearest Neighbour Distance Function G
append.psp

Combine Two Line Segment Patterns
alltypes

Calculate Statistic for All Types in a Multitype Point Pattern
spatstat-deprecated

Deprecated spatstat functions
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
nnwhich

Nearest neighbour
plot.psp

plot a Spatial Line Segment Pattern
plot.listof

Plot a List of Things
rNeymanScott

Simulate Neyman-Scott Process
quadscheme

Generate a Quadrature Scheme from a Point Pattern
rmhcontrol

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

Apply Vector Translation To Line Segment Pattern
vcov.ppm

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

Summary of a Point Pattern Dataset
unmark

Remove Marks from a Marked Point Pattern
union.quad

Union of Data and Dummy Points
rmh.ppm

Simulate from a Fitted Point Process Model
coef.ppm

Coefficients of Fitted Point Process Model
eval.fv

Evaluate Expression Involving Functions
pairdist.ppp

Pairwise distances
plot.im

Plot a Pixel Image
pcf.ppp

Pair Correlation Function of Point Pattern
profilepl

Profile Maximum Pseudolikelihood
quad.object

Class of Quadrature Schemes
rThomas

Simulate Thomas Process
rMaternI

Simulate Matern Model I
progressreport

Print Progress Reports
spokes

Spokes pattern of dummy points
split.ppp

Divide Point Pattern into Sub-patterns
summary.im

Summarizing a Pixel Image
simdat

Simulated Point Pattern