Learn R Programming

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

spatstat (version 1.9-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, 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-1

License

GPL version 2 or newer

Maintainer

Adrian Baddeley

Last Published

March 22nd, 2025

Functions in spatstat (1.9-1)

Geyer

Geyer's Saturation Point Process Model
betacells

Beta Ganglion Cells in Cat Retina
as.mask

Pixel Image Approximation of a Window
alltypes

Calculate Statistic for All Types in a Multitype Point Pattern
crossdist.psp

Pairwise distances between two different line segment patterns
density.psp

Kernel Smoothing of Line Segment Pattern
default.dummy

Generate a Default Pattern of Dummy Points
spatstat-deprecated

Deprecated spatstat functions
diameter

Diameter of a Window Frame
spatstat-internal

Internal spatstat functions
eval.im

Evaluate Expression Involving Pixel Images
harmonic

Basis for Harmonic Functions
is.owin

Test Whether An Object Is A Window
longleaf

Longleaf Pines Point Pattern
ppm.object

Class of Fitted Point Process Models
anova.ppm

ANOVA for Fitted Point Process Models
Saturated

Saturated Pairwise Interaction model
nndist

Nearest neighbour distances
envelope

Simulation envelopes of summary function
rlabel

Random Re-Labelling of Point Pattern
distmap.owin

Distance Map of Window
as.im

Convert to Pixel Image
as.matrix.im

Convert Pixel Image to Matrix
compatible.fv

Test Whether Two Function Objects Are Compatible
plot.fv

Plot Function Valuesn
mincontrast

Method of Minimum Contrast
hamster

Aherne's hamster tumour data
nnwhich

Nearest neighbour
plot.quad

plot a Spatial Quadrature Scheme
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
crossdist.default

Pairwise distances between two different sets of points
print.owin

Print Brief Details of a Spatial Window
OrdThresh

Ord's Interaction model
Pairwise

Generic Pairwise Interaction model
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
fv.object

Data Frames of Function Values
fasp.object

Function Arrays for Spatial Patterns
print.ppm

Print a Fitted Point Process Model
rshift.ppp

Randomly Shift a Point Pattern
plot.owin

Plot a Spatial Window
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
rmpoispp

Generate Multitype Poisson Point Pattern
selfcrossing.psp

Crossing Points in a Line Segment Pattern
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
subset.fv

Extract Subset of Function Values
ppp.object

Class of Point Patterns
setcov

Set Covariance of a Window
mean.im

Mean Pixel Value in an Image
owin

Create a Window
rstrat

Stratified random point pattern
shift.psp

Apply Vector Translation To Line Segment Pattern
pcf.fasp

Pair Correlation Function obtained from array of K functions
summary.ppm

Summarizing a Fitted Point Process Model
predict.ppm

Prediction from a Fitted Point Process Model
summary.owin

Summary of a Spatial Window
qqplot.ppm

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

Multitype K Function (Cross-type)
Softcore

The Soft Core Point Process Model
reach

Interaction Distance of a Point Process
ants

Harkness-Isham ants' nests data
shift.owin

Apply Vector Translation To Window
affine.psp

Apply Affine Transformation To Line Segment Pattern
is.ppp

Test Whether An Object Is A Point Pattern
pairwise.family

Pairwise Interaction Process Family
reduced.sample

Reduced Sample Estimator using Histogram Data
Kest

K-function
unmark

Remove Marks from a Marked Point Pattern
Kmulti

Marked K-Function
Jest

Estimate the J-function
Jdot

Multitype J Function (i-to-any)
Ord

Generic Ord Interaction model
affine

Apply Affine Transformation
as.psp

Convert Data To Class psp
as.ppp

Convert Data To Class ppp
amacrine

Hughes' Amacrine Cell Data
area.owin

Area of a Window
endpoints.psp

Endpoints of Line Segment Pattern
complement.owin

Take Complement of a Window
data.ppm

Extract Original Data from a Fitted Point Process Model
nztrees

New Zealand Trees Point Pattern
coef.ppm

Coefficients of Fitted Point Process Model
eval.fv

Evaluate Expression Involving Functions
erode.owin

Erode a Window
Fest

Estimate the empty space function F
lgcp.estK

Fit a Log-Gaussian Cox Point Process by Minimum Contrast
Kest.fft

K-function using FFT
bounding.box

Bounding Box of a Window
lurking

Lurking variable plot
dilate.owin

Dilate a Window
rMaternII

Simulate Matern Model II
midpoints.psp

Midpoints of Line Segment Pattern
plot.plotppm

Plot a plotppm Object Created by plot.ppm
rMatClust

Simulate Matern Cluster Process
rmpoint

Generate N Random Multitype Points
markcorr

Mark Correlation Function
quad.object

Class of Quadrature Schemes
rthin

Random Thinning
pairsat.family

Saturated Pairwise Interaction Point Process Family
identify.ppp

Identify Points in a Point Pattern
simdat

Simulated Point Pattern
pairdist.ppp

Pairwise distances
quadscheme

Generate a Quadrature Scheme from a Point Pattern
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
lengths.psp

Lengths of Line Segments
rpoint

Generate N Random Points
nearest.raster.point

Find Pixel Nearest to a Given Point
is.im

Test Whether An Object Is A Pixel Image
rshift.splitppp

Randomly Shift a List of Point Patterns
subset.ppp

Extract or Replace Subset of Point Pattern
Gdot

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

Data and Code From JRSS Discussion Paper on Residuals
setmarks

Set or Reset the Marks in a Point Pattern
Poisson

Poisson Point Process Model
allstats

Calculate four standard summary functions of a point pattern.
Jmulti

Marked J Function
centroid.owin

Centroid of a window
concatxy

Concatenate x,y Coordinate Vectors
bramblecanes

Hutchings' Bramble Canes data
superimpose

Superimpose Several Point Patterns
Gest

Nearest Neighbour Distance Function G
Kmeasure

Reduced Second Moment Measure
compatible.im

Test Whether Two Pixel Images Are Compatible
affine.owin

Apply Affine Transformation To Window
chorley

Chorley-Ribble Cancer Data
distmap.ppp

Distance Map of Point Pattern
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
inside.owin

Test Whether Points Are Inside A Window
cut.ppp

Convert Point Pattern Marks from Numeric to Factor
is.marked.ppm

Test Whether A Point Process Model is Marked
square

Square Window
rshift

Random Shift
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
pairdist

Pairwise distances
rotate.ppp

Rotate a Point Pattern
plot.im

Plot a Pixel Image
eroded.areas

Areas of Morphological Erosions
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
ppm

Fit Point Process Model to Data
suffstat

Sufficient Statistic of Point Process Model
quadrat.test

Chi-Squared Dispersion Test for Spatial Point Pattern Based on Quadrat Counts
print.ppp

Print Brief Details of a Point Pattern Dataset
rmh.ppm

Simulate from a Fitted Point Process Model
raster.x

Cartesian Coordinates for a Pixel Raster
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
DiggleGratton

Diggle-Gratton model
Jcross

Multitype J Function (i-to-j)
StraussHard

The Strauss / Hard Core Point Process Model
Gmulti

Marked Nearest Neighbour Distance Function
bdist.points

Distance to Boundary of Window
Kcross.inhom

Inhomogeneous Cross K Function
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
is.marked

Test Whether Marks Are Present
crossing.psp

Crossing Points of Two Line Segment Patterns
spatstat

The Spatstat Package
Gcross

Multitype Nearest Neighbour Distance Function (i-to-j)
cut.im

Convert Pixel Image from Numeric to Factor
affine.ppp

Apply Affine Transformation To Point Pattern
as.rectangle

Window Frame
LennardJones

The Lennard-Jones Potential
distmap.psp

Distance Map of Line Segment Pattern
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
bdist.pixels

Distance to Boundary of Window
angles.psp

Orientation Angles of Line Segments
distmap

Distance Map
gridweights

Compute Quadrature Weights Based on Grid Counts
hist.im

Histogram of Pixel Values in an Image
as.owin

Convert Data To Class owin
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
rNeymanScott

Simulate Neyman-Scott Process
Iest

Estimate the I-function
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
levelset

Level Set of a Pixel Image
Kinhom

Inhomogeneous K-function
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
letterR

Window in Shape of Letter R
psp.object

Class of Line Segment Patterns
pcf.fv

Pair Correlation Function obtained from K Function
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
multiplicity.ppp

Count Multiplicity of Duplicate Points
rotate

Rotate
subset.fasp

Extract Subset of Function Array
intersect.owin

Intersection or Union of Two Windows
finpines

Pine saplings in Finland.
pcf.ppp

Pair Correlation Function of Point Pattern
redwood

California Redwoods Point Pattern (Ripley's Subset)
corners

Corners of a rectangle
append.psp

Combine Two Line Segment Patterns
Strauss

The Strauss Point Process Model
is.subset.owin

Determine Whether One Window is Contained In Another
is.marked.ppp

Test Whether A Point Pattern is Marked
rpoisline

Generate Poisson Random Line Process
ord.family

Ord Interaction Process Family
MultiStrauss

The Multitype Strauss Point Process Model
cells

Biological Cells Point Pattern
expand.owin

Expand Window By Factor
Kdot

Multitype K Function (i-to-any)
shift.ppp

Apply Vector Translation To Point Pattern
quantile.im

Sample Quantiles of Pixel Image
plot.ppm

plot a Fitted Point Process Model
rSSI

Simple Sequential Inhibition
Kdot.inhom

Inhomogeneous Multitype K Dot Function
rotate.owin

Rotate a Window
im.object

Class of Images
lansing

Lansing Woods Point Pattern
density.ppp

Kernel Smoothed Intensity of Point Pattern
crossdist.ppp

Pairwise distances between two different point patterns
japanesepines

Japanese Pines Point Pattern
gridcentres

Rectangular grid of points
is.ppm

Test Whether An Object Is A Fitted Point Process Model
print.im

Print Brief Details of an Image
rescue.rectangle

Convert Window Back To Rectangle
plot.ppp

plot a Spatial Point Pattern
plot.psp

plot a Spatial Line Segment Pattern
plot.splitppp

Plot a List of Point Patterns
subset.im

Extract Subset of Image
rpoispp

Generate Poisson Point Pattern
pairdist.default

Pairwise distances
owin.object

Class owin
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
shift

Apply Vector Translation
spokes

Spokes pattern of dummy points
shift.im

Apply Vector Translation To Pixel Image
split.ppp

Divide Point Pattern into Sub-patterns
psp

Create a Line Segment Pattern
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
pcf

Pair Correlation Function
copper

Berman-Huntington points and lines data
rmh.default

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

Summary of a Line Segment Pattern Dataset
runifpoint

Generate N Uniform Random Points
rThomas

Simulate Thomas Process
ppp

Create a Point Pattern
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
print.quad

Print a Quadrature Scheme
fitted.ppm

Fitted Conditional Intensity for Point Process Model
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
ripras

Estimate window from points alone
im

Create a Pixel Image Object
rMaternI

Simulate Matern Model I
crossdist

Pairwise distances
scanpp

Read Point Pattern From Data File
union.quad

Union of Data and Dummy Points
unique.ppp

Extract Unique Points from a Spatial Point Pattern
demopat

Artificial Data Point Pattern
subset.psp

Extract Subset of Line Segment Pattern
print.psp

Print Brief Details of a Line Segment Pattern Dataset
spruces

Spruces Point Pattern
pairdist.psp

Pairwise distances between line segments
solutionset

Evaluate Logical Expression Involving Pixel Images and Return Region Where Expression is True
quadratcount

Quadrat counting for a point pattern
rshift.psp

Randomly Shift a Line Segment Pattern
rcell

Simulate Baddeley-Silverman Cell Process
plot.fasp

Plot a Function Array
residuals.ppm

Residuals for Fitted Point Process Model
eem

Exponential Energy Marks
swedishpines

Swedish Pines Point Pattern
summary.ppp

Summary of a Point Pattern Dataset
rotate.psp

Rotate a Line Segment Pattern
summary.quad

Summarizing a Quadrature Scheme
spatstat.options

Internal Options in Spatstat Package
update.ppm

Update a Fitted Point Process Model
rsyst

Systematic random point pattern
summary.im

Summarizing a Pixel Image