Learn R Programming

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

spatstat (version 1.17-0)

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 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, 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.17-0

License

GPL (>= 2)

Maintainer

Adrian Baddeley

Last Published

October 22nd, 2009

Functions in spatstat (1.17-0)

Gmulti

Marked Nearest Neighbour Distance Function
Kcross

Multitype K Function (Cross-type)
Kdot

Multitype K Function (i-to-any)
Iest

Estimate the I-function
Emark

Diagnostics for random marking
Extract.splitppp

Extract or Replace Sub-Patterns
BadGey

Hybrid Geyer Point Process Model
Hest

Spherical Contact Distribution Function
Kinhom

Inhomogeneous K-function
Lcross

Multitype L-function (cross-type)
Kcross.inhom

Inhomogeneous Cross K Function
Extract.im

Extract Subset of Image
Saturated

Saturated Pairwise Interaction model
Extract.tess

Extract or Replace Subset of Tessellation
Extract.fv

Extract Subset of Function Values
alltypes

Calculate Summary Statistic for All Types in a Multitype Point Pattern
Gest

Nearest Neighbour Distance Function G
Kmulti

Marked K-Function
Lcross.inhom

Inhomogeneous Cross Type L Function
Extract.listof

Extract or Replace Subset of a List of Things
clickppp

Interactively Add Points
Pairwise

Generic Pairwise Interaction model
Jdot

Multitype J Function (i-to-any)
as.matrix.im

Convert Pixel Image to Matrix
Fest

Estimate the empty space function F
Kest.fft

K-function using FFT
angles.psp

Orientation Angles of Line Segments
Kdot.inhom

Inhomogeneous Multitype K Dot Function
affine

Apply Affine Transformation
Gcross

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

Geyer's Saturation Point Process Model
Extract.fasp

Extract Subset of Function Array
Jcross

Multitype J Function (i-to-j)
Gdot

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

Generic Ord Interaction model
complement.owin

Take Complement of a Window
as.polygonal

Convert a Window to a Polygonal Window
Ldot

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

Difference of Disc Areas
Strauss

The Strauss Point Process Model
demopat

Artificial Data Point Pattern
cells

Biological Cells Point Pattern
deltametric

Delta Metric
AreaInter

The Area Interaction Point Process Model
Kmeasure

Reduced Second Moment Measure
closing

Morphological Closing
DiggleGratton

Diggle-Gratton model
Linhom

L-function
SatPiece

Piecewise Constant Saturated Pairwise Interaction Point Process Model
Jmulti

Marked J Function
envelope

Simulation envelopes of summary function
as.tess

Convert Data To Tessellation
affine.psp

Apply Affine Transformation To Line Segment Pattern
betacells

Beta Ganglion Cells in Cat Retina
anova.ppm

ANOVA for Fitted Point Process Models
eval.fv

Evaluate Expression Involving Functions
bramblecanes

Hutchings' Bramble Canes data
Softcore

The Soft Core Point Process Model
Lest

L-function
as.data.frame.ppp

Coerce Point Pattern to a Data Frame
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
MultiStrauss

The Multitype Strauss Point Process Model
as.mask

Pixel Image Approximation of a Window
areaGain

Difference of Disc Areas
default.dummy

Generate a Default Pattern of Dummy Points
bounding.box.xy

Convex Hull of Points
compatible.fasp

Test Whether Two Function Arrays Are Compatible
Extract.quad

Subset of Quadrature Scheme
by.im

Apply Function to Image Broken Down by Factor
anemones

Beadlet Anemones Data
amacrine

Hughes' Amacrine Cell Data
affine.owin

Apply Affine Transformation To Window
bronzefilter

Bronze gradient filter data
LennardJones

The Lennard-Jones Potential
ants

Harkness-Isham ants' nests data
as.rectangle

Window Frame
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
colourmap

Colour Lookup Tables
fasp.object

Function Arrays for Spatial Patterns
expand.owin

Expand Window By Factor
affine.ppp

Apply Affine Transformation To Point Pattern
as.im

Convert to Pixel Image
OrdThresh

