Learn R Programming

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

spatstat (version 1.11-0)

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.11-0

License

GPL version 2 or newer

Maintainer

Adrian Baddeley

Last Published

March 22nd, 2025

Functions in spatstat (1.11-0)

Geyer

Geyer's Saturation Point Process Model
Gdot

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

Marked K-Function
Softcore

The Soft Core Point Process Model
default.dummy

Generate a Default Pattern of Dummy Points
Kcross

Multitype K Function (Cross-type)
Kdot.inhom

Inhomogeneous Multitype K Dot Function
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
alltypes

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

Apply Affine Transformation To Window
append.psp

Combine Two Line Segment Patterns
as.im

Convert to Pixel Image
as.matrix.im

Convert Pixel Image to Matrix
is.marked

Test Whether Marks Are Present
distmap.psp

Distance Map of Line Segment Pattern
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
clickppp

Interactively Add Points
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
compatible.fv

Test Whether Two Function Objects Are Compatible
is.marked.ppm

Test Whether A Point Process Model is Marked
is.multitype

Test whether Object is Multitype
angles.psp

Orientation Angles of Line Segments
as.rectangle

Window Frame
affine

Apply Affine Transformation
owin.object

Class owin
plot.ppm

plot a Fitted Point Process Model
centroid.owin

Centroid of a window
as.owin

Convert Data To Class owin
ppp

Create a Point Pattern
pppdist

Optimal Match Between Two Point Patterns
Kcross.inhom

Inhomogeneous Cross K Function
OrdThresh

Ord's Interaction model
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
quad.object

Class of Quadrature Schemes
plot.splitppp

Plot a List of Point Patterns
quadscheme

Generate a Quadrature Scheme from a Point Pattern
im.object

Class of Images
mean.im

Mean Pixel Value in an Image
rmhcontrol

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

Summary of a Line Segment Pattern Dataset
runifdisc

Generate N Uniform Random Points in a Disc
spatstat-internal

Internal spatstat functions
ants

Harkness-Isham ants' nests data
persp.im

Perspective Plot of Pixel Image
multiplicity.ppp

Count Multiplicity of Duplicate Points
coef.ppm

Coefficients of Fitted Point Process Model
rotate.owin

Rotate a Window
plot.im

Plot a Pixel Image
inside.owin

Test Whether Points Are Inside A Window
subset.psp

Extract Subset of Line Segment Pattern
dilate.owin

Dilate a Window
plot.plotppm

Plot a plotppm Object Created by plot.ppm
rotate.psp

Rotate a Line Segment Pattern
amacrine

Hughes' Amacrine Cell Data
bramblecanes

Hutchings' Bramble Canes data
subset.splitppp

Extract or Replace Sub-Patterns
eem

Exponential Energy Marks
crossdist.ppp

Pairwise distances between two different point patterns
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
setmarks

Set or Reset the Marks in a Point Pattern
im

Create a Pixel Image Object
is.owin

Test Whether An Object Is A Window
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
lurking

Lurking variable plot
profilepl

Profile Maximum Pseudolikelihood
DiggleGratton

Diggle-Gratton model
pairdist.psp

Pairwise distances between line segments
reduced.sample

Reduced Sample Estimator using Histogram Data
Kdot

Multitype K Function (i-to-any)
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
ppm

Fit Point Process Model to Data
gridcentres

Rectangular grid of points
rmpoint

Generate N Random Multitype Points
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
rshift.splitppp

Randomly Shift a List of Point Patterns
pcf.fasp

Pair Correlation Function obtained from array of K functions
crossdist

Pairwise distances
longleaf

Longleaf Pines Point Pattern
mincontrast

Method of Minimum Contrast
Saturated

Saturated Pairwise Interaction model
reach

Interaction Distance of a Point Process
plot.owin

Plot a Spatial Window
rlabel

Random Re-Labelling of Point Pattern
Jcross

Multitype J Function (i-to-j)
diameter

Diameter of a Window Frame
density.psp

Kernel Smoothing of Line Segment Pattern
plot.fv

Plot Function Valuesn
rNeymanScott

Simulate Neyman-Scott Process
rstrat

Simulate Stratified Random Point Pattern
square

Square Window
Kest

K-function
copper

Berman-Huntington points and lines data
crossing.psp

Crossing Points of Two Line Segment Patterns
shift.ppp

Apply Vector Translation To Point Pattern
pairdist.ppp

Pairwise distances
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
density.ppp

Kernel Smoothed Intensity of Point Pattern
summary.splitppp

Summary of a Split Point Pattern
summary.im

Summarizing a Pixel Image
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
subset.listof

Extract or Replace Subset of a List of Things
update.ppm

Update a Fitted Point Process Model
pairdist

Pairwise distances
pairsat.family

Saturated Pairwise Interaction Point Process Family
ord.family

Ord Interaction Process Family
compatible.im

Test Whether Two Pixel Images Are Compatible
subset.fasp

Extract Subset of Function Array
psp.object

Class of Line Segment Patterns
spatstat-deprecated

Deprecated spatstat functions
Fest

Estimate the empty space function F
summary.ppp

Summary of a Point Pattern Dataset
Strauss

The Strauss Point Process Model
Gmulti

Marked Nearest Neighbour Distance Function
is.ppm

Test Whether An Object Is A Fitted Point Process Model
eval.fv

Evaluate Expression Involving Functions
is.multitype.ppp

Test Whether A Point Pattern is Multitype
endpoints.psp

Endpoints of Line Segment Pattern
Jdot

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

Extract Original Data from a Fitted Point Process Model
is.marked.ppp

Test Whether A Point Pattern is Marked
is.ppp

Test Whether An Object Is A Point Pattern
rcell

Simulate Baddeley-Silverman Cell Process
expand.owin

Expand Window By Factor
levelset

Level Set of a Pixel Image
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
ripras

Estimate window from points alone
rshift

Random Shift
shift.owin

Apply Vector Translation To Window
plot.fasp

Plot a Function Array
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
Kmeasure

Reduced Second Moment Measure
allstats

Calculate four standard summary functions of a point pattern.
japanesepines

Japanese Pines Point Pattern
pcf.ppp

Pair Correlation Function of Point Pattern
cut.ppp

Convert Point Pattern Marks from Numeric to Factor
nztrees

New Zealand Trees Point Pattern
owin

Create a Window
psp

Create a Line Segment Pattern
rmh.ppm

Simulate from a Fitted Point Process Model
print.ppp

Print Brief Details of a Point Pattern Dataset
hist.im

Histogram of Pixel Values in an Image
pairwise.family

Pairwise Interaction Process Family
print.psp

Print Brief Details of a Line Segment Pattern Dataset
eroded.areas

Areas of Morphological Erosions
runifpoint

Generate N Uniform Random Points
bdist.points

Distance to Boundary of Window
subset.im

Extract Subset of Image
summary.quad

Summarizing a Quadrature Scheme
summary.listof

Summary of a List of Things
plot.psp

plot a Spatial Line Segment Pattern
finpines

Pine saplings in Finland.
ppp.object

Class of Point Patterns
harmonic

Basis for Harmonic Functions
superimpose

Superimpose Several Point Patterns
distmap

Distance Map
bei

Tropical rain forest trees
bdist.pixels

Distance to Boundary of Window
identify.ppp

Identify Points in a Point Pattern
rescale

Convert dataset to another unit of length
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
Gest

Nearest Neighbour Distance Function G
letterR

Window in Shape of Letter R
eval.im

Evaluate Expression Involving Pixel Images
Gcross

Multitype Nearest Neighbour Distance Function (i-to-j)
erode.owin

Erode a Window
shift.im

Apply Vector Translation To Pixel Image
Iest

Estimate the I-function
Jmulti

Marked J Function
print.quad

Print a Quadrature Scheme
shift

Apply Vector Translation
pcf.fv

Pair Correlation Function obtained from K Function
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
rMatClust

Simulate Matern Cluster Process
print.ppm

Print a Fitted Point Process Model
cells

Biological Cells Point Pattern
rSSI

Simulate Simple Sequential Inhibition
Kinhom

Inhomogeneous K-function
raster.x

Cartesian Coordinates for a Pixel Raster
LennardJones

The Lennard-Jones Potential
MultiStrauss

The Multitype Strauss Point Process Model
residuals.ppm

Residuals for Fitted Point Process Model
print.owin

Print Brief Details of a Spatial Window
affine.psp

Apply Affine Transformation To Line Segment Pattern
redwood

California Redwoods Point Pattern (Ripley's Subset)
Poisson

Poisson Point Process Model
rescue.rectangle

Convert Window Back To Rectangle
as.ppp

Convert Data To Class ppp
chorley

Chorley-Ribble Cancer Data
rsyst

Simulate systematic random point pattern
units

Name for Unit of Length
spatstat.options

Internal Options in Spatstat Package
summary.owin

Summary of a Spatial Window
betacells

Beta Ganglion Cells in Cat Retina
crossdist.psp

Pairwise distances between two different line segment patterns
is.subset.owin

Determine Whether One Window is Contained In Another
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
pcf

Pair Correlation Function
nndist

Nearest neighbour distances
markcorr

Mark Correlation Function
predict.ppm

Prediction from a Fitted Point Process Model
quantile.im

Sample Quantiles of Pixel Image
split.ppp

Divide Point Pattern into Sub-patterns
quadrat.test

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

Simulated Point Pattern
spruces

Spruces Point Pattern
scanpp

Read Point Pattern From Data File
rStrauss

Perfect Simulation of the Strauss Process
area.owin

Area of a Window
suffstat

Sufficient Statistic of Point Process Model
rpoisline

Generate Poisson Random Line Process
bounding.box

Bounding Box of a Window
vcov.ppm

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

plot a Spatial Quadrature Scheme
quadratcount

Quadrat counting for a point pattern
qqplot.ppm

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

Generate Multitype Poisson Point Pattern
rpoint

Generate N Random Points
rshift.ppp

Randomly Shift a Point Pattern
solutionset

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

Convert Pixel Image from Numeric to Factor
demopat

Artificial Data Point Pattern
distmap.ppp

Distance Map of Point Pattern
fasp.object

Function Arrays for Spatial Patterns
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
ppm.object

Class of Fitted Point Process Models
rmhstart

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

Rotate a Point Pattern
subset.ppp

Extract or Replace Subset of Point Pattern
Kest.fft

K-function using FFT
affine.ppp

Apply Affine Transformation To Point Pattern
crossdist.default

Pairwise distances between two different sets of points
spatstat

The Spatstat Package
Jest

Estimate the J-function
Pairwise

Generic Pairwise Interaction model
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
fitted.ppm

Fitted Conditional Intensity for Point Process Model
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
plot.ppp

plot a Spatial Point Pattern
summary.ppm

Summarizing a Fitted Point Process Model
rpoispp

Generate Poisson Point Pattern
hamster

Aherne's hamster tumour data
intersect.owin

Intersection or Union of Two Windows
lgcp.estK

Fit a Log-Gaussian Cox Point Process by Minimum Contrast
union.quad

Union of Data and Dummy Points
nncross

Nearest Neighbour in Another Point Pattern
plot.listof

Plot a List of Things
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
rThomas

Simulate Thomas Process
shift.psp

Apply Vector Translation To Line Segment Pattern
trim.rectangle

Cut margins from rectangle
Ord

Generic Ord Interaction model
disc

Circular Window
StraussHard

The Strauss / Hard Core Point Process Model
rthin

Random Thinning
selfcrossing.psp

Crossing Points in a Line Segment Pattern
subset.fv

Extract Subset of Function Values
spokes

Spokes pattern of dummy points
swedishpines

Swedish Pines Point Pattern
rMaternII

Simulate Matern Model II
as.mask

Pixel Image Approximation of a Window
applynbd

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

Take Complement of a Window
contour.im

Contour plot of pixel image
midpoints.psp

Midpoints of Line Segment Pattern
lengths.psp

Lengths of Line Segments
rescale.ppp

Convert Point Pattern to Another Unit of Length
rmh.default

Simulate Point Process Models using the Metropolis-Hastings Algorithm.
rotate

Rotate
unique.ppp

Extract Unique Points from a Spatial Point Pattern
unmark

Remove Marks from a Marked Point Pattern
anova.ppm

ANOVA for Fitted Point Process Models
corners

Corners of a rectangle
distmap.owin

Distance Map of Window
is.multitype.ppm

Test Whether A Point Process Model is Multitype
lansing

Lansing Woods Point Pattern
nnwhich

Nearest neighbour
nearest.raster.point

Find Pixel Nearest to a Given Point
print.im

Print Brief Details of an Image
rMaternI

Simulate Matern Model I
rescale.owin

Convert Window to Another Unit of Length
rshift.psp

Randomly Shift a Line Segment Pattern
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
as.psp

Convert Data To Class psp
concatxy

Concatenate x,y Coordinate Vectors
fv.object

Data Frames of Function Values
gridweights

Compute Quadrature Weights Based on Grid Counts
envelope

Simulation envelopes of summary function
pairdist.default

Pairwise distances
is.im

Test Whether An Object Is A Pixel Image
setcov

Set Covariance of a Window