Learn R Programming

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

spatstat (version 1.9-6)

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.9-6

License

GPL version 2 or newer

Maintainer

Adrian Baddeley

Last Published

March 22nd, 2025

Functions in spatstat (1.9-6)

Kcross.inhom

Inhomogeneous Cross K Function
Iest

Estimate the I-function
as.matrix.im

Convert Pixel Image to Matrix
Kest

K-function
gridcentres

Rectangular grid of points
corners

Corners of a rectangle
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
betacells

Beta Ganglion Cells in Cat Retina
as.ppp

Convert Data To Class ppp
Pairwise

Generic Pairwise Interaction model
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
as.owin

Convert Data To Class owin
Gmulti

Marked Nearest Neighbour Distance Function
longleaf

Longleaf Pines Point Pattern
alltypes

Calculate Statistic for All Types in a Multitype Point Pattern
fv.object

Data Frames of Function Values
LennardJones

The Lennard-Jones Potential
inside.owin

Test Whether Points Are Inside A Window
distmap.ppp

Distance Map of Point Pattern
nnwhich

Nearest neighbour
MultiStrauss

The Multitype Strauss Point Process Model
Strauss

The Strauss Point Process Model
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
amacrine

Hughes' Amacrine Cell Data
distmap.owin

Distance Map of Window
Poisson

Poisson Point Process Model
plot.ppm

plot a Fitted Point Process Model
rshift.psp

Randomly Shift a Line Segment Pattern
plot.splitppp

Plot a List of Point Patterns
summary.ppp

Summary of a Point Pattern Dataset
is.ppp

Test Whether An Object Is A Point Pattern
bramblecanes

Hutchings' Bramble Canes data
dilate.owin

Dilate a Window
bounding.box

Bounding Box of a Window
ants

Harkness-Isham ants' nests data
rMatClust

Simulate Matern Cluster Process
density.ppp

Kernel Smoothed Intensity of Point Pattern
nndist

Nearest neighbour distances
intersect.owin

Intersection or Union of Two Windows
cells

Biological Cells Point Pattern
ppp.object

Class of Point Patterns
fitted.ppm

Fitted Conditional Intensity for Point Process Model
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
pppdist

Optimal Match Between Two Point Patterns
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
rNeymanScott

Simulate Neyman-Scott Process
reduced.sample

Reduced Sample Estimator using Histogram Data
runifpoint

Generate N Uniform Random Points
quadscheme

Generate a Quadrature Scheme from a Point Pattern
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
letterR

Window in Shape of Letter R
crossdist.ppp

Pairwise distances between two different point patterns
qqplot.ppm

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

Distance Map
rStrauss

Perfect Simulation of the Strauss Process
mincontrast

Method of Minimum Contrast
rMaternI

Simulate Matern Model I
gridweights

Compute Quadrature Weights Based on Grid Counts
spatstat-deprecated

Deprecated spatstat functions
quad.object

Class of Quadrature Schemes
pairdist.ppp

Pairwise distances
expand.owin

Expand Window By Factor
rpoisline

Generate Poisson Random Line Process
simdat

Simulated Point Pattern
rmpoint

Generate N Random Multitype Points
redwood

California Redwoods Point Pattern (Ripley's Subset)
print.ppm

Print a Fitted Point Process Model
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
summary.owin

Summary of a Spatial Window
selfcrossing.psp

Crossing Points in a Line Segment Pattern
eroded.areas

Areas of Morphological Erosions
rlabel

Random Re-Labelling of Point Pattern
rshift

Random Shift
shift.psp

Apply Vector Translation To Line Segment Pattern
Jdot

Multitype J Function (i-to-any)
plot.quad

plot a Spatial Quadrature Scheme
append.psp

Combine Two Line Segment Patterns
eval.im

Evaluate Expression Involving Pixel Images
hamster

Aherne's hamster tumour data
is.owin

Test Whether An Object Is A Window
scanpp

Read Point Pattern From Data File
complement.owin

Take Complement of a Window
subset.fasp

Extract Subset of Function Array
pairsat.family

Saturated Pairwise Interaction Point Process Family
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
pcf

Pair Correlation Function
split.ppp

Divide Point Pattern into Sub-patterns
rmpoispp

Generate Multitype Poisson Point Pattern
rmh.ppm

Simulate from a Fitted Point Process Model
rotate

Rotate
pcf.fasp

Pair Correlation Function obtained from array of K functions
plot.im

Plot a Pixel Image
plot.psp

plot a Spatial Line Segment Pattern
print.owin

Print Brief Details of a Spatial Window
plot.fv

Plot Function Valuesn
print.quad

Print a Quadrature Scheme
quadrat.test

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

Class of Line Segment Patterns
psp

Create a Line Segment Pattern
ppm.object

Class of Fitted Point Process Models
rescue.rectangle

Convert Window Back To Rectangle
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
nztrees

New Zealand Trees Point Pattern
subset.psp

Extract Subset of Line Segment Pattern
rshift.ppp

Randomly Shift a Point Pattern
Kest.fft

K-function using FFT
rotate.ppp

Rotate a Point Pattern
plot.listof

Plot a List of Things
raster.x

Cartesian Coordinates for a Pixel Raster
residuals.ppm

Residuals for Fitted Point Process Model
quadratcount

Quadrat counting for a point pattern
setmarks

Set or Reset the Marks in a Point Pattern
Jcross

Multitype J Function (i-to-j)
Saturated

Saturated Pairwise Interaction model
summary.im

Summarizing a Pixel Image
affine.ppp

Apply Affine Transformation To Point Pattern
hist.im

Histogram of Pixel Values in an Image
pcf.ppp

Pair Correlation Function of Point Pattern
shift.im

Apply Vector Translation To Pixel Image
Ord

Generic Ord Interaction model
rpoint

Generate N Random Points
pairdist

Pairwise distances
angles.psp

Orientation Angles of Line Segments
Kmulti

Marked K-Function
anova.ppm

ANOVA for Fitted Point Process Models
bei

Tropical rain forest trees
is.marked.ppp

Test Whether A Point Pattern is Marked
shift.ppp

Apply Vector Translation To Point Pattern
superimpose

Superimpose Several Point Patterns
as.mask

Pixel Image Approximation of a Window
area.owin

Area of a Window
as.rectangle

Window Frame
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
distmap.psp

Distance Map of Line Segment Pattern
im

Create a Pixel Image Object
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
Gdot

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

Nearest Neighbour Distance Function G
crossdist.psp

Pairwise distances between two different line segment patterns
erode.owin

Erode a Window
affine.owin

Apply Affine Transformation To Window
fasp.object

Function Arrays for Spatial Patterns
lengths.psp

Lengths of Line Segments
lurking

Lurking variable plot
eval.fv

Evaluate Expression Involving Functions
owin

Create a Window
lansing

Lansing Woods Point Pattern
square

Square Window
ord.family

Ord Interaction Process Family
spruces

Spruces Point Pattern
pcf.fv

Pair Correlation Function obtained from K Function
is.marked

Test Whether Marks Are Present
solutionset

Evaluate Logical Expression Involving Pixel Images and Return Region Where Expression is True
plot.ppp

plot a Spatial Point Pattern
rotate.psp

Rotate a Line Segment Pattern
setcov

Set Covariance of a Window
spokes

Spokes pattern of dummy points
rsyst

Simulate systematic random point pattern
shift.owin

Apply Vector Translation To Window
rMaternII

Simulate Matern Model II
print.psp

Print Brief Details of a Line Segment Pattern Dataset
StraussHard

The Strauss / Hard Core Point Process Model
affine

Apply Affine Transformation
diameter

Diameter of a Window Frame
density.psp

Kernel Smoothing of Line Segment Pattern
identify.ppp

Identify Points in a Point Pattern
is.subset.owin

Determine Whether One Window is Contained In Another
envelope

Simulation envelopes of summary function
japanesepines

Japanese Pines Point Pattern
lgcp.estK

Fit a Log-Gaussian Cox Point Process by Minimum Contrast
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
quantile.im

Sample Quantiles of Pixel Image
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
spatstat

The Spatstat Package
summary.psp

Summary of a Line Segment Pattern Dataset
Kdot

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

Convert to Pixel Image
cut.ppp

Convert Point Pattern Marks from Numeric to Factor
centroid.owin

Centroid of a window
Jest

Estimate the J-function
levelset

Level Set of a Pixel Image
eem

Exponential Energy Marks
pairdist.default

Pairwise distances
coef.ppm

Coefficients of Fitted Point Process Model
swedishpines

Swedish Pines Point Pattern
Gcross

Multitype Nearest Neighbour Distance Function (i-to-j)
pairwise.family

Pairwise Interaction Process Family
Kmeasure

Reduced Second Moment Measure
subset.fv

Extract Subset of Function Values
crossing.psp

Crossing Points of Two Line Segment Patterns
print.ppp

Print Brief Details of a Point Pattern Dataset
chorley

Chorley-Ribble Cancer Data
crossdist

Pairwise distances
rshift.splitppp

Randomly Shift a List of Point Patterns
subset.ppp

Extract or Replace Subset of Point Pattern
nncross

Nearest Neighbour in Another Point Pattern
print.im

Print Brief Details of an Image
rcell

Simulate Baddeley-Silverman Cell Process
Kdot.inhom

Inhomogeneous Multitype K Dot Function
Kinhom

Inhomogeneous K-function
affine.psp

Apply Affine Transformation To Line Segment Pattern
Softcore

The Soft Core Point Process Model
concatxy

Concatenate x,y Coordinate Vectors
demopat

Artificial Data Point Pattern
spatstat-internal

Internal spatstat functions
data.ppm

Extract Original Data from a Fitted Point Process Model
shift

Apply Vector Translation
rstrat

Simulate Stratified Random Point Pattern
summary.quad

Summarizing a Quadrature Scheme
Geyer

Geyer's Saturation Point Process Model
Kcross

Multitype K Function (Cross-type)
as.psp

Convert Data To Class psp
contour.im

Contour plot of pixel image
default.dummy

Generate a Default Pattern of Dummy Points
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
is.im

Test Whether An Object Is A Pixel Image
multiplicity.ppp

Count Multiplicity of Duplicate Points
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
rThomas

Simulate Thomas Process
subset.im

Extract Subset of Image
plot.owin

Plot a Spatial Window
trim.rectangle

Cut margins from rectangle
summary.ppm

Summarizing a Fitted Point Process Model
is.marked.ppm

Test Whether A Point Process Model is Marked
rthin

Random Thinning
compatible.im

Test Whether Two Pixel Images Are Compatible
DiggleGratton

Diggle-Gratton model
allstats

Calculate four standard summary functions of a point pattern.
copper

Berman-Huntington points and lines data
ppp

Create a Point Pattern
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
compatible.fv

Test Whether Two Function Objects Are Compatible
MultiStraussHard

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

Mean Pixel Value in an Image
OrdThresh

Ord's Interaction model
Fest

Estimate the empty space function F
bdist.points

Distance to Boundary of Window
cut.im

Convert Pixel Image from Numeric to Factor
rmh.default

Simulate Point Process Models using the Metropolis-Hastings Algorithm.
is.ppm

Test Whether An Object Is A Fitted Point Process Model
suffstat

Sufficient Statistic of Point Process Model
im.object

Class of Images
finpines

Pine saplings in Finland.
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
rSSI

Simulate Simple Sequential Inhibition
Jmulti

Marked J Function
clickppp

Interactively Add Points
reach

Interaction Distance of a Point Process
midpoints.psp

Midpoints of Line Segment Pattern
crossdist.default

Pairwise distances between two different sets of points
bdist.pixels

Distance to Boundary of Window
ppm

Fit Point Process Model to Data
ripras

Estimate window from points alone
owin.object

Class owin
plot.fasp

Plot a Function Array
harmonic

Basis for Harmonic Functions
endpoints.psp

Endpoints of Line Segment Pattern
predict.ppm

Prediction from a Fitted Point Process Model
union.quad

Union of Data and Dummy Points
update.ppm

Update a Fitted Point Process Model
profilepl

Profile Maximum Pseudolikelihood
plot.plotppm

Plot a plotppm Object Created by plot.ppm
markcorr

Mark Correlation Function
rpoispp

Generate Poisson Point Pattern
nearest.raster.point

Find Pixel Nearest to a Given Point
rmhstart

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

Extract Unique Points from a Spatial Point Pattern
pairdist.psp

Pairwise distances between line segments
persp.im

Perspective Plot of Pixel Image
rotate.owin

Rotate a Window
unmark

Remove Marks from a Marked Point Pattern
spatstat.options

Internal Options in Spatstat Package