Ord's Interaction model
as.ppp

Convert Data To Class ppp
bdist.points

Distance to Boundary of Window
allstats

Calculate four standard summary functions of a point pattern.
Extract.psp

Extract Subset of Line Segment Pattern
Ldot.inhom

Inhomogeneous Multitype L Dot Function
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
StraussHard

The Strauss / Hard Core Point Process Model
as.psp

Convert Data To Class psp
Kest

K-function
Extract.ppp

Extract or Replace Subset of Point Pattern
Jest

Estimate the J-function
intersect.tess

Intersection of Two Tessellations
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
hyperframe

Hyper Data Frame
dilation

Morphological Dilation
Replace.im

Reset Values in Subset of Image
distmap.ppp

Distance Map of Point Pattern
clickpoly

Interactively Define a Polygon
by.ppp

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

Berman-Huntington points and lines data
bei

Tropical rain forest trees
spatstat-internal

Internal spatstat functions
corners

Corners of a rectangle
area.owin

Area of a Window
lgcp.estK

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

Create a Point Matching
Poisson

Poisson Point Process Model
cut.im

Convert Pixel Image from Numeric to Factor
lengths.psp

Lengths of Line Segments
chorley

Chorley-Ribble Cancer Data
discpartarea

Area of Part of Disc
contour.im

Contour plot of pixel image
append.psp

Combine Two Line Segment Patterns
bdist.pixels

Distance to Boundary of Window
data.ppm

Extract Original Data from a Fitted Point Process Model
endpoints.psp

Endpoints of Line Segment Pattern
convexhull

Convex Hull
levelset

Level Set of a Pixel Image
spatstat-deprecated

Deprecated spatstat functions
eval.fasp

Evaluate Expression Involving Function Arrays
crossdist.default

Pairwise distances between two different sets of points
compatible.fv

Test Whether Two Function Objects Are Compatible
diameter

Diameter of a Window
as.owin

Convert Data To Class owin
ord.family

Ord Interaction Process Family
bermantest

Berman's Tests for Point Process Model
iplot

Point and Click Interface for Displaying a Point Pattern
density.ppp

Kernel Smoothed Intensity of Point Pattern
distmap.owin

Distance Map of Window
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
as.data.frame.psp

Coerce Line Segment Pattern to a Data Frame
gridweights

Compute Quadrature Weights Based on Grid Counts
mean.im

Mean, Median and Range of Pixel Values in an Image
centroid.owin

Centroid of a window
clarkevans

Clark and Evans Aggregation Index
is.owin

Test Whether An Object Is A Window
ewcdf

Weighted Empirical Cumulative Distribution Function
heather

Diggle's Heather Data
crossdist

Pairwise distances
delaunay

Delaunay Triangulation of Point Pattern
psp.object

Class of Line Segment Patterns
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
plot.ppm

plot a Fitted Point Process Model
gpc2owin

Convert Polygonal Region into Different Format
eval.im

Evaluate Expression Involving Pixel Images
bounding.box

Bounding Box of a Window or Point Pattern
rStrauss

Perfect Simulation of the Strauss Process
compatible.im

Test Whether Two Pixel Images Are Compatible
distmap.psp

Distance Map of Line Segment Pattern
markvario

Mark Variogram
logLik.ppm

Log Likelihood for Poisson Point Process Model
plot.hyperframe

Plot Entries in a Hyperframe
nndist

Nearest neighbour distances
nncross

Nearest Neighbours Between Two Patterns
eem

Exponential Energy Marks
chop.tess

Subdivide a Window or Tessellation using a Set of Lines
discretise

Safely Convert Point Pattern Window to Binary Mask
quadratcount

Quadrat counting for a point pattern
is.empty

Test Whether An Object Is Empty
finpines

Pine saplings in Finland.
pcf.fasp

Pair Correlation Function obtained from array of K functions
crossing.psp

Crossing Points of Two Line Segment Patterns
inside.owin

Test Whether Points Are Inside A Window
pcf.ppp

Pair Correlation Function of Point Pattern
concatxy

Concatenate x,y Coordinate Vectors
eval.hyper

Evaluate an Expression in Each Row of a Hyperframe
plot.colourmap

Plot a Colour Map
clip.infline

Intersect Infinite Straight Lines with a Window
nndist.psp

Nearest neighbour distances between line segments
rthin

Random Thinning
persp.im

Perspective Plot of Pixel Image
plot.im

Plot a Pixel Image
rSSI

Simulate Simple Sequential Inhibition
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
infline

Infinite Straight Lines
rmh.default

Simulate Point Process Models using the Metropolis-Hastings Algorithm.
connected

Connected components of an image or window
dirichlet

Dirichlet Tessellation of Point Pattern
adaptive.density

Intensity Estimate of Point Pattern Using Tessellation
density.psp

Kernel Smoothing of Line Segment Pattern
plot.fasp

Plot a Function Array
harmonic

Basis for Harmonic Functions
erosion

Morphological Erosion
kppm

Fit cluster point process model
lurking

Lurking variable plot
letterR

Window in Shape of Letter R
rpoislinetess

Poisson Line Tessellation
print.ppm

Print a Fitted Point Process Model
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
fryplot

Fry Plot of Point Pattern
profilepl

Profile Maximum Pseudolikelihood
pcf

Pair Correlation Function
pairdist

Pairwise distances
hamster

Aherne's hamster tumour data
is.convex

Test Whether a Window is Convex
is.marked

Test Whether Marks Are Present
japanesepines

Japanese Pines Point Pattern
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
is.ppm

Test Whether An Object Is A Fitted Point Process Model
rmpoispp

Generate Multitype Poisson Point Pattern
is.multitype.ppp

Test Whether A Point Pattern is Multitype
pairdist.default

Pairwise distances
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
is.marked.ppp

Test Whether A Point Pattern is Marked
midpoints.psp

Midpoints of Line Segment Pattern
plot.owin

Plot a Spatial Window
hist.im

Histogram of Pixel Values in an Image
ppm

Fit Point Process Model to Data
distmap

Distance Map
coef.ppm

Coefficients of Fitted Point Process Model
im

Create a Pixel Image Object
is.im

Test Whether An Object Is A Pixel Image
is.marked.ppm

Test Whether A Point Process Model is Marked
spatstat.options

Internal Options in Spatstat Package
effectfun

Compute Fitted Effect of a Spatial Covariate in a Point Process Model
pcf.fv

Pair Correlation Function obtained from K Function
quad.ppm

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

Intersection or Union of Two Windows
distfun

Distance Map as a Function
model.images

Compute Images of Constructed Covariates
rsyst

Simulate systematic random point pattern
tess

Create a Tessellation
gridcentres

Rectangular grid of points
blur

Apply Gaussian Blur to a Pixel Image
fv.object

Data Frames of Function Values
identify.ppp

Identify Points in a Point Pattern
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
ponderosa

Ponderosa Pine Tree Point Pattern
inforder.family

Infinite Order Interaction Family
fitted.ppm

Fitted Conditional Intensity for Point Process Model
convexhull.xy

Convex Hull of Points
plot.kppm

Plot a fitted cluster point process
ppp

Create a Point Pattern
summary.quad

Summarizing a Quadrature Scheme
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
murchison

Murchison gold deposits
reach

Interaction Distance of a Point Process
shapley

Galaxies in the Shapley Supercluster
nbfires

Point Patterns of New Brunswick Forest Fires
nztrees

New Zealand Trees Point Pattern
is.subset.owin

Determine Whether One Window is Contained In Another
rpoisline

Generate Poisson Random Line Process
interp.im

Interpolate a Pixel Image
plot.quad

plot a Spatial Quadrature Scheme
cut.ppp

Classify Points in a Point Pattern
rMosaicSet

Mosaic Random Set
disc

Circular Window
crossdist.ppp

Pairwise distances between two different point patterns
model.matrix.ppm

Extract Design Matrix from Point Process Model
quadrat.test.splitppp

Chi-Squared Test of CSR for Split Point Pattern
is.multitype.ppm

Test Whether A Point Process Model is Multitype
is.multitype

Test whether Object is Multitype
runifdisc

Generate N Uniform Random Points in a Disc
pairsat.family

Saturated Pairwise Interaction Point Process Family
ppp.object

Class of Point Patterns
pointsOnLines

Place Points Evenly Along Specified Lines
fitin.ppm

Extract the Interaction from a Fitted Point Process Model
markcorr

Mark Correlation Function
rGaussPoisson

Simulate Gauss-Poisson Process
rThomas

Simulate Thomas Process
quadrats

Divide Region into Quadrats
dilated.areas

Areas of Morphological Dilations
quadscheme

Generate a Quadrature Scheme from a Point Pattern
rshift.ppp

Randomly Shift a Point Pattern
nearest.raster.point

Find Pixel Nearest to a Given Point
mincontrast

Method of Minimum Contrast
predict.ppm

Prediction from a Fitted Point Process Model
runifpointOnLines

Generate N Uniform Random Points On Line Segments
kstest.ppm

Kolmogorov-Smirnov Test for Point Process Model
rcell

Simulate Baddeley-Silverman Cell Process
crossdist.psp

Pairwise distances between two different line segment patterns
pairdist.ppp

Pairwise distances
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
im.object

Class of Images
rMaternII

Simulate Matern Model II
localK

Neighbourhood density function
summary.owin

Summary of a Spatial Window
rNeymanScott

Simulate Neyman-Scott Process
pppmatching.object

Class of Point Matchings
nncorr

Nearest-Neighbour Correlation Indices of Marked Point Pattern
selfcrossing.psp

Crossing Points in a Line Segment Pattern
progressreport

Print Progress Reports
incircle

Find Largest Circle Inside Window
ppm.object

Class of Fitted Point Process Models
miplot

Morishita Index Plot
raster.x

Cartesian Coordinates for a Pixel Raster
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
lansing

Lansing Woods Point Pattern
print.owin

Print Brief Details of a Spatial Window
owin.object

Class owin
print.psp

Print Brief Details of a Line Segment Pattern Dataset
owin

Create a Window
plot.tess

Plot a tessellation
redwood

California Redwoods Point Pattern (Ripley's Subset)
eroded.areas

Areas of Morphological Erosions
project2segment

Move Point To Nearest Line
plot.listof

Plot a List of Things
spokes

Spokes pattern of dummy points
nearestsegment

Find Line Segment Nearest to Each Point
superimposePSP

Superimpose Several Line Segment Patterns
unique.ppp

Extract Unique Points from a Spatial Point Pattern
simulate.kppm

Simulate a Fitted Cluster Point Process Model
rotate.ppp

Rotate a Point Pattern
marktable

Tabulate Marks in Neighbourhood of Every Point in a Point Pattern
is.ppp

Test Whether An Object Is A Point Pattern
matchingdist

Distance for a Point Pattern Matching
pppdist

Distance Between Two Point Patterns
plot.psp

plot a Spatial Line Segment Pattern
print.ppp

Print Brief Details of a Point Pattern Dataset
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
shift.psp

Apply Vector Translation To Line Segment Pattern
rpoisppOnLines

Generate Poisson Point Pattern on Line Segments
print.im

Print Brief Details of an Image
opening

Morphological Opening
summary.psp

Summary of a Line Segment Pattern Dataset
rescale.owin

Convert Window to Another Unit of Length
istat

Point and Click Interface for Exploratory Analysis of Point Pattern
pixellate.owin

Convert Window to Pixel Image
plot.ppp

plot a Spatial Point Pattern
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
multiplicity.ppp

Count Multiplicity of Duplicate Points
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
rmpoint

Generate N Random Multitype Points
pairwise.family

Pairwise Interaction Process Family
perimeter

Perimeter Length of Window
longleaf

Longleaf Pines Point Pattern
plot.bermantest

Plot Result of Berman Test
print.quad

Print a Quadrature Scheme
reduced.sample

Reduced Sample Estimator using Histogram Data
markcorrint

Mark Correlation Integral
lut

Lookup Tables
shift.ppp

Apply Vector Translation To Point Pattern
union.quad

Union of Data and Dummy Points
residuals.ppm

Residuals for Fitted Point Process Model
rescale.im

Convert Pixel Image to Another Unit of Length
pcfcross

Multitype pair correlation function
quadrat.test

Chi-Squared Dispersion Test for Spatial Point Pattern Based on Quadrat Counts
pixelquad

Quadrature Scheme Based on Pixel Grid
simulate.ppm

Simulate a Fitted Gibbs Point Process Model
ripras

Estimate window from points alone
rstrat

Simulate Stratified Random Point Pattern
rotate.owin

Rotate a Window
psp

Create a Line Segment Pattern
rMosaicField

Mosaic Random Field
nnwhich

Nearest neighbour
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
rlinegrid

Generate grid of parallel lines with random displacement
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
rescue.rectangle

Convert Window Back To Rectangle
rpoint

Generate N Random Points
plot.splitppp

Plot a List of Point Patterns
rMatClust

Simulate Matern Cluster Process
rpoispp

Generate Poisson Point Pattern
rmhmodel.default

Build Point Process Model for Metropolis-Hastings Simulation.
rjitter

Random Perturbation of a Point Pattern
setmarks

Set or Reset the Marks in a Point Pattern
stieltjes

Compute Integral of Function Against Cumulative Distribution
square

Square Window
unitname

Name for Unit of Length
rotate

Rotate
spruces

Spruces Point Pattern
simplify.owin

Approximate a Polygon by a Simpler Polygon
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
quantile.im

Sample Quantiles of Pixel Image
rshift

Random Shift
markconnect

Mark Connection Function
scanpp

Read Point Pattern From Data File
rmh.ppm

Simulate from a Fitted Point Process Model
rescale.ppp

Convert Point Pattern to Another Unit of Length
summary.ppm

Summarizing a Fitted Point Process Model
rshift.psp

Randomly Shift a Line Segment Pattern
pixellate.ppp

Convert Point Pattern to Pixel Image
summary.splitppp

Summary of a Split Point Pattern
rmhmodel.list

Define Point Process Model for Metropolis-Hastings Simulation.
rlabel

Random Re-Labelling of Point Pattern
split.ppp

Divide Point Pattern into Sub-patterns
pixellate

Convert Spatial Object to Pixel Image
quadratresample

Resample a Point Pattern by Resampling Quadrats
runifpoint

Generate N Uniform Random Points
shift.owin

Apply Vector Translation To Window
shift

Apply Vector Translation
tiles

Extract List of Tiles in a Tessellation
swedishpines

Swedish Pines Point Pattern
with.fv

Evaluate an Expression in a Function Table
qqplot.ppm

Q-Q Plot of Residuals from Fitted Point Process Model
plot.plotppm

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

Interpret Fitted Model for Metropolis-Hastings Simulation.
pairdist.psp

Pairwise distances between line segments
predict.kppm

Prediction from a Fitted Cluster Point Process Model
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
rshift.splitppp

Randomly Shift a List of Point Patterns
plot.kstest

Plot a Spatial Kolmogorov-Smirnov Test
split.im

Divide Image Into Sub-images
rotate.psp

Rotate a Line Segment Pattern
summary.ppp

Summary of a Point Pattern Dataset
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
trim.rectangle

Cut margins from rectangle
spatstat-package

The Spatstat Package
shift.im

Apply Vector Translation To Pixel Image
unmark

Remove Marks
simdat

Simulated Point Pattern
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
setcov

Set Covariance of a Window
summary.im

Summarizing a Pixel Image
superimpose

Superimpose Several Point Patterns
solutionset

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

Summary of a List of Things
suffstat

Sufficient Statistic of Point Process Model
update.ppm

Update a Fitted Point Process Model
update.kppm

Update a Fitted Cluster Point Process Model
urkiola

Urkiola Woods Point Pattern
plot.fv

Plot Function Values
quad.object

Class of Quadrature Schemes
rMaternI

Simulate Matern Model I
rescale

Convert dataset to another unit of length
smooth.ppp

Spatial smoothing of observations at irregular points
vertices

Vertices of a Window