Learn R Programming

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

spatstat (version 1.17-2)

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. Also supports three-dimensional point patterns. Contains functions for plotting spatial data, exploratory data analysis, model-fitting, simulation, spatial sampling, model diagnostics, and formal inference. Data types include point patterns, line segment patterns, spatial windows, pixel images and tessellations. 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.17-2

License

GPL (>= 2)

Maintainer

Adrian Baddeley

Last Published

November 10th, 2009

Functions in spatstat (1.17-2)

BadGey

Hybrid Geyer Point Process Model
chop.tess

Subdivide a Window or Tessellation using a Set of Lines
clickpoly

Interactively Define a Polygon
bramblecanes

Hutchings' Bramble Canes data
crossdist.ppp

Pairwise distances between two different point patterns
dirichlet

Dirichlet Tessellation of Point Pattern
Gcross

Multitype Nearest Neighbour Distance Function (i-to-j)
distmap.psp

Distance Map of Line Segment Pattern
as.box3

Convert Data to Three-Dimensional Box
border

Border Region of a Window
Extract.fv

Extract Subset of Function Values
clip.infline

Intersect Infinite Straight Lines with a Window
Extract.im

Extract Subset of Image
Ldot

Multitype L-function (i-to-any)
MultiStrauss

The Multitype Strauss Point Process Model
eroded.areas

Areas of Morphological Erosions
eval.fv

Evaluate Expression Involving Functions
fasp.object

Function Arrays for Spatial Patterns
Lest

L-function
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
ewcdf

Weighted Empirical Cumulative Distribution Function
crossdist

Pairwise distances
Kmeasure

Reduced Second Moment Measure
as.matrix.im

Convert Pixel Image to Matrix
Extract.splitppp

Extract or Replace Sub-Patterns
Ldot.inhom

Inhomogeneous Multitype L Dot Function
Gmulti

Marked Nearest Neighbour Distance Function
Softcore

The Soft Core Point Process Model
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
affine.ppp

Apply Affine Transformation To Point Pattern
AreaInter

The Area Interaction Point Process Model
Kest.fft

K-function using FFT
affine.psp

Apply Affine Transformation To Line Segment Pattern
compatible.fv

Test Whether Two Function Objects Are Compatible
as.polygonal

Convert a Window to a Polygonal Window
betacells

Beta Ganglion Cells in Cat Retina
convexhull

Convex Hull
envelope

Simulation envelopes of summary function
adaptive.density

Intensity Estimate of Point Pattern Using Tessellation
affine

Apply Affine Transformation
angles.psp

Orientation Angles of Line Segments
G3est

Nearest Neighbour Distance Distribution Function of a Three-Dimensional Point Pattern
Extract.quad

Subset of Quadrature Scheme
gpc2owin

Convert Polygonal Region into Different Format
as.hyperframe

Convert Data to Hyperframe
markconnect

Mark Connection Function
K3est

K-function of a Three-Dimensional Point Pattern
Iest

Estimate the I-function
area.owin

Area of a Window
ants

Harkness-Isham ants' nests data
StraussHard

The Strauss / Hard Core Point Process Model
markvario

Mark Variogram
compatible.im

Test Whether Two Pixel Images Are Compatible
methods.ppx

Methods for Multidimensional Space-Time Point Patterns
is.convex

Test Whether a Window is Convex
areaLoss

Difference of Disc Areas
complement.owin

Take Complement of a Window
nbfires

Point Patterns of New Brunswick Forest Fires
bdist.pixels

Distance to Boundary of Window
Emark

Diagnostics for random marking
demopat

Artificial Data Point Pattern
bdist.points

Distance to Boundary of Window
DiggleGratton

Diggle-Gratton model
Extract.ppp

Extract or Replace Subset of Point Pattern
Kcross.inhom

Inhomogeneous Cross K Function
Lcross

Multitype L-function (cross-type)
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
Jmulti

Marked J Function
Extract.listof

Extract or Replace Subset of a List of Things
as.tess

Convert Data To Tessellation
dilation

Morphological Dilation
Lcross.inhom

Inhomogeneous Cross Type L Function
Hest

Spherical Contact Distribution Function
Fest

Estimate the empty space function F
Replace.im

Reset Values in Subset of Image
Jcross

Multitype J Function (i-to-j)
pcf

Pair Correlation Function
coords

Extract Coordinates of a Spatial or Spatiotemporal Point Pattern
expand.owin

Expand Window By Factor
plot.ppp

