Learn R Programming

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

spatstat (version 1.9-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, 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.9-3

License

GPL version 2 or newer

Maintainer

Adrian Baddeley

Last Published

March 22nd, 2025

Functions in spatstat (1.9-3)

affine.owin

Apply Affine Transformation To Window
append.psp

Combine Two Line Segment Patterns
Jdot

Multitype J Function (i-to-any)
compatible.fv

Test Whether Two Function Objects Are Compatible
as.mask

Pixel Image Approximation of a Window
eval.im

Evaluate Expression Involving Pixel Images
crossing.psp

Crossing Points of Two Line Segment Patterns
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
letterR

Window in Shape of Letter R
midpoints.psp

Midpoints of Line Segment Pattern
cut.ppp

Convert Point Pattern Marks from Numeric to Factor
eem

Exponential Energy Marks
Kinhom

Inhomogeneous K-function
im.object

Class of Images
pairwise.family

Pairwise Interaction Process Family
bdist.pixels

Distance to Boundary of Window
nztrees

New Zealand Trees Point Pattern
print.im

Print Brief Details of an Image
Iest

Estimate the I-function
area.owin

Area of a Window
lengths.psp

Lengths of Line Segments
rpoispp

Generate Poisson Point Pattern
pairdist.ppp

Pairwise distances
pcf.fv

Pair Correlation Function obtained from K Function
shift.owin

Apply Vector Translation To Window
crossdist

Pairwise distances
pairsat.family

Saturated Pairwise Interaction Point Process Family
swedishpines

Swedish Pines Point Pattern
markcorr

Mark Correlation Function
rsyst

Systematic random point pattern
psp.object

Class of Line Segment Patterns
quantile.im

Sample Quantiles of Pixel Image
rmpoispp

Generate Multitype Poisson Point Pattern
residuals.ppm

Residuals for Fitted Point Process Model
rlabel

Random Re-Labelling of Point Pattern
Strauss

The Strauss Point Process Model
Kest

K-function
rthin

Random Thinning
split.ppp

Divide Point Pattern into Sub-patterns
shift.ppp

Apply Vector Translation To Point Pattern
angles.psp

Orientation Angles of Line Segments
shift.im

Apply Vector Translation To Pixel Image
Saturated

Saturated Pairwise Interaction model
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
OrdThresh

Ord's Interaction model
rpoisline

Generate Poisson Random Line Process
default.dummy

Generate a Default Pattern of Dummy Points
Softcore

The Soft Core Point Process Model
inside.owin

Test Whether Points Are Inside A Window
is.ppp

Test Whether An Object Is A Point Pattern
bdist.points

Distance to Boundary of Window
pairdist.psp

Pairwise distances between line segments
longleaf

Longleaf Pines Point Pattern
crossdist.default

Pairwise distances between two different sets of points
profilepl

Profile Maximum Pseudolikelihood
subset.fv

Extract Subset of Function Values
data.ppm

Extract Original Data from a Fitted Point Process Model
solutionset

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

Summary of a Line Segment Pattern Dataset
spatstat-deprecated

Deprecated spatstat functions
distmap.psp

Distance Map of Line Segment Pattern
summary.im

Summarizing a Pixel Image
multiplicity.ppp

Count Multiplicity of Duplicate Points
Geyer

Geyer's Saturation Point Process Model
as.matrix.im

Convert Pixel Image to Matrix
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
psp

Create a Line Segment Pattern
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
quadratcount

Quadrat counting for a point pattern
Poisson

Poisson Point Process Model
pcf.ppp

Pair Correlation Function of Point Pattern
MultiStrauss

The Multitype Strauss Point Process Model
plot.plotppm

Plot a plotppm Object Created by plot.ppm
quadrat.test

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

Class of Quadrature Schemes
print.ppp

Print Brief Details of a Point Pattern Dataset
affine

Apply Affine Transformation
complement.owin

Take Complement of a Window
as.psp

Convert Data To Class psp
as.ppp

Convert Data To Class ppp
Kdot

Multitype K Function (i-to-any)
distmap

Distance Map
rmh.default

Simulate Point Process Models using the Metropolis-Hastings Algorithm.
centroid.owin

Centroid of a window
bramblecanes

Hutchings' Bramble Canes data
rNeymanScott

Simulate Neyman-Scott Process
spruces

Spruces Point Pattern
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
diameter

Diameter of a Window Frame
expand.owin

Expand Window By Factor
hamster

Aherne's hamster tumour data
harmonic

Basis for Harmonic Functions
owin

Create a Window
rescue.rectangle

Convert Window Back To Rectangle
endpoints.psp

Endpoints of Line Segment Pattern
nndist

Nearest neighbour distances
reach

Interaction Distance of a Point Process
Kest.fft

K-function using FFT
anova.ppm

ANOVA for Fitted Point Process Models
pcf

Pair Correlation Function
plot.fv

Plot Function Valuesn
subset.fasp

Extract Subset of Function Array
eroded.areas

Areas of Morphological Erosions
rThomas

Simulate Thomas Process
qqplot.ppm

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

Data and Code From JRSS Discussion Paper on Residuals
is.im

Test Whether An Object Is A Pixel Image
unmark

Remove Marks from a Marked Point Pattern
Gmulti

Marked Nearest Neighbour Distance Function
unique.ppp

Extract Unique Points from a Spatial Point Pattern
affine.psp

Apply Affine Transformation To Line Segment Pattern
corners

Corners of a rectangle
plot.owin

Plot a Spatial Window
plot.splitppp

Plot a List of Point Patterns
crossdist.ppp

Pairwise distances between two different point patterns
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
plot.ppm

plot a Fitted Point Process Model
ppp

Create a Point Pattern
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
superimpose

Superimpose Several Point Patterns
scanpp

Read Point Pattern From Data File
nnwhich

Nearest neighbour
Jmulti

Marked J Function
as.owin

Convert Data To Class owin
simdat

Simulated Point Pattern
suffstat

Sufficient Statistic of Point Process Model
demopat

Artificial Data Point Pattern
Gest

Nearest Neighbour Distance Function G
betacells

Beta Ganglion Cells in Cat Retina
allstats

Calculate four standard summary functions of a point pattern.
concatxy

Concatenate x,y Coordinate Vectors
finpines

Pine saplings in Finland.
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
distmap.ppp

Distance Map of Point Pattern
is.owin

Test Whether An Object Is A Window
fv.object

Data Frames of Function Values
hist.im

Histogram of Pixel Values in an Image
fasp.object

Function Arrays for Spatial Patterns
is.marked

Test Whether Marks Are Present
gridweights

Compute Quadrature Weights Based on Grid Counts
Jest

Estimate the J-function
DiggleGratton

Diggle-Gratton model
print.ppm

Print a Fitted Point Process Model
envelope

Simulation envelopes of summary function
rshift

Random Shift
intersect.owin

Intersection or Union of Two Windows
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
runifpoint

Generate N Uniform Random Points
plot.im

Plot a Pixel Image
summary.ppp

Summary of a Point Pattern Dataset
mincontrast

Method of Minimum Contrast
rcell

Simulate Baddeley-Silverman Cell Process
ppp.object

Class of Point Patterns
rshift.splitppp

Randomly Shift a List of Point Patterns
erode.owin

Erode a Window
selfcrossing.psp

Crossing Points in a Line Segment Pattern
summary.owin

Summary of a Spatial Window
shift

Apply Vector Translation
plot.ppp

plot a Spatial Point Pattern
raster.x

Cartesian Coordinates for a Pixel Raster
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
rSSI

Simple Sequential Inhibition
shift.psp

Apply Vector Translation To Line Segment Pattern
setmarks

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

Union of Data and Dummy Points
rmh.ppm

Simulate from a Fitted Point Process Model
Gdot

Multitype Nearest Neighbour Distance Function (i-to-any)
Kcross.inhom

Inhomogeneous Cross K Function
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
bounding.box

Bounding Box of a Window
Kmeasure

Reduced Second Moment Measure
rotate.ppp

Rotate a Point Pattern
spatstat.options

Internal Options in Spatstat Package
rshift.psp

Randomly Shift a Line Segment Pattern
summary.ppm

Summarizing a Fitted Point Process Model
dummy.ppm

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

Evaluate Expression Involving Functions
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
pairdist.default

Pairwise distances
plot.psp

plot a Spatial Line Segment Pattern
print.owin

Print Brief Details of a Spatial Window
print.psp

Print Brief Details of a Line Segment Pattern Dataset
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
rotate

Rotate
Kcross

Multitype K Function (Cross-type)
copper

Berman-Huntington points and lines data
density.ppp

Kernel Smoothed Intensity of Point Pattern
is.ppm

Test Whether An Object Is A Fitted Point Process Model
japanesepines

Japanese Pines Point Pattern
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
nearest.raster.point

Find Pixel Nearest to a Given Point
plot.fasp

Plot a Function Array
lurking

Lurking variable plot
print.quad

Print a Quadrature Scheme
predict.ppm

Prediction from a Fitted Point Process Model
ants

Harkness-Isham ants' nests data
compatible.im

Test Whether Two Pixel Images Are Compatible
identify.ppp

Identify Points in a Point Pattern
lansing

Lansing Woods Point Pattern
quadscheme

Generate a Quadrature Scheme from a Point Pattern
ripras

Estimate window from points alone
rshift.ppp

Randomly Shift a Point Pattern
rstrat

Stratified random point pattern
summary.quad

Summarizing a Quadrature Scheme
pairdist

Pairwise distances
levelset

Level Set of a Pixel Image
redwood

California Redwoods Point Pattern (Ripley's Subset)
owin.object

Class owin
square

Square Window
rotate.psp

Rotate a Line Segment Pattern
subset.ppp

Extract or Replace Subset of Point Pattern
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
alltypes

Calculate Statistic for All Types in a Multitype Point Pattern
StraussHard

The Strauss / Hard Core Point Process Model
amacrine

Hughes' Amacrine Cell Data
density.psp

Kernel Smoothing of Line Segment Pattern
as.rectangle

Window Frame
coef.ppm

Coefficients of Fitted Point Process Model
spatstat-internal

Internal spatstat functions
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
distmap.owin

Distance Map of Window
ord.family

Ord Interaction Process Family
Fest

Estimate the empty space function F
Kdot.inhom

Inhomogeneous Multitype K Dot Function
setcov

Set Covariance of a Window
Kmulti

Marked K-Function
Pairwise

Generic Pairwise Interaction model
chorley

Chorley-Ribble Cancer Data
as.im

Convert to Pixel Image
cells

Biological Cells Point Pattern
Jcross

Multitype J Function (i-to-j)
Gcross

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

The Lennard-Jones Potential
crossdist.psp

Pairwise distances between two different line segment patterns
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
is.marked.ppp

Test Whether A Point Pattern is Marked
mean.im

Mean Pixel Value in an Image
is.marked.ppm

Test Whether A Point Process Model is Marked
spatstat

The Spatstat Package
fitted.ppm

Fitted Conditional Intensity for Point Process Model
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
im

Create a Pixel Image Object
gridcentres

Rectangular grid of points
rMaternII

Simulate Matern Model II
is.subset.owin

Determine Whether One Window is Contained In Another
plot.quad

plot a Spatial Quadrature Scheme
reduced.sample

Reduced Sample Estimator using Histogram Data
rotate.owin

Rotate a Window
ppm

Fit Point Process Model to Data
ppm.object

Class of Fitted Point Process Models
rmpoint

Generate N Random Multitype Points
spokes

Spokes pattern of dummy points
rpoint

Generate N Random Points
rMatClust

Simulate Matern Cluster Process
subset.psp

Extract Subset of Line Segment Pattern
rMaternI

Simulate Matern Model I
dilate.owin

Dilate a Window
lgcp.estK

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

Pair Correlation Function obtained from array of K functions
affine.ppp

Apply Affine Transformation To Point Pattern
persp.im

Perspective Plot of Pixel Image
ganglia

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

Extract Subset of Image
Ord

Generic Ord Interaction model
cut.im

Convert Pixel Image from Numeric to Factor
update.ppm

Update a Fitted Point Process Model