Learn R Programming

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

spatstat (version 1.17-5)

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

17,668

Version

1.17-5

License

GPL (>= 2)

Maintainer

Adrian Baddeley

Last Published

January 6th, 2010

Functions in spatstat (1.17-5)

Strauss

The Strauss Point Process Model
cells

Biological Cells Point Pattern
areaGain

Difference of Disc Areas
Extract.listof

Extract or Replace Subset of a List of Things
DiggleGratton

Diggle-Gratton model
Ord

Generic Ord Interaction model
K3est

K-function of a Three-Dimensional Point Pattern
Emark

Diagnostics for random marking
distmap.psp

Distance Map of Line Segment Pattern
bdist.pixels

Distance to Boundary of Window
append.psp

Combine Two Line Segment Patterns
fryplot

Fry Plot of Point Pattern
diameter

Diameter of a Window
Jmulti

Marked J Function
distmap.owin

Distance Map of Window
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
SatPiece

Piecewise Constant Saturated Pairwise Interaction Point Process Model
delaunay

Delaunay Triangulation of Point Pattern
as.im

Convert to Pixel Image
affine.ppp

Apply Affine Transformation To Point Pattern
Kest.fft

K-function using FFT
is.ppp

Test Whether An Object Is A Point Pattern
Lest

L-function
anova.ppm

ANOVA for Fitted Point Process Models
Fest

Estimate the empty space function F
as.mask

Pixel Image Approximation of a Window
is.marked

Test Whether Marks Are Present
Saturated

Saturated Pairwise Interaction model
Gmulti

Marked Nearest Neighbour Distance Function
Extract.quad

Subset of Quadrature Scheme
Lcross.inhom

Inhomogeneous Cross Type L Function
data.ppm

Extract Original Data from a Fitted Point Process Model
Geyer

Geyer's Saturation Point Process Model
hamster

Aherne's hamster tumour data
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
affine.psp

Apply Affine Transformation To Line Segment Pattern
Pairwise

Generic Pairwise Interaction model
Extract.im

Extract Subset of Image
clickpoly

Interactively Define a Polygon
Kdot.inhom

Inhomogeneous Multitype K Dot Function
as.matrix.im

Convert Pixel Image to Matrix
pcfcross

Multitype pair correlation function (cross-type)
as.box3

Convert Data to Three-Dimensional Box
Gcross

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

Calculate four standard summary functions of a point pattern.
Poisson

Poisson Point Process Model
Kcross

Multitype K Function (Cross-type)
compatible.fasp

Test Whether Two Function Arrays Are Compatible
disc

Circular Window
interp.im

Interpolate a Pixel Image
clickppp

Interactively Add Points
by.im

Apply Function to Image Broken Down by Factor
Ldot.inhom

Inhomogeneous Multitype L Dot Function
dilation

Morphological Dilation
MultiStrauss

The Multitype Strauss Point Process Model
distmap

Distance Map
pairdist

Pairwise distances
lurking

Lurking variable plot
G3est

Nearest Neighbour Distance Distribution Function of a Three-Dimensional Point Pattern
as.hyperframe

Convert Data to Hyperframe
Gdot

Multitype Nearest Neighbour Distance Function (i-to-any)
Extract.fasp

Extract Subset of Function Array
plot.tess

Plot a tessellation
discretise

Safely Convert Point Pattern Window to Binary Mask
Extract.tess

Extract or Replace Subset of Tessellation
as.polygonal

Convert a Window to a Polygonal Window
by.ppp

Apply a Function to a Point Pattern Broken Down by Factor
eroded.areas

Areas of Morphological Erosions
amacrine

Hughes' Amacrine Cell Data
as.psp

Convert Data To Class psp
F3est

Empty Space Function of a Three-Dimensional Point Pattern
cut.im

Convert Pixel Image from Numeric to Factor
concatxy

Concatenate x,y Coordinate Vectors
demopat

Artificial Data Point Pattern
Jcross

Multitype J Function (i-to-j)
is.empty

Test Whether An Object Is Empty
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
area.owin

Area of a Window
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
dummy.ppm

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

Convert Data To Tessellation
is.convex

Test Whether a Window is Convex
angles.psp

Orientation Angles of Line Segments
ants

Harkness-Isham ants' nests data
affine.owin

Apply Affine Transformation To Window
adaptive.density

Intensity Estimate of Point Pattern Using Tessellation
compatible.im

Test Whether Two Pixel Images Are Compatible
midpoints.psp

Midpoints of Line Segment Pattern
BadGey

Hybrid Geyer Point Process Model
connected

Connected components of an image or window
Replace.im

Reset Values in Subset of Image
eval.im

Evaluate Expression Involving Pixel Images
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
Iest

Estimate the I-function
bermantest

Berman's Tests for Point Process Model
methods.box3

Methods for Three-Dimensional Box
coef.ppm

Coefficients of Fitted Point Process Model
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
fitted.ppm

Fitted Conditional Intensity for Point Process Model
ppm

Fit Point Process Model to Data
discpartarea

Area of Part of Disc
effectfun

Compute Fitted Effect of a Spatial Covariate in a Point Process Model
levelset

Level Set of a Pixel Image
OrdThresh

Ord's Interaction model
bounding.box

Bounding Box of a Window or Point Pattern
colourmap

Colour Lookup Tables
Kmulti

Marked K-Function
default.dummy

Generate a Default Pattern of Dummy Points
as.owin

Convert Data To Class owin
as.data.frame.psp

Coerce Line Segment Pattern to a Data Frame
Extract.fv

Extract Subset of Function Values
im

Create a Pixel Image Object
crossdist.pp3

Pairwise distances between two different three-dimensional point patterns
AreaInter

The Area Interaction Point Process Model
alltypes

Calculate Summary Statistic for All Types in a Multitype Point Pattern
bdist.points

Distance to Boundary of Window
lgcp.estK

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

Reduced Second Moment Measure
crossdist.ppp

Pairwise distances between two different point patterns
Jest

Estimate the J-function
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
envelope

Simulation envelopes of summary function
endpoints.psp

Endpoints of Line Segment Pattern
nndist

Nearest neighbour distances
crossing.psp

Crossing Points of Two Line Segment Patterns
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
Gest

Nearest Neighbour Distance Function G
crossdist

Pairwise distances
pcf.ppp

Pair Correlation Function of Point Pattern
Kest

K-function
areaLoss

Difference of Disc Areas
gridcentres

Rectangular grid of points
eem

Exponential Energy Marks
plot.ppp

plot a Spatial Point Pattern
Kdot

Multitype K Function (i-to-any)
Linhom

L-function
clip.infline

Intersect Infinite Straight Lines with a Window
Lcross

Multitype L-function (cross-type)
density.psp

Kernel Smoothing of Line Segment Pattern
density.ppp

Kernel Smoothed Intensity of Point Pattern
chop.tess

Subdivide a Window or Tessellation using a Set of Lines
bronzefilter

Bronze gradient filter data
is.multitype

Test whether Object is Multitype
Jdot

Multitype J Function (i-to-any)
rGaussPoisson

Simulate Gauss-Poisson Process
is.marked.ppm

Test Whether A Point Process Model is Marked
gridweights

Compute Quadrature Weights Based on Grid Counts
distfun

Distance Map as a Function
spatstat-deprecated

Deprecated spatstat functions
rmhmodel.default

Build Point Process Model for Metropolis-Hastings Simulation.
rMosaicSet

Mosaic Random Set
letterR

Window in Shape of Letter R
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
mincontrast

Method of Minimum Contrast
as.ppp

Convert Data To Class ppp
is.im

Test Whether An Object Is A Pixel Image
nearest.raster.point

Find Pixel Nearest to a Given Point
localK

Neighbourhood density function
intersect.tess

Intersection of Two Tessellations
istat

Point and Click Interface for Exploratory Analysis of Point Pattern
kppm

Fit cluster point process model
is.owin

Test Whether An Object Is A Window
fv.object

Data Frames of Function Values
hyperframe

Hyper Data Frame
pppmatching

Create a Point Matching
rlinegrid

Generate grid of parallel lines with random displacement
convexhull

Convex Hull
LennardJones

The Lennard-Jones Potential
lengths.psp

Lengths of Line Segments
Ldot

Multitype L-function (i-to-any)
pcf.fv

Pair Correlation Function obtained from K Function
nearestsegment

Find Line Segment Nearest to Each Point
box3

Three-Dimensional Box
plot.hyperframe

Plot Entries in a Hyperframe
kstest.ppm

Kolmogorov-Smirnov Test for Point Process Model
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
longleaf

Longleaf Pines Point Pattern
plot.kstest

Plot a Spatial Kolmogorov-Smirnov Test
Kcross.inhom

Inhomogeneous Cross K Function
blur

Apply Gaussian Blur to a Pixel Image
markconnect

Mark Connection Function
centroid.owin

Centroid of a window
expand.owin

Expand Window By Factor
gpc2owin

Convert Polygonal Region into Different Format
compatible.fv

Test Whether Two Function Objects Are Compatible
bdist.tiles

Distance to Boundary of Window
Extract.splitppp

Extract or Replace Sub-Patterns
as.rectangle

Window Frame
Kinhom

Inhomogeneous K-function
Extract.psp

Extract Subset of Line Segment Pattern
betacells

Beta Ganglion Cells in Cat Retina
inside.owin

Test Whether Points Are Inside A Window
crossdist.default

Pairwise distances between two different sets of points
nndist.pp3

Nearest neighbour distances in three dimensions
rknn

Theoretical Distribution of Nearest Neighbour Distance
is.ppm

Test Whether An Object Is A Fitted Point Process Model
as.hyperframe.ppx

Extract coordinates and marks of multidimensional point pattern
project2segment

Move Point To Nearest Line
is.subset.owin

Determine Whether One Window is Contained In Another
closing

Morphological Closing
corners

Corners of a rectangle
complement.owin

Take Complement of a Window
predict.kppm

Prediction from a Fitted Cluster Point Process Model
integral.im

Integral of a Pixel Image
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
opening

Morphological Opening
pixellate

Convert Spatial Object to Pixel Image
marktable

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

Weighted Empirical Cumulative Distribution Function
markvario

Mark Variogram
is.multitype.ppm

Test Whether A Point Process Model is Multitype
logLik.ppm

Log Likelihood for Poisson Point Process Model
crossdist.psp

Pairwise distances between two different line segment patterns
eval.fv

Evaluate Expression Involving Functions
quantile.im

Sample Quantiles of Pixel Image
StraussHard

The Strauss / Hard Core Point Process Model
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
raster.x

Cartesian Coordinates for a Pixel Raster
contour.im

Contour plot of pixel image
bounding.box.xy

Convex Hull of Points
eval.fasp

Evaluate Expression Involving Function Arrays
pixellate.owin

Convert Window to Pixel Image
pcfcross.inhom

Inhomogeneous Multitype Pair Correlation Function (Cross-Type)
fitin.ppm

Extract the Interaction from a Fitted Point Process Model
rStrauss

Perfect Simulation of the Strauss Process
as.data.frame.ppp

Coerce Point Pattern to a Data Frame
Hest

Spherical Contact Distribution Function
nncross

Nearest Neighbours Between Two Patterns
pp3

Three Dimensional Point Pattern
im.object

Class of Images
nnwhich.pp3

Nearest neighbours in three dimensions
diameter.box3

Geometrical Calculations for Three-Dimensional Box
inforder.family

Infinite Order Interaction Family
perimeter

Perimeter Length of Window
miplot

Morishita Index Plot
pcfinhom

Inhomogeneous Pair Correlation Function
plot.fasp

Plot a Function Array
Softcore

The Soft Core Point Process Model
markcorr

Mark Correlation Function
affine

Apply Affine Transformation
is.multitype.ppp

Test Whether A Point Pattern is Multitype
nnwhich

Nearest neighbour
print.psp

Print Brief Details of a Line Segment Pattern Dataset
finpines

Pine saplings in Finland.
pcf.fasp

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

Plot Function Values
chorley

Chorley-Ribble Cancer Data
matchingdist

Distance for a Point Pattern Matching
model.images

Compute Images of Constructed Covariates
plot.colourmap

Plot a Colour Map
redwood

California Redwoods Point Pattern (Ripley's Subset)
fasp.object

Function Arrays for Spatial Patterns
print.im

Print Brief Details of an Image
pcfdot.inhom

Inhomogeneous Multitype Pair Correlation Function (Type-i-To-Any-Type)
ponderosa

Ponderosa Pine Tree Point Pattern
harmonic

Basis for Harmonic Functions
ppx

Multidimensional Space-Time Point Pattern
bramblecanes

Hutchings' Bramble Canes data
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
ppm.object

Class of Fitted Point Process Models
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
plot.owin

Plot a Spatial Window
dilated.areas

Areas of Morphological Dilations
superimpose

Superimpose Several Point Patterns
plot.ppm

plot a Fitted Point Process Model
print.quad

Print a Quadrature Scheme
iplot

Point and Click Interface for Displaying a Point Pattern
erosion

Morphological Erosion
rescue.rectangle

Convert Window Back To Rectangle
murchison

Murchison gold deposits
quadscheme

Generate a Quadrature Scheme from a Point Pattern
rshift

Random Shift
plot.kppm

Plot a fitted cluster point process
japanesepines

Japanese Pines Point Pattern
rMaternI

Simulate Matern Model I
setmarks

Set or Reset the Marks in a Point Pattern
infline

Infinite Straight Lines
bei

Tropical rain forest trees
rpoispp3

Generate Poisson Point Pattern in Three Dimensions
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
deltametric

Delta Metric
spatstat-internal

Internal spatstat functions
anemones

Beadlet Anemones Data
dirichlet

Dirichlet Tessellation of Point Pattern
nncorr

Nearest-Neighbour Correlation Indices of Marked Point Pattern
heather

Diggle's Heather Data
mean.im

Mean, Median and Range of Pixel Values in an Image
hist.im

Histogram of Pixel Values in an Image
rescale.owin

Convert Window to Another Unit of Length
distmap.ppp

Distance Map of Point Pattern
rMaternII

Simulate Matern Model II
rSSI

Simulate Simple Sequential Inhibition
lut

Lookup Tables
ppp

Create a Point Pattern
pairwise.family

Pairwise Interaction Process Family
plot.listof

Plot a List of Things
spruces

Spruces Point Pattern
pairsat.family

Saturated Pairwise Interaction Point Process Family
setcov

Set Covariance of a Window
pcfdot

Multitype pair correlation function (i-to-any)
rmpoispp

Generate Multitype Poisson Point Pattern
convexhull.xy

Convex Hull of Points
methods.pp3

Methods for three-dimensional point patterns
rshift.ppp

Randomly Shift a Point Pattern
ripras

Estimate window from points alone
rpoislinetess

Poisson Line Tessellation
ppp.object

Class of Point Patterns
shift

Apply Vector Translation
print.ppp

Print Brief Details of a Point Pattern Dataset
pppmatching.object

Class of Point Matchings
periodify

Make Periodic Copies of a Spatial Pattern
pppdist

Distance Between Two Point Patterns
pixelquad

Quadrature Scheme Based on Pixel Grid
cut.ppp

Classify Points in a Point Pattern
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
quadratcount

Quadrat counting for a point pattern
multiplicity.ppp

Count Multiplicity of Duplicate Points
ord.family

Ord Interaction Process Family
qqplot.ppm

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

Plot a three-dimensional point pattern
pairdist.pp3

Pairwise distances in Three Dimensions
copper

Berman-Huntington points and lines data
pointsOnLines

Place Points Evenly Along Specified Lines
rNeymanScott

Simulate Neyman-Scott Process
reduced.sample

Reduced Sample Estimator using Histogram Data
intersect.owin

Intersection, Union or Set Subtraction of Two Windows
rcell

Simulate Baddeley-Silverman Cell Process
quad.object

Class of Quadrature Schemes
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
quadrats

Divide Region into Quadrats
profilepl

Profile Maximum Pseudolikelihood
methods.ppx

Methods for Multidimensional Space-Time Point Patterns
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
pairdist.ppp

Pairwise distances
split.ppp

Divide Point Pattern into Sub-patterns
owin

Create a Window
rescale.ppp

Convert Point Pattern to Another Unit of Length
rMatClust

Simulate Matern Cluster Process
plot.splitppp

Plot a List of Point Patterns
rpoispp

Generate Poisson Point Pattern
pairdist.default

Pairwise distances
plot.psp

plot a Spatial Line Segment Pattern
pixellate.ppp

Convert Point Pattern to Pixel Image
plot.im

Plot a Pixel Image
coords

Extract Coordinates of a Spatial or Spatiotemporal Point Pattern
rThomas

Simulate Thomas Process
is.marked.ppp

Test Whether A Point Pattern is Marked
quadratresample

Resample a Point Pattern by Resampling Quadrats
owin.object

Class owin
swedishpines

Swedish Pines Point Pattern
Extract.ppp

Extract or Replace Subset of Point Pattern
rMosaicField

Mosaic Random Field
pairdist.psp

Pairwise distances between line segments
square

Square Window
rotate.owin

Rotate a Window
summary.listof

Summary of a List of Things
superimposePSP

Superimpose Several Line Segment Patterns
nndist.psp

Nearest neighbour distances between line segments
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
identify.ppp

Identify Points in a Point Pattern
residuals.ppm

Residuals for Fitted Point Process Model
reach

Interaction Distance of a Point Process
quadrat.test

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

Simulate from a Fitted Point Process Model
rotate

Rotate
rmhmodel.ppm

Interpret Fitted Model for Metropolis-Hastings Simulation.
shapley

Galaxies in the Shapley Supercluster
incircle

Find Largest Circle Inside Window
smooth.ppp

Spatial smoothing of observations at irregular points
nbfires

Point Patterns of New Brunswick Forest Fires
psp.object

Class of Line Segment Patterns
persp.im

Perspective Plot of Pixel Image
predict.ppm

Prediction from a Fitted Point Process Model
model.matrix.ppm

Extract Design Matrix from Point Process Model
nztrees

New Zealand Trees Point Pattern
tiles

Extract List of Tiles in a Tessellation
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
clarkevans

Clark and Evans Aggregation Index
rescale.im

Convert Pixel Image to Another Unit of Length
rotate.psp

Rotate a Line Segment Pattern
rthin

Random Thinning
rpoisppOnLines

Generate Poisson Point Pattern on Line Segments
runifpoint

Generate N Uniform Random Points
selfcrossing.psp

Crossing Points in a Line Segment Pattern
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
summary.ppp

Summary of a Point Pattern Dataset
plot.plotppm

Plot a plotppm Object Created by plot.ppm
rjitter

Random Perturbation of a Point Pattern
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
unitname

Name for Unit of Length
print.owin

Print Brief Details of a Spatial Window
plot.bermantest

Plot Result of Berman Test
unmark

Remove Marks
rsyst

Simulate systematic random point pattern
whist

Weighted Histogram
plot.quad

plot a Spatial Quadrature Scheme
border

Border Region of a Window
simplify.owin

Approximate a Polygon by a Simpler Polygon
simulate.ppm

Simulate a Fitted Gibbs Point Process Model
spatstat-package

The Spatstat Package
runifdisc

Generate N Uniform Random Points in a Disc
progressreport

Print Progress Reports
runifpointOnLines

Generate N Uniform Random Points On Line Segments
rpoint

Generate N Random Points
simdat

Simulated Point Pattern
scanpp

Read Point Pattern From Data File
with.fv

Evaluate an Expression in a Function Table
rescale

Convert dataset to another unit of length
rmpoint

Generate N Random Multitype Points
unique.ppp

Extract Unique Points from a Spatial Point Pattern
summary.ppm

Summarizing a Fitted Point Process Model
tess

Create a Tessellation
markcorrint

Mark Correlation Integral
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
rmh.default

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

Compute Integral of Function Against Cumulative Distribution
update.kppm

Update a Fitted Cluster Point Process Model
summary.im

Summarizing a Pixel Image
shift.owin

Apply Vector Translation To Window
shift.psp

Apply Vector Translation To Line Segment Pattern
shift.im

Apply Vector Translation To Pixel Image
union.quad

Union of Data and Dummy Points
shift.ppp

Apply Vector Translation To Point Pattern
psp

Create a Line Segment Pattern
urkiola

Urkiola Woods Point Pattern
summary.owin

Summary of a Spatial Window
split.im

Divide Image Into Sub-images
update.ppm

Update a Fitted Point Process Model
rshift.splitppp

Randomly Shift a List of Point Patterns
solutionset

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

Summarizing a Quadrature Scheme
print.ppm

Print a Fitted Point Process Model
simulate.kppm

Simulate a Fitted Cluster Point Process Model
summary.psp

Summary of a Line Segment Pattern Dataset
rotate.ppp

Rotate a Point Pattern
vertices

Vertices of a Window
spatstat.options

Internal Options in Spatstat Package
rstrat

Simulate Stratified Random Point Pattern
rshift.psp

Randomly Shift a Line Segment Pattern
pcf

Pair Correlation Function
rlabel

Random Re-Labelling of Point Pattern
quadrat.test.splitppp

Chi-Squared Test of CSR for Split Point Pattern
runifpoint3

Generate N Uniform Random Points in Three Dimensions
rpoisline

Generate Poisson Random Line Process
suffstat

Sufficient Statistic of Point Process Model
with.hyperframe

Evaluate an Expression in Each Row of a Hyperframe
rmhmodel.list

Define Point Process Model for Metropolis-Hastings Simulation.
spokes

Spokes pattern of dummy points
trim.rectangle

Cut margins from rectangle
summary.splitppp

Summary of a Split Point Pattern
lansing

Lansing Woods Point Pattern