plot a Spatial Point Pattern
F3est

Empty Space Function of a Three-Dimensional Point Pattern
Jest

Estimate the J-function
SatPiece

Piecewise Constant Saturated Pairwise Interaction Point Process Model
print.im

Print Brief Details of an Image
Kdot

Multitype K Function (i-to-any)
anemones

Beadlet Anemones Data
as.ppp

Convert Data To Class ppp
convexhull.xy

Convex Hull of Points
Geyer

Geyer's Saturation Point Process Model
inside.owin

Test Whether Points Are Inside A Window
amacrine

Hughes' Amacrine Cell Data
opening

Morphological Opening
harmonic

Basis for Harmonic Functions
Strauss

The Strauss Point Process Model
Linhom

L-function
Saturated

Saturated Pairwise Interaction model
areaGain

Difference of Disc Areas
as.hyperframe.ppx

Extract coordinates and marks of multidimensional point pattern
colourmap

Colour Lookup Tables
clarkevans

Clark and Evans Aggregation Index
Gdot

Multitype Nearest Neighbour Distance Function (i-to-any)
is.marked.ppm

Test Whether A Point Process Model is Marked
as.data.frame.ppp

Coerce Point Pattern to a Data Frame
compatible.fasp

Test Whether Two Function Arrays Are Compatible
as.im

Convert to Pixel Image
levelset

Level Set of a Pixel Image
erosion

Morphological Erosion
default.dummy

Generate a Default Pattern of Dummy Points
Kmulti

Marked K-Function
identify.ppp

Identify Points in a Point Pattern
LennardJones

The Lennard-Jones Potential
Extract.psp

Extract Subset of Line Segment Pattern
bronzefilter

Bronze gradient filter data
intersect.tess

Intersection of Two Tessellations
hist.im

Histogram of Pixel Values in an Image
blur

Apply Gaussian Blur to a Pixel Image
markcorr

Mark Correlation Function
Gest

Nearest Neighbour Distance Function G
alltypes

Calculate Summary Statistic for All Types in a Multitype Point Pattern
is.multitype.ppp

Test Whether A Point Pattern is Multitype
bounding.box

Bounding Box of a Window or Point Pattern
Poisson

Poisson Point Process Model
quadrats

Divide Region into Quadrats
lgcp.estK

Fit a Log-Gaussian Cox Point Process by Minimum Contrast
is.ppp

Test Whether An Object Is A Point Pattern
copper

Berman-Huntington points and lines data
contour.im

Contour plot of pixel image
model.matrix.ppm

Extract Design Matrix from Point Process Model
box3

Three-Dimensional Box
is.ppm

Test Whether An Object Is A Fitted Point Process Model
diameter

Diameter of a Window
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
hamster

Aherne's hamster tumour data
persp.im

Perspective Plot of Pixel Image
as.rectangle

Window Frame
shift.ppp

Apply Vector Translation To Point Pattern
concatxy

Concatenate x,y Coordinate Vectors
chorley

Chorley-Ribble Cancer Data
Kinhom

Inhomogeneous K-function
Jdot

Multitype J Function (i-to-any)
miplot

Morishita Index Plot
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
distfun

Distance Map as a Function
append.psp

Combine Two Line Segment Patterns
eval.im

Evaluate Expression Involving Pixel Images
istat

Point and Click Interface for Exploratory Analysis of Point Pattern
plot.im

Plot a Pixel Image
letterR

Window in Shape of Letter R
gridweights

Compute Quadrature Weights Based on Grid Counts
hyperframe

Hyper Data Frame
Kcross

Multitype K Function (Cross-type)
plot.psp

plot a Spatial Line Segment Pattern
rStrauss

Perfect Simulation of the Strauss Process
rmhmodel.list

Define Point Process Model for Metropolis-Hastings Simulation.
nztrees

New Zealand Trees Point Pattern
Extract.tess

Extract or Replace Subset of Tessellation
endpoints.psp

Endpoints of Line Segment Pattern
eval.fasp

Evaluate Expression Involving Function Arrays
as.data.frame.psp

Coerce Line Segment Pattern to a Data Frame
discpartarea

Area of Part of Disc
clickppp

Interactively Add Points
Kdot.inhom

Inhomogeneous Multitype K Dot Function
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
midpoints.psp

Midpoints of Line Segment Pattern
by.im

Apply Function to Image Broken Down by Factor
delaunay

Delaunay Triangulation of Point Pattern
update.ppm

Update a Fitted Point Process Model
disc

Circular Window
is.multitype.ppm

Test Whether A Point Process Model is Multitype
crossing.psp

Crossing Points of Two Line Segment Patterns
anova.ppm

ANOVA for Fitted Point Process Models
pcfcross

Multitype pair correlation function
Pairwise

Generic Pairwise Interaction model
owin.object

Class owin
ponderosa

Ponderosa Pine Tree Point Pattern
closing

Morphological Closing
as.owin

Convert Data To Class owin
spatstat-deprecated

Deprecated spatstat functions
crossdist.default

Pairwise distances between two different sets of points
distmap.ppp

Distance Map of Point Pattern
rmhmodel.default

Build Point Process Model for Metropolis-Hastings Simulation.
ppp.object

Class of Point Patterns
eem

Exponential Energy Marks
coef.ppm

Coefficients of Fitted Point Process Model
discretise

Safely Convert Point Pattern Window to Binary Mask
dilated.areas

Areas of Morphological Dilations
stieltjes

Compute Integral of Function Against Cumulative Distribution
bei

Tropical rain forest trees
is.empty

Test Whether An Object Is Empty
finpines

Pine saplings in Finland.
is.multitype

Test whether Object is Multitype
bounding.box.xy

Convex Hull of Points
multiplicity.ppp

Count Multiplicity of Duplicate Points
summary.im

Summarizing a Pixel Image
markcorrint

Mark Correlation Integral
data.ppm

Extract Original Data from a Fitted Point Process Model
incircle

Find Largest Circle Inside Window
fitin.ppm

Extract the Interaction from a Fitted Point Process Model
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
pairdist

Pairwise distances
pp3

Three Dimensional Point Pattern
longleaf

Longleaf Pines Point Pattern
inforder.family

Infinite Order Interaction Family
plot.kppm

Plot a fitted cluster point process
plot.owin

Plot a Spatial Window
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
nncross

Nearest Neighbours Between Two Patterns
im.object

Class of Images
bermantest

Berman's Tests for Point Process Model
pairsat.family

Saturated Pairwise Interaction Point Process Family
interp.im

Interpolate a Pixel Image
rsyst

Simulate systematic random point pattern
corners

Corners of a rectangle
rotate.owin

Rotate a Window
cut.ppp

Classify Points in a Point Pattern
distmap

Distance Map
nearestsegment

Find Line Segment Nearest to Each Point
plot.kstest

Plot a Spatial Kolmogorov-Smirnov Test
plot.fasp

Plot a Function Array
spruces

Spruces Point Pattern
print.quad

Print a Quadrature Scheme
plot.plotppm

Plot a plotppm Object Created by plot.ppm
rpoisline

Generate Poisson Random Line Process
perimeter

Perimeter Length of Window
iplot

Point and Click Interface for Displaying a Point Pattern
marktable

Tabulate Marks in Neighbourhood of Every Point in a Point Pattern
rNeymanScott

Simulate Neyman-Scott Process
quadscheme

Generate a Quadrature Scheme from a Point Pattern
by.ppp

Apply a Function to a Point Pattern Broken Down by Factor
matchingdist

Distance for a Point Pattern Matching
predict.ppm

Prediction from a Fitted Point Process Model
tess

Create a Tessellation
lansing

Lansing Woods Point Pattern
cut.im

Convert Pixel Image from Numeric to Factor
gridcentres

Rectangular grid of points
im

Create a Pixel Image Object
fv.object

Data Frames of Function Values
swedishpines

Swedish Pines Point Pattern
quantile.im

Sample Quantiles of Pixel Image
residuals.ppm

Residuals for Fitted Point Process Model
rMaternII

Simulate Matern Model II
density.ppp

Kernel Smoothed Intensity of Point Pattern
union.quad

Union of Data and Dummy Points
shift.im

Apply Vector Translation To Pixel Image
simplify.owin

Approximate a Polygon by a Simpler Polygon
redwood

California Redwoods Point Pattern (Ripley's Subset)
fryplot

Fry Plot of Point Pattern
is.marked

Test Whether Marks Are Present
distmap.owin

Distance Map of Window
plot.bermantest

Plot Result of Berman Test
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
mincontrast

Method of Minimum Contrast
infline

Infinite Straight Lines
summary.listof

Summary of a List of Things
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
cells

Biological Cells Point Pattern
lut

Lookup Tables
localK

Neighbourhood density function
kppm

Fit cluster point process model
effectfun

Compute Fitted Effect of a Spatial Covariate in a Point Process Model
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
owin

Create a Window
spatstat-internal

Internal spatstat functions
pairdist.psp

Pairwise distances between line segments
is.subset.owin

Determine Whether One Window is Contained In Another
intersect.owin

Intersection, Union or Set Subtraction of Two Windows
japanesepines

Japanese Pines Point Pattern
density.psp

Kernel Smoothing of Line Segment Pattern
progressreport

Print Progress Reports
is.im

Test Whether An Object Is A Pixel Image
quadrat.test

Chi-Squared Dispersion Test for Spatial Point Pattern Based on Quadrat Counts
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
psp.object

Class of Line Segment Patterns
rshift.psp

Randomly Shift a Line Segment Pattern
lengths.psp

Lengths of Line Segments
project2segment

Move Point To Nearest Line
methods.box3

Methods for Three-Dimensional Box
quad.object

Class of Quadrature Schemes
plot.listof

Plot a List of Things
shift.owin

Apply Vector Translation To Window
tiles

Extract List of Tiles in a Tessellation
plot.fv

Plot Function Values
smooth.ppp

Spatial smoothing of observations at irregular points
methods.pp3

Methods for three-dimensional point patterns
print.ppm

Print a Fitted Point Process Model
raster.x

Cartesian Coordinates for a Pixel Raster
rotate.ppp

Rotate a Point Pattern
ppm.object

Class of Fitted Point Process Models
nearest.raster.point

Find Pixel Nearest to a Given Point
rescale.ppp

Convert Point Pattern to Another Unit of Length
rescale

Convert dataset to another unit of length
pairdist.ppp

Pairwise distances
urkiola

Urkiola Woods Point Pattern
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
quadratcount

Quadrat counting for a point pattern
rescue.rectangle

Convert Window Back To Rectangle
plot.hyperframe

Plot Entries in a Hyperframe
qqplot.ppm

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

Nearest-Neighbour Correlation Indices of Marked Point Pattern
plot.splitppp

Plot a List of Point Patterns
fitted.ppm

Fitted Conditional Intensity for Point Process Model
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
rGaussPoisson

Simulate Gauss-Poisson Process
rmpoint

Generate N Random Multitype Points
heather

Diggle's Heather Data
rpoint

Generate N Random Points
square

Square Window
rmpoispp

Generate Multitype Poisson Point Pattern
runifpointOnLines

Generate N Uniform Random Points On Line Segments
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
is.owin

Test Whether An Object Is A Window
logLik.ppm

Log Likelihood for Poisson Point Process Model
mean.im

Mean, Median and Range of Pixel Values in an Image
shift

Apply Vector Translation
shapley

Galaxies in the Shapley Supercluster
predict.kppm

Prediction from a Fitted Cluster Point Process Model
suffstat

Sufficient Statistic of Point Process Model
plot.quad

plot a Spatial Quadrature Scheme
pixellate.ppp

Convert Point Pattern to Pixel Image
murchison

Murchison gold deposits
unique.ppp

Extract Unique Points from a Spatial Point Pattern
pcf.fv

Pair Correlation Function obtained from K Function
pointsOnLines

Place Points Evenly Along Specified Lines
print.psp

Print Brief Details of a Line Segment Pattern Dataset
rstrat

Simulate Stratified Random Point Pattern
spatstat.options

Internal Options in Spatstat Package
pairdist.default

Pairwise distances
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
rcell

Simulate Baddeley-Silverman Cell Process
rlinegrid

Generate grid of parallel lines with random displacement
nnwhich

Nearest neighbour
pppmatching

Create a Point Matching
summary.splitppp

Summary of a Split Point Pattern
rshift

Random Shift
summary.owin

Summary of a Spatial Window
profilepl

Profile Maximum Pseudolikelihood
summary.ppm

Summarizing a Fitted Point Process Model
setcov

Set Covariance of a Window
rmh.default

Simulate Point Process Models using the Metropolis-Hastings Algorithm.
pcf.fasp

Pair Correlation Function obtained from array of K functions
reach

Interaction Distance of a Point Process
pppmatching.object

Class of Point Matchings
runifdisc

Generate N Uniform Random Points in a Disc
pairwise.family

Pairwise Interaction Process Family
rMatClust

Simulate Matern Cluster Process
ppx

Multidimensional Space-Time Point Pattern
rpoispp

Generate Poisson Point Pattern
rpoislinetess

Poisson Line Tessellation
pcf.ppp

Pair Correlation Function of Point Pattern
rMosaicSet

Mosaic Random Set
quadrat.test.splitppp

Chi-Squared Test of CSR for Split Point Pattern
ppp

Create a Point Pattern
superimpose

Superimpose Several Point Patterns
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
pixellate

Convert Spatial Object to Pixel Image
rpoisppOnLines

Generate Poisson Point Pattern on Line Segments
unitname

Name for Unit of Length
rSSI

Simulate Simple Sequential Inhibition
rmh.ppm

Simulate from a Fitted Point Process Model
OrdThresh

Ord's Interaction model
ord.family

Ord Interaction Process Family
psp

Create a Line Segment Pattern
pixelquad

Quadrature Scheme Based on Pixel Grid
plot.colourmap

Plot a Colour Map
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
plot.ppm

plot a Fitted Point Process Model
rshift.ppp

Randomly Shift a Point Pattern
scanpp

Read Point Pattern From Data File
summary.psp

Summary of a Line Segment Pattern Dataset
rjitter

Random Perturbation of a Point Pattern
selfcrossing.psp

Crossing Points in a Line Segment Pattern
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
rshift.splitppp

Randomly Shift a List of Point Patterns
rthin

Random Thinning
rThomas

Simulate Thomas Process
as.mask

Pixel Image Approximation of a Window
rotate

Rotate
simulate.ppm

Simulate a Fitted Gibbs Point Process Model
ppm

Fit Point Process Model to Data
as.psp

Convert Data To Class psp
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
spatstat-package

The Spatstat Package
connected

Connected components of an image or window
rMaternI

Simulate Matern Model I
spokes

Spokes pattern of dummy points
reduced.sample

Reduced Sample Estimator using Histogram Data
with.fv

Evaluate an Expression in a Function Table
vertices

Vertices of a Window
shift.psp

Apply Vector Translation To Line Segment Pattern
rlabel

Random Re-Labelling of Point Pattern
update.kppm

Update a Fitted Cluster Point Process Model
with.hyperframe

Evaluate an Expression in Each Row of a Hyperframe
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
solutionset

Evaluate Logical Expression Involving Pixel Images and Return Region Where Expression is True
trim.rectangle

Cut margins from rectangle
rpoispp3

Generate Poisson Point Pattern in Three Dimensions
crossdist.psp

Pairwise distances between two different line segment patterns
simulate.kppm

Simulate a Fitted Cluster Point Process Model
simdat

Simulated Point Pattern
split.ppp

Divide Point Pattern into Sub-patterns
summary.quad

Summarizing a Quadrature Scheme
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
diameter.box3

Geometrical Calculations for Three-Dimensional Box
runifpoint

Generate N Uniform Random Points
model.images

Compute Images of Constructed Covariates
superimposePSP

Superimpose Several Line Segment Patterns
lurking

Lurking variable plot
nndist

Nearest neighbour distances
nndist.psp

Nearest neighbour distances between line segments
plot.pp3

Plot a three-dimensional point pattern
pppdist

Distance Between Two Point Patterns
print.owin

Print Brief Details of a Spatial Window
quadratresample

Resample a Point Pattern by Resampling Quadrats
rescale.im

Convert Pixel Image to Another Unit of Length
ripras

Estimate window from points alone
rotate.psp

Rotate a Line Segment Pattern
Extract.fasp

Extract Subset of Function Array
Ord

Generic Ord Interaction model
runifpoint3

Generate N Uniform Random Points in Three Dimensions
setmarks

Set or Reset the Marks in a Point Pattern
unmark

Remove Marks
Kest

K-function
allstats

Calculate four standard summary functions of a point pattern.
affine.owin

Apply Affine Transformation To Window
bdist.tiles

Distance to Boundary of Window
centroid.owin

Centroid of a window
deltametric

Delta Metric
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
is.marked.ppp

Test Whether A Point Pattern is Marked
kstest.ppm

Kolmogorov-Smirnov Test for Point Process Model
pixellate.owin

Convert Window to Pixel Image
plot.tess

Plot a tessellation
print.ppp

Print Brief Details of a Point Pattern Dataset
rMosaicField

Mosaic Random Field
rescale.owin

Convert Window to Another Unit of Length
rmhmodel.ppm

Interpret Fitted Model for Metropolis-Hastings Simulation.
split.im

Divide Image Into Sub-images
summary.ppp

Summary of a Point Pattern Dataset