Learn R Programming

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

spatstat (version 1.16-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. 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

18,534

Version

1.16-2

License

GPL (>= 2)

Maintainer

Adrian Baddeley

Last Published

August 23rd, 2009

Functions in spatstat (1.16-2)

convexhull

Convex Hull
crossdist.ppp

Pairwise distances between two different point patterns
distmap

Distance Map
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
im

Create a Pixel Image Object
print.quad

Print a Quadrature Scheme
pixellate.owin

Convert Window to Pixel Image
disc

Circular Window
rMaternII

Simulate Matern Model II
density.ppp

Kernel Smoothed Intensity of Point Pattern
copper

Berman-Huntington points and lines data
logLik.ppm

Log Likelihood for Poisson Point Process Model
is.owin

Test Whether An Object Is A Window
intersect.owin

Intersection or Union of Two Windows
markconnect

Mark Connection Function
crossdist

Pairwise distances
pcf.fasp

Pair Correlation Function obtained from array of K functions
shift.owin

Apply Vector Translation To Window
pairdist.default

Pairwise distances
matchingdist

Distance for a Point Pattern Matching
summary.listof

Summary of a List of Things
dilated.areas

Areas of Morphological Dilations
lansing

Lansing Woods Point Pattern
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
nndist.psp

Nearest neighbour distances between line segments
nearestsegment

Find Line Segment Nearest to Each Point
is.subset.owin

Determine Whether One Window is Contained In Another
rescale.owin

Convert Window to Another Unit of Length
nncross

Nearest Neighbours Between Two Patterns
rmh.default

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

Sufficient Statistic of Point Process Model
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
plot.im

Plot a Pixel Image
opening

Morphological Opening
ppp.object

Class of Point Patterns
is.marked.ppp

Test Whether A Point Pattern is Marked
plot.quad

plot a Spatial Quadrature Scheme
tess

Create a Tessellation
markcorr

Mark Correlation Function
rescale.im

Convert Pixel Image to Another Unit of Length
concatxy

Concatenate x,y Coordinate Vectors
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
plot.psp

plot a Spatial Line Segment Pattern
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
ppp

Create a Point Pattern
im.object

Class of Images
pcf.ppp

Pair Correlation Function of Point Pattern
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
nearest.raster.point

Find Pixel Nearest to a Given Point
pcfcross

Multitype pair correlation function
quadratresample

Resample a Point Pattern by Resampling Quadrats
rescale.psp

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

Test Whether An Object Is A Fitted Point Process Model
is.multitype.ppm

Test Whether A Point Process Model is Multitype
rMosaicField

Mosaic Random Field
rSSI

Simulate Simple Sequential Inhibition
crossing.psp

Crossing Points of Two Line Segment Patterns
marktable

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

Move Point To Nearest Line
solutionset

Evaluate Logical Expression Involving Pixel Images and Return Region Where Expression is True
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
lut

Lookup Tables
matclust.estK

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

Apply Vector Translation To Line Segment Pattern
is.convex

Test Whether a Window is Convex
nndist

Nearest neighbour distances
plot.kstest

Plot a Spatial Kolmogorov-Smirnov Test
rMosaicSet

Mosaic Random Set
convexhull.xy

Convex Hull of Points
istat

Point and Click Interface for Exploratory Analysis of Point Pattern
rotate.ppp

Rotate a Point Pattern
markcorrint

Mark Correlation Integral
owin.object

Class owin
compatible.fasp

Test Whether Two Function Arrays Are Compatible
vertices

Vertices of a Window
kppm

Fit cluster point process model
delaunay

Delaunay Triangulation of Point Pattern
clip.infline

Intersect Infinite Straight Lines with a Window
cut.ppp

Classify Points in a Point Pattern
compatible.fv

Test Whether Two Function Objects Are Compatible
pcf.fv

Pair Correlation Function obtained from K Function
reach

Interaction Distance of a Point Process
is.empty

Test Whether An Object Is Empty
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
owin

Create a Window
density.psp

Kernel Smoothing of Line Segment Pattern
superimposePSP

Superimpose Several Line Segment Patterns
plot.splitppp

Plot a List of Point Patterns
predict.kppm

Prediction from a Fitted Cluster Point Process Model
is.multitype

Test whether Object is Multitype
plot.kppm

Plot a fitted cluster point process
is.im

Test Whether An Object Is A Pixel Image
lgcp.estK

Fit a Log-Gaussian Cox Point Process by Minimum Contrast
plot.fasp

Plot a Function Array
colourmap

Colour Lookup Tables
plot.fv

Plot Function Values
complement.owin

Take Complement of a Window
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
rGaussPoisson

Simulate Gauss-Poisson Process
plot.ppp

plot a Spatial Point Pattern
rescale.ppp

Convert Point Pattern to Another Unit of Length
psp.object

Class of Line Segment Patterns
is.marked

Test Whether Marks Are Present
envelope

Simulation envelopes of summary function
miplot

Morishita Index Plot
quadscheme

Generate a Quadrature Scheme from a Point Pattern
rlabel

Random Re-Labelling of Point Pattern
kstest.ppm

Kolmogorov-Smirnov Test for Point Process Model
japanesepines

Japanese Pines Point Pattern
rmpoispp

Generate Multitype Poisson Point Pattern
closing

Morphological Closing
runifpoint

Generate N Uniform Random Points
rthin

Random Thinning
swedishpines

Swedish Pines Point Pattern
plot.bermantest

Plot Result of Berman Test
ppm.object

Class of Fitted Point Process Models
compatible.im

Test Whether Two Pixel Images Are Compatible
inside.owin

Test Whether Points Are Inside A Window
cut.im

Convert Pixel Image from Numeric to Factor
pcf

Pair Correlation Function
print.owin

Print Brief Details of a Spatial Window
redwood

California Redwoods Point Pattern (Ripley's Subset)
is.ppp

Test Whether An Object Is A Point Pattern
quantile.im

Sample Quantiles of Pixel Image
progressreport

Print Progress Reports
pppmatching

Create a Point Matching
rescale

Convert dataset to another unit of length
demopat

Artificial Data Point Pattern
levelset

Level Set of a Pixel Image
simulate.kppm

Simulate a Fitted Cluster Point Process Model
lengths.psp

Lengths of Line Segments
model.matrix.ppm

Extract Design Matrix from Point Process Model
pixellate

Convert Spatial Object to Pixel Image
intersect.tess

Intersection of Two Tessellations
inforder.family

Infinite Order Interaction Family
mincontrast

Method of Minimum Contrast
iplot

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

Convert Point Pattern to Pixel Image
rjitter

Random Perturbation of a Point Pattern
infline

Infinite Straight Lines
plot.tess

Plot a tessellation
rotate.owin

Rotate a Window
pairdist.psp

Pairwise distances between line segments
rmh.ppm

Simulate from a Fitted Point Process Model
simplify.owin

Approximate a Polygon by a Simpler Polygon
plot.plotppm

Plot a plotppm Object Created by plot.ppm
rshift.ppp

Randomly Shift a Point Pattern
nncorr

Nearest-Neighbour Correlation Indices of Marked Point Pattern
nbfires

Point Patterns of New Brunswick Forest Fires
rshift.splitppp

Randomly Shift a List of Point Patterns
persp.im

Perspective Plot of Pixel Image
rlinegrid

Generate grid of parallel lines with random displacement
dilation

Morphological Dilation
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
ripras

Estimate window from points alone
profilepl

Profile Maximum Pseudolikelihood
split.im

Divide Image Into Sub-images
pppmatching.object

Class of Point Matchings
rotate.psp

Rotate a Line Segment Pattern
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
rMaternI

Simulate Matern Model I
discpartarea

Area of Part of Disc
scanpp

Read Point Pattern From Data File
rpoisppOnLines

Generate Poisson Point Pattern on Line Segments
pixelquad

Quadrature Scheme Based on Pixel Grid
rmhmodel.default

Build Point Process Model for Metropolis-Hastings Simulation.
ppm

Fit Point Process Model to Data
print.im

Print Brief Details of an Image
nztrees

New Zealand Trees Point Pattern
plot.listof

Plot a List of Things
setcov

Set Covariance of a Window
spatstat-internal

Internal spatstat functions
lurking

Lurking variable plot
shift

Apply Vector Translation
interp.im

Interpolate a Pixel Image
ord.family

Ord Interaction Process Family
plot.ppm

plot a Fitted Point Process Model
summary.splitppp

Summary of a Split Point Pattern
rshift

Random Shift
spruces

Spruces Point Pattern
psp

Create a Line Segment Pattern
rNeymanScott

Simulate Neyman-Scott Process
rpoint

Generate N Random Points
rstrat

Simulate Stratified Random Point Pattern
rMatClust

Simulate Matern Cluster Process
split.ppp

Divide Point Pattern into Sub-patterns
rpoispp

Generate Poisson Point Pattern
discretise

Safely Convert Point Pattern Window to Binary Mask
rshift.psp

Randomly Shift a Line Segment Pattern
rmhmodel.list

Define Point Process Model for Metropolis-Hastings Simulation.
perimeter

Perimeter Length of Window
qqplot.ppm

Q-Q Plot of Residuals from Fitted Point Process Model
is.marked.ppm

Test Whether A Point Process Model is Marked
summary.quad

Summarizing a Quadrature Scheme
unique.ppp

Extract Unique Points from a Spatial Point Pattern
incircle

Find Largest Circle Inside Window
with.fv

Evaluate an Expression in a Function Table
pppdist

Distance Between Two Point Patterns
pairdist

Pairwise distances
ponderosa

Ponderosa Pine Tree Point Pattern
union.quad

Union of Data and Dummy Points
quadrat.test.splitppp

Chi-Squared Test of CSR for Split Point Pattern
tiles

Extract List of Tiles in a Tessellation
update.kppm

Update a Fitted Cluster Point Process Model
spokes

Spokes pattern of dummy points
summary.owin

Summary of a Spatial Window
superimpose

Superimpose Several Point Patterns
shapley

Galaxies in the Shapley Supercluster
plot.owin

Plot a Spatial Window
model.images

Compute Images of Constructed Covariates
summary.psp

Summary of a Line Segment Pattern Dataset
raster.x

Cartesian Coordinates for a Pixel Raster
unmark

Remove Marks
midpoints.psp

Midpoints of Line Segment Pattern
reduced.sample

Reduced Sample Estimator using Histogram Data
rmpoint

Generate N Random Multitype Points
runifdisc

Generate N Uniform Random Points in a Disc
rStrauss

Perfect Simulation of the Strauss Process
localK

Neighbourhood density function
murchison

Murchison gold deposits
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
simdat

Simulated Point Pattern
shift.ppp

Apply Vector Translation To Point Pattern
nnwhich

Nearest neighbour
urkiola

Urkiola Woods Point Pattern
runifpointOnLines

Generate N Uniform Random Points On Line Segments
setmarks

Set or Reset the Marks in a Point Pattern
affine.psp

Apply Affine Transformation To Line Segment Pattern
rThomas

Simulate Thomas Process
blur

Apply Gaussian Blur to a Pixel Image
rmhmodel.ppm

Interpret Fitted Model for Metropolis-Hastings Simulation.
rescue.rectangle

Convert Window Back To Rectangle
shift.im

Apply Vector Translation To Pixel Image
rpoisline

Generate Poisson Random Line Process
Lcross

Multitype L-function (cross-type)
pairsat.family

Saturated Pairwise Interaction Point Process Family
spatstat.options

Internal Options in Spatstat Package
square

Square Window
update.ppm

Update a Fitted Point Process Model
print.ppm

Print a Fitted Point Process Model
Extract.splitppp

Extract or Replace Sub-Patterns
Kcross.inhom

Inhomogeneous Cross K Function
Strauss

The Strauss Point Process Model
unitname

Name for Unit of Length
simulate.ppm

Simulate a Fitted Gibbs Point Process Model
print.psp

Print Brief Details of a Line Segment Pattern Dataset
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
spatstat-package

The Spatstat Package
summary.im

Summarizing a Pixel Image
bei

Tropical rain forest trees
affine.ppp

Apply Affine Transformation To Point Pattern
rpoislinetess

Poisson Line Tessellation
selfcrossing.psp

Crossing Points in a Line Segment Pattern
finpines

Pine saplings in Finland.
crossdist.default

Pairwise distances between two different sets of points
as.im

Convert to Pixel Image
smooth.ppp

Spatial smoothing of observations at irregular points
Gcross

Multitype Nearest Neighbour Distance Function (i-to-j)
plot.colourmap

Plot a Colour Map
Pairwise

Generic Pairwise Interaction model
area.owin

Area of a Window
letterR

Window in Shape of Letter R
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
quadrat.test

Chi-Squared Dispersion Test for Spatial Point Pattern Based on Quadrat Counts
Replace.im

Reset Values in Subset of Image
Linhom

L-function
rotate

Rotate
Saturated

Saturated Pairwise Interaction model
as.data.frame.ppp

Coerce Point Pattern to a Data Frame
StraussHard

The Strauss / Hard Core Point Process Model
pairdist.ppp

Pairwise distances
eval.fv

Evaluate Expression Involving Functions
multiplicity.ppp

Count Multiplicity of Duplicate Points
Kdot

Multitype K Function (i-to-any)
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
stieltjes

Compute Integral of Function Against Cumulative Distribution
gridweights

Compute Quadrature Weights Based on Grid Counts
alltypes

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

Diagnostics for random marking
Kmeasure

Reduced Second Moment Measure
LennardJones

The Lennard-Jones Potential
MultiStrauss

The Multitype Strauss Point Process Model
quadrats

Divide Region into Quadrats
mean.im

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

Connected components of an image or window
affine.owin

Apply Affine Transformation To Window
fitin.ppm

Extract the Interaction from a Fitted Point Process Model
eval.fasp

Evaluate Expression Involving Function Arrays
ants

Harkness-Isham ants' nests data
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
as.data.frame.psp

Coerce Line Segment Pattern to a Data Frame
residuals.ppm

Residuals for Fitted Point Process Model
humberside

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

Test Whether A Point Pattern is Multitype
as.matrix.im

Convert Pixel Image to Matrix
Kest

K-function
as.owin

Convert Data To Class owin
as.psp

Convert Data To Class psp
rcell

Simulate Baddeley-Silverman Cell Process
Iest

Estimate the I-function
AreaInter

The Area Interaction Point Process Model
hyperframe

Hyper Data Frame
SatPiece

Piecewise Constant Saturated Pairwise Interaction Point Process Model
dummy.ppm

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

Extract Subset of Line Segment Pattern
chop.tess

Subdivide a Window or Tessellation using a Set of Lines
angles.psp

Orientation Angles of Line Segments
allstats

Calculate four standard summary functions of a point pattern.
Jmulti

Marked J Function
areaLoss

Difference of Disc Areas
chorley

Chorley-Ribble Cancer Data
Kinhom

Inhomogeneous K-function
Kmulti

Marked K-Function
distmap.ppp

Distance Map of Point Pattern
adaptive.density

Intensity Estimate of Point Pattern Using Tessellation
Gmulti

Marked Nearest Neighbour Distance Function
bermantest

Berman's Tests for Point Process Model
bounding.box

Bounding Box of a Window or Point Pattern
Extract.im

Extract Subset of Image
bdist.points

Distance to Boundary of Window
Gest

Nearest Neighbour Distance Function G
DiggleGratton

Diggle-Gratton model
bramblecanes

Hutchings' Bramble Canes data
Extract.listof

Extract or Replace Subset of a List of Things
corners

Corners of a rectangle
Jdot

Multitype J Function (i-to-any)
fitted.ppm

Fitted Conditional Intensity for Point Process Model
eval.hyper

Evaluate an Expression in Each Row of a Hyperframe
Gdot

Multitype Nearest Neighbour Distance Function (i-to-any)
Ldot.inhom

Inhomogeneous Multitype L Dot Function
bdist.pixels

Distance to Boundary of Window
contour.im

Contour plot of pixel image
gridcentres

Rectangular grid of points
by.ppp

Apply a Function to a Point Pattern Broken Down by Factor
Extract.fasp

Extract Subset of Function Array
summary.ppp

Summary of a Point Pattern Dataset
identify.ppp

Identify Points in a Point Pattern
default.dummy

Generate a Default Pattern of Dummy Points
append.psp

Combine Two Line Segment Patterns
Extract.ppp

Extract or Replace Subset of Point Pattern
fv.object

Data Frames of Function Values
Jest

Estimate the J-function
Softcore

The Soft Core Point Process Model
eem

Exponential Energy Marks
cells

Biological Cells Point Pattern
crossdist.psp

Pairwise distances between two different line segment patterns
distmap.psp

Distance Map of Line Segment Pattern
quad.object

Class of Quadrature Schemes
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
gpc2owin

Convert Polygonal Region into Different Format
fryplot

Fry Plot of Point Pattern
Extract.quad

Subset of Quadrature Scheme
erosion

Morphological Erosion
data.ppm

Extract Original Data from a Fitted Point Process Model
Hest

Spherical Contact Distribution Function
endpoints.psp

Endpoints of Line Segment Pattern
spatstat-deprecated

Deprecated spatstat functions
as.polygonal

Convert a Window to a Polygonal Window
betacells

Beta Ganglion Cells in Cat Retina
Kest.fft

K-function using FFT
Kcross

Multitype K Function (Cross-type)
heather

Diggle's Heather Data
diameter

Diameter of a Window
fasp.object

Function Arrays for Spatial Patterns
dirichlet

Dirichlet Tessellation of Point Pattern
clarkevans

Clark and Evans Aggregation Index
Ord

Generic Ord Interaction model
Lest

L-function
anova.ppm

ANOVA for Fitted Point Process Models
amacrine

Hughes' Amacrine Cell Data
by.im

Apply Function to Image Broken Down by Factor
eroded.areas

Areas of Morphological Erosions
hist.im

Histogram of Pixel Values in an Image
Extract.fv

Extract Subset of Function Values
areaGain

Difference of Disc Areas
eval.im

Evaluate Expression Involving Pixel Images
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
OrdThresh

Ord's Interaction model
Poisson

Poisson Point Process Model
Kdot.inhom

Inhomogeneous Multitype K Dot Function
anemones

Beadlet Anemones Data
Fest

Estimate the empty space function F
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
Jcross

Multitype J Function (i-to-j)
as.ppp

Convert Data To Class ppp
rsyst

Simulate systematic random point pattern
affine

Apply Affine Transformation
Ldot

Multitype L-function (i-to-any)
coef.ppm

Coefficients of Fitted Point Process Model
harmonic

Basis for Harmonic Functions
expand.owin

Expand Window By Factor
ewcdf

Weighted Empirical Cumulative Distribution Function
Extract.tess

Extract or Replace Subset of Tessellation
BadGey

Hybrid Geyer Point Process Model
hamster

Aherne's hamster tumour data
clickppp

Interactively Add Points
pairwise.family

Pairwise Interaction Process Family
plot.hyperframe

Plot Entries in a Hyperframe
print.ppp

Print Brief Details of a Point Pattern Dataset
pointsOnLines

Place Points Evenly Along Specified Lines
predict.ppm

Prediction from a Fitted Point Process Model
longleaf

Longleaf Pines Point Pattern
quadratcount

Quadrat counting for a point pattern
trim.rectangle

Cut margins from rectangle
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
markvario

Mark Variogram
Geyer

Geyer's Saturation Point Process Model
bounding.box.xy

Convex Hull of Points
as.tess

Convert Data To Tessellation
effectfun

Compute Fitted Effect of a Spatial Covariate in a Point Process Model
Lcross.inhom

Inhomogeneous Cross Type L Function
centroid.owin

Centroid of a window
as.rectangle

Window Frame
clickpoly

Interactively Define a Polygon
distmap.owin

Distance Map of Window
as.mask

Pixel Image Approximation of a Window
summary.ppm

Summarizing a Fitted Point Process Model