Learn R Programming

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

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

18,534

Version

1.10-1

License

GPL version 2 or newer

Maintainer

Adrian Baddeley

Last Published

March 22nd, 2025

Functions in spatstat (1.10-1)

Kmeasure

Reduced Second Moment Measure
append.psp

Combine Two Line Segment Patterns
Ord

Generic Ord Interaction model
Jmulti

Marked J Function
anova.ppm

ANOVA for Fitted Point Process Models
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
eem

Exponential Energy Marks
diameter

Diameter of a Window Frame
hamster

Aherne's hamster tumour data
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
is.ppm

Test Whether An Object Is A Fitted Point Process Model
pairdist.psp

Pairwise distances between line segments
compatible.im

Test Whether Two Pixel Images Are Compatible
is.owin

Test Whether An Object Is A Window
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
pairsat.family

Saturated Pairwise Interaction Point Process Family
cut.im

Convert Pixel Image from Numeric to Factor
dilate.owin

Dilate a Window
profilepl

Profile Maximum Pseudolikelihood
crossdist.default

Pairwise distances between two different sets of points
affine.psp

Apply Affine Transformation To Line Segment Pattern
distmap

Distance Map
psp

Create a Line Segment Pattern
alltypes

Calculate Statistic for All Types in a Multitype Point Pattern
pcf

Pair Correlation Function
owin

Create a Window
rSSI

Simulate Simple Sequential Inhibition
rmpoispp

Generate Multitype Poisson Point Pattern
is.marked

Test Whether Marks Are Present
markcorr

Mark Correlation Function
qqplot.ppm

Q-Q Plot of Residuals from Fitted Point Process Model
erode.owin

Erode a Window
pairdist.ppp

Pairwise distances
rshift.splitppp

Randomly Shift a List of Point Patterns
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
ripras

Estimate window from points alone
spatstat

The Spatstat Package
shift.im

Apply Vector Translation To Pixel Image
rmpoint

Generate N Random Multitype Points
suffstat

Sufficient Statistic of Point Process Model
ppm.object

Class of Fitted Point Process Models
rNeymanScott

Simulate Neyman-Scott Process
rcell

Simulate Baddeley-Silverman Cell Process
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
raster.x

Cartesian Coordinates for a Pixel Raster
spatstat.options

Internal Options in Spatstat Package
Kcross.inhom

Inhomogeneous Cross K Function
Jest

Estimate the J-function
rmh.ppm

Simulate from a Fitted Point Process Model
split.ppp

Divide Point Pattern into Sub-patterns
rstrat

Simulate Stratified Random Point Pattern
eroded.areas

Areas of Morphological Erosions
lengths.psp

Lengths of Line Segments
print.ppm

Print a Fitted Point Process Model
OrdThresh

Ord's Interaction model
Kmulti

Marked K-Function
pppdist

Optimal Match Between Two Point Patterns
affine

Apply Affine Transformation
LennardJones

The Lennard-Jones Potential
ppp

Create a Point Pattern
rMaternII

Simulate Matern Model II
StraussHard

The Strauss / Hard Core Point Process Model
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
ants

Harkness-Isham ants' nests data
allstats

Calculate four standard summary functions of a point pattern.
density.ppp

Kernel Smoothed Intensity of Point Pattern
centroid.owin

Centroid of a window
corners

Corners of a rectangle
Kest.fft

K-function using FFT
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
bei

Tropical rain forest trees
angles.psp

Orientation Angles of Line Segments
bramblecanes

Hutchings' Bramble Canes data
distmap.ppp

Distance Map of Point Pattern
Jcross

Multitype J Function (i-to-j)
intersect.owin

Intersection or Union of Two Windows
Fest

Estimate the empty space function F
betacells

Beta Ganglion Cells in Cat Retina
as.mask

Pixel Image Approximation of a Window
coef.ppm

Coefficients of Fitted Point Process Model
pcf.fv

Pair Correlation Function obtained from K Function
cells

Biological Cells Point Pattern
im.object

Class of Images
plot.ppm

plot a Fitted Point Process Model
density.psp

Kernel Smoothing of Line Segment Pattern
quadscheme

Generate a Quadrature Scheme from a Point Pattern
concatxy

Concatenate x,y Coordinate Vectors
distmap.owin

Distance Map of Window
is.marked.ppp

Test Whether A Point Pattern is Marked
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
ord.family

Ord Interaction Process Family
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
Strauss

The Strauss Point Process Model
finpines

Pine saplings in Finland.
crossdist.psp

Pairwise distances between two different line segment patterns
data.ppm

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

Kernel Smoothed Intensity of Split Point Pattern
rthin

Random Thinning
hist.im

Histogram of Pixel Values in an Image
is.multitype.ppm

Test Whether A Point Process Model is Multitype
plot.splitppp

Plot a List of Point Patterns
multiplicity.ppp

Count Multiplicity of Duplicate Points
longleaf

Longleaf Pines Point Pattern
japanesepines

Japanese Pines Point Pattern
pcf.fasp

Pair Correlation Function obtained from array of K functions
print.quad

Print a Quadrature Scheme
MultiStrauss

The Multitype Strauss Point Process Model
gridcentres

Rectangular grid of points
is.multitype

Test whether Object is Multitype
quadrat.test

Chi-Squared Dispersion Test for Spatial Point Pattern Based on Quadrat Counts
nearest.raster.point

Find Pixel Nearest to a Given Point
chorley

Chorley-Ribble Cancer Data
nndist

Nearest neighbour distances
nnwhich

Nearest neighbour
rotate.ppp

Rotate a Point Pattern
complement.owin

Take Complement of a Window
print.owin

Print Brief Details of a Spatial Window
quadratcount

Quadrat counting for a point pattern
residuals.ppm

Residuals for Fitted Point Process Model
DiggleGratton

Diggle-Gratton model
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
Kest

K-function
scanpp

Read Point Pattern From Data File
rotate.owin

Rotate a Window
default.dummy

Generate a Default Pattern of Dummy Points
rsyst

Simulate systematic random point pattern
shift.psp

Apply Vector Translation To Line Segment Pattern
rpoint

Generate N Random Points
shift.owin

Apply Vector Translation To Window
plot.plotppm

Plot a plotppm Object Created by plot.ppm
predict.ppm

Prediction from a Fitted Point Process Model
spatstat-deprecated

Deprecated spatstat functions
disc

Circular Window
print.im

Print Brief Details of an Image
setcov

Set Covariance of a Window
rStrauss

Perfect Simulation of the Strauss Process
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
rescue.rectangle

Convert Window Back To Rectangle
shift.ppp

Apply Vector Translation To Point Pattern
square

Square Window
Gcross

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

Superimpose Several Point Patterns
Softcore

The Soft Core Point Process Model
contour.im

Contour plot of pixel image
spruces

Spruces Point Pattern
is.ppp

Test Whether An Object Is A Point Pattern
swedishpines

Swedish Pines Point Pattern
pairdist

Pairwise distances
plot.fv

Plot Function Valuesn
plot.quad

plot a Spatial Quadrature Scheme
Geyer

Geyer's Saturation Point Process Model
Gmulti

Marked Nearest Neighbour Distance Function
Kcross

Multitype K Function (Cross-type)
Kdot.inhom

Inhomogeneous Multitype K Dot Function
Poisson

Poisson Point Process Model
Kinhom

Inhomogeneous K-function
rshift

Random Shift
rmh.default

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

Area of a Window
as.rectangle

Window Frame
as.psp

Convert Data To Class psp
as.im

Convert to Pixel Image
summary.ppp

Summary of a Point Pattern Dataset
compatible.fv

Test Whether Two Function Objects Are Compatible
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
spokes

Spokes pattern of dummy points
lurking

Lurking variable plot
runifpoint

Generate N Uniform Random Points
reach

Interaction Distance of a Point Process
fv.object

Data Frames of Function Values
plot.im

Plot a Pixel Image
levelset

Level Set of a Pixel Image
lgcp.estK

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

Method of Minimum Contrast
redwood

California Redwoods Point Pattern (Ripley's Subset)
plot.psp

plot a Spatial Line Segment Pattern
nncross

Nearest Neighbour in Another Point Pattern
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
Saturated

Saturated Pairwise Interaction model
plot.fasp

Plot a Function Array
bounding.box

Bounding Box of a Window
crossdist

Pairwise distances
plot.listof

Plot a List of Things
crossdist.ppp

Pairwise distances between two different point patterns
endpoints.psp

Endpoints of Line Segment Pattern
trim.rectangle

Cut margins from rectangle
unmark

Remove Marks from a Marked Point Pattern
eval.im

Evaluate Expression Involving Pixel Images
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
rMaternI

Simulate Matern Model I
pairdist.default

Pairwise distances
print.ppp

Print Brief Details of a Point Pattern Dataset
quantile.im

Sample Quantiles of Pixel Image
rlabel

Random Re-Labelling of Point Pattern
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
setmarks

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

Union of Data and Dummy Points
Iest

Estimate the I-function
as.matrix.im

Convert Pixel Image to Matrix
affine.ppp

Apply Affine Transformation To Point Pattern
copper

Berman-Huntington points and lines data
bdist.points

Distance to Boundary of Window
inside.owin

Test Whether Points Are Inside A Window
is.subset.owin

Determine Whether One Window is Contained In Another
mean.im

Mean Pixel Value in an Image
subset.im

Extract Subset of Image
as.ppp

Convert Data To Class ppp
summary.psp

Summary of a Line Segment Pattern Dataset
owin.object

Class owin
is.marked.ppm

Test Whether A Point Process Model is Marked
distmap.psp

Distance Map of Line Segment Pattern
pcf.ppp

Pair Correlation Function of Point Pattern
ppm

Fit Point Process Model to Data
letterR

Window in Shape of Letter R
psp.object

Class of Line Segment Patterns
is.multitype.ppp

Test Whether A Point Pattern is Multitype
midpoints.psp

Midpoints of Line Segment Pattern
ppp.object

Class of Point Patterns
rMatClust

Simulate Matern Cluster Process
is.im

Test Whether An Object Is A Pixel Image
rshift.psp

Randomly Shift a Line Segment Pattern
runifdisc

Generate N Uniform Random Points in a Disc
eval.fv

Evaluate Expression Involving Functions
solutionset

Evaluate Logical Expression Involving Pixel Images and Return Region Where Expression is True
subset.fv

Extract Subset of Function Values
harmonic

Basis for Harmonic Functions
subset.fasp

Extract Subset of Function Array
subset.psp

Extract Subset of Line Segment Pattern
summary.im

Summarizing a Pixel Image
identify.ppp

Identify Points in a Point Pattern
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
fitted.ppm

Fitted Conditional Intensity for Point Process Model
nztrees

New Zealand Trees Point Pattern
update.ppm

Update a Fitted Point Process Model
rThomas

Simulate Thomas Process
rshift.ppp

Randomly Shift a Point Pattern
summary.owin

Summary of a Spatial Window
summary.ppm

Summarizing a Fitted Point Process Model
unique.ppp

Extract Unique Points from a Spatial Point Pattern
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
Gdot

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

Apply Affine Transformation To Window
amacrine

Hughes' Amacrine Cell Data
demopat

Artificial Data Point Pattern
persp.im

Perspective Plot of Pixel Image
quad.object

Class of Quadrature Schemes
shift

Apply Vector Translation
simdat

Simulated Point Pattern
Gest

Nearest Neighbour Distance Function G
Jdot

Multitype J Function (i-to-any)
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
cut.ppp

Convert Point Pattern Marks from Numeric to Factor
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
lansing

Lansing Woods Point Pattern
reduced.sample

Reduced Sample Estimator using Histogram Data
pairwise.family

Pairwise Interaction Process Family
rotate

Rotate
rpoisline

Generate Poisson Random Line Process
rotate.psp

Rotate a Line Segment Pattern
summary.quad

Summarizing a Quadrature Scheme
units

Name for Unit of Length
subset.ppp

Extract or Replace Subset of Point Pattern
Kdot

Multitype K Function (i-to-any)
as.owin

Convert Data To Class owin
envelope

Simulation envelopes of summary function
crossing.psp

Crossing Points of Two Line Segment Patterns
plot.owin

Plot a Spatial Window
print.psp

Print Brief Details of a Line Segment Pattern Dataset
rpoispp

Generate Poisson Point Pattern
Pairwise

Generic Pairwise Interaction model
bdist.pixels

Distance to Boundary of Window
clickppp

Interactively Add Points
fasp.object

Function Arrays for Spatial Patterns
expand.owin

Expand Window By Factor
gridweights

Compute Quadrature Weights Based on Grid Counts
im

Create a Pixel Image Object
plot.ppp

plot a Spatial Point Pattern
selfcrossing.psp

Crossing Points in a Line Segment Pattern
spatstat-internal

Internal spatstat functions