Learn R Programming

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

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

17,668

Version

1.16-0

License

GPL (>= 2)

Maintainer

Adrian Baddeley

Last Published

July 2nd, 2009

Functions in spatstat (1.16-0)

Replace.im

Reset Values in Subset of Image
Iest

Estimate the I-function
Gest

Nearest Neighbour Distance Function G
Kmulti

Marked K-Function
Extract.im

Extract Subset of Image
OrdThresh

Ord's Interaction model
Kmeasure

Reduced Second Moment Measure
anemones

Beadlet Anemones Data
LennardJones

The Lennard-Jones Potential
as.im

Convert to Pixel Image
Extract.fasp

Extract Subset of Function Array
Linhom

L-function
affine.psp

Apply Affine Transformation To Line Segment Pattern
anova.ppm

ANOVA for Fitted Point Process Models
Gdot

Multitype Nearest Neighbour Distance Function (i-to-any)
bdist.pixels

Distance to Boundary of Window
bounding.box.xy

Convex Hull of Points
Jcross

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

Convert Data To Tessellation
Kdot

Multitype K Function (i-to-any)
chop.tess

Subdivide a Window or Tessellation using a Set of Lines
Extract.fv

Extract Subset of Function Values
crossdist

Pairwise distances
complement.owin

Take Complement of a Window
demopat

Artificial Data Point Pattern
disc

Circular Window
compatible.fasp

Test Whether Two Function Arrays Are Compatible
coef.ppm

Coefficients of Fitted Point Process Model
Extract.quad

Subset of Quadrature Scheme
as.data.frame.ppp

Coerce Point Pattern to a Data Frame
bdist.points

Distance to Boundary of Window
Jest

Estimate the J-function
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
Kcross

Multitype K Function (Cross-type)
eem

Exponential Energy Marks
DiggleGratton

Diggle-Gratton model
SatPiece

Piecewise Constant Saturated Pairwise Interaction Point Process Model
append.psp

Combine Two Line Segment Patterns
Kdot.inhom

Inhomogeneous Multitype K Dot Function
blur

Apply Gaussian Blur to a Pixel Image
endpoints.psp

Endpoints of Line Segment Pattern
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
Softcore

The Soft Core Point Process Model
Jdot

Multitype J Function (i-to-any)
Extract.listof

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

Window Frame
bramblecanes

Hutchings' Bramble Canes data
as.psp

Convert Data To Class psp
Ldot

Multitype L-function (i-to-any)
closing.owin

Morphological Closing of a Window
erode.owin

Erode a Window
StraussHard

The Strauss / Hard Core Point Process Model
as.mask

Pixel Image Approximation of a Window
MultiStrauss

The Multitype Strauss Point Process Model
Geyer

Geyer's Saturation Point Process Model
allstats

Calculate four standard summary functions of a point pattern.
Ord

Generic Ord Interaction model
Lest

L-function
eval.fv

Evaluate Expression Involving Functions
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
colourmap

Colour Lookup Tables
Gcross

Multitype Nearest Neighbour Distance Function (i-to-j)
data.ppm

Extract Original Data from a Fitted Point Process Model
clarkevans

Clark and Evans Aggregation Index
is.marked.ppm

Test Whether A Point Process Model is Marked
discretise

Safely Convert Point Pattern Window to Binary Mask
Lcross.inhom

Inhomogeneous Cross Type L Function
concatxy

Concatenate x,y Coordinate Vectors
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
default.dummy

Generate a Default Pattern of Dummy Points
Emark

Diagnostics for random marking
distmap.owin

Distance Map of Window
bounding.box

Bounding Box of a Window or Point Pattern
clickppp

Interactively Add Points
Extract.ppp

Extract or Replace Subset of Point Pattern
infline

Infinite Straight Lines
BadGey

Hybrid Geyer Point Process Model
crossdist.psp

Pairwise distances between two different line segment patterns
distmap.psp

Distance Map of Line Segment Pattern
copper

Berman-Huntington points and lines data
spatstat-internal

Internal spatstat functions
alltypes

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

Estimate the empty space function F
adaptive.density

Intensity Estimate of Point Pattern Using Tessellation
is.marked

Test Whether Marks Are Present
hist.im

Histogram of Pixel Values in an Image
interp.im

Interpolate a Pixel Image
as.matrix.im

Convert Pixel Image to Matrix
levelset

Level Set of a Pixel Image
model.matrix.ppm

Extract Design Matrix from Point Process Model
matchingdist

Distance for a Point Pattern Matching
localK

Neighbourhood density function
compatible.im

Test Whether Two Pixel Images Are Compatible
Lcross

Multitype L-function (cross-type)
murchison

Murchison gold deposits
im

Create a Pixel Image Object
gridcentres

Rectangular grid of points
iplot

Point and Click Interface for Displaying a Point Pattern
Kest

K-function
density.ppp

Kernel Smoothed Intensity of Point Pattern
cut.im

Convert Pixel Image from Numeric to Factor
Ldot.inhom

Inhomogeneous Multitype L Dot Function
plot.colourmap

Plot a Colour Map
ewcdf

Weighted Empirical Cumulative Distribution Function
longleaf

Longleaf Pines Point Pattern
amacrine

Hughes' Amacrine Cell Data
pcf.ppp

Pair Correlation Function of Point Pattern
ppp

Create a Point Pattern
cells

Biological Cells Point Pattern
Extract.psp

Extract Subset of Line Segment Pattern
effectfun

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

Harkness-Isham ants' nests data
midpoints.psp

Midpoints of Line Segment Pattern
lengths.psp

Lengths of Line Segments
heather

Diggle's Heather Data
mean.im

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

Simulation envelopes of summary function
Kest.fft

K-function using FFT
japanesepines

Japanese Pines Point Pattern
matclust.estK

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

Pairwise distances between two different point patterns
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
area.owin

Area of a Window
by.im

Apply Function to Image Broken Down by Factor
eval.im

Evaluate Expression Involving Pixel Images
Strauss

The Strauss Point Process Model
diameter

Diameter of a Window
as.data.frame.psp

Coerce Line Segment Pattern to a Data Frame
dirichlet

Dirichlet Tessellation of Point Pattern
is.subset.owin

Determine Whether One Window is Contained In Another
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
kstest.ppm

Kolmogorov-Smirnov Test for Point Process Model
corners

Corners of a rectangle
bei

Tropical rain forest trees
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
AreaInter

The Area Interaction Point Process Model
affine

Apply Affine Transformation
kppm

Fit cluster point process model
Extract.splitppp

Extract or Replace Sub-Patterns
nncross

Nearest Neighbours Between Two Patterns
connected

Connected components of an image or window
im.object

Class of Images
clip.infline

Intersect Infinite Straight Lines with a Window
nndist

Nearest neighbour distances
nndist.psp

Nearest neighbour distances between line segments
Pairwise

Generic Pairwise Interaction model
Poisson

Poisson Point Process Model
convexhull.xy

Convex Hull of Points
compatible.fv

Test Whether Two Function Objects Are Compatible
affine.owin

Apply Affine Transformation To Window
convexhull

Convex Hull
eval.fasp

Evaluate Expression Involving Function Arrays
is.multitype

Test whether Object is Multitype
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
print.ppm

Print a Fitted Point Process Model
pairdist.default

Pairwise distances
Saturated

Saturated Pairwise Interaction model
fitted.ppm

Fitted Conditional Intensity for Point Process Model
incircle

Find Largest Circle Inside Window
inside.owin

Test Whether Points Are Inside A Window
lut

Lookup Tables
plot.listof

Plot a List of Things
owin

Create a Window
mincontrast

Method of Minimum Contrast
fryplot

Fry Plot of Point Pattern
pairdist.psp

Pairwise distances between line segments
gridweights

Compute Quadrature Weights Based on Grid Counts
markconnect

Mark Connection Function
psp.object

Class of Line Segment Patterns
spatstat-deprecated

Deprecated spatstat functions
rGaussPoisson

Simulate Gauss-Poisson Process
pppmatching.object

Class of Point Matchings
as.owin

Convert Data To Class owin
pppmatching

Create a Point Matching
persp.im

Perspective Plot of Pixel Image
is.im

Test Whether An Object Is A Pixel Image
rMosaicField

Mosaic Random Field
hyperframe

Hyper Data Frame
quad.object

Class of Quadrature Schemes
pixelquad

Quadrature Scheme Based on Pixel Grid
lgcp.estK

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

New Zealand Trees Point Pattern
plot.tess

Plot a tessellation
crossdist.default

Pairwise distances between two different sets of points
nnwhich

Nearest neighbour
rshift

Random Shift
pcf

Pair Correlation Function
finpines

Pine saplings in Finland.
inforder.family

Infinite Order Interaction Family
ppm

Fit Point Process Model to Data
ord.family

Ord Interaction Process Family
plot.plotppm

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

Plot Entries in a Hyperframe
plot.quad

plot a Spatial Quadrature Scheme
quantile.im

Sample Quantiles of Pixel Image
model.images

Compute Images of Constructed Covariates
multiplicity.ppp

Count Multiplicity of Duplicate Points
pcf.fv

Pair Correlation Function obtained from K Function
distmap

Distance Map
opening.owin

Morphological Opening of a Window
delaunay

Delaunay Triangulation of Point Pattern
centroid.owin

Centroid of a window
Extract.tess

Extract or Replace Subset of Tessellation
nncorr

Nearest-Neighbour Correlation Indices of Marked Point Pattern
predict.ppm

Prediction from a Fitted Point Process Model
project2segment

Move Point To Nearest Line
pairdist

Pairwise distances
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
rescale.owin

Convert Window to Another Unit of Length
raster.x

Cartesian Coordinates for a Pixel Raster
rescale.ppp

Convert Point Pattern to Another Unit of Length
quadratcount

Quadrat counting for a point pattern
distmap.ppp

Distance Map of Point Pattern
fasp.object

Function Arrays for Spatial Patterns
intersect.owin

Intersection or Union of Two Windows
density.psp

Kernel Smoothing of Line Segment Pattern
shift.im

Apply Vector Translation To Pixel Image
tiles

Extract List of Tiles in a Tessellation
letterR

Window in Shape of Letter R
eval.hyper

Evaluate an Expression in Each Row of a Hyperframe
fitin.ppm

Extract the Interaction from a Fitted Point Process Model
intersect.tess

Intersection of Two Tessellations
logLik.ppm

Log Likelihood for Poisson Point Process Model
pcfcross

Multitype pair correlation function
gpc2owin

Convert Polygonal Region into Different Format
psp

Create a Line Segment Pattern
marktable

Tabulate Marks in Neighbourhood of Every Point in a Point Pattern
is.multitype.ppm

Test Whether A Point Process Model is Multitype
is.marked.ppp

Test Whether A Point Pattern is Marked
quadratresample

Resample a Point Pattern by Resampling Quadrats
ponderosa

Ponderosa Pine Tree Point Pattern
hamster

Aherne's hamster tumour data
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
identify.ppp

Identify Points in a Point Pattern
Hest

Spherical Contact Distribution Function
simplify.owin

Approximate a Polygon by a Simpler Polygon
harmonic

Basis for Harmonic Functions
pointsOnLines

Place Points Evenly Along Specified Lines
fv.object

Data Frames of Function Values
residuals.ppm

Residuals for Fitted Point Process Model
markvario

Mark Variogram
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
pairsat.family

Saturated Pairwise Interaction Point Process Family
plot.im

Plot a Pixel Image
plot.splitppp

Plot a List of Point Patterns
Kcross.inhom

Inhomogeneous Cross K Function
summary.owin

Summary of a Spatial Window
Jmulti

Marked J Function
plot.ppp

plot a Spatial Point Pattern
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
print.im

Print Brief Details of an Image
rlinegrid

Generate grid of parallel lines with random displacement
quadrat.test.splitppp

Chi-Squared Test of CSR for Split Point Pattern
print.quad

Print a Quadrature Scheme
summary.ppp

Summary of a Point Pattern Dataset
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
ppp.object

Class of Point Patterns
reach

Interaction Distance of a Point Process
rescale

Convert dataset to another unit of length
print.ppp

Print Brief Details of a Point Pattern Dataset
miplot

Morishita Index Plot
nearestsegment

Find Line Segment Nearest to Each Point
rshift.psp

Randomly Shift a Line Segment Pattern
plot.psp

plot a Spatial Line Segment Pattern
rcell

Simulate Baddeley-Silverman Cell Process
rMatClust

Simulate Matern Cluster Process
split.im

Divide Image Into Sub-images
print.owin

Print Brief Details of a Spatial Window
rmpoint

Generate N Random Multitype Points
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
is.owin

Test Whether An Object Is A Window
pixellate

Convert Point Pattern to Pixel Image
quadrats

Divide Region into Quadrats
rpoislinetess

Poisson Line Tessellation
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
plot.fv

Plot Function Values
plot.ppm

plot a Fitted Point Process Model
unitname

Name for Unit of Length
unmark

Remove Marks
rthin

Random Thinning
Kinhom

Inhomogeneous K-function
is.ppp

Test Whether An Object Is A Point Pattern
rMaternII

Simulate Matern Model II
rstrat

Simulate Stratified Random Point Pattern
summary.ppm

Summarizing a Fitted Point Process Model
superimpose

Superimpose Several Point Patterns
profilepl

Profile Maximum Pseudolikelihood
markcorr

Mark Correlation Function
summary.splitppp

Summary of a Split Point Pattern
lansing

Lansing Woods Point Pattern
angles.psp

Orientation Angles of Line Segments
rmhmodel.ppm

Interpret Fitted Model for Metropolis-Hastings Simulation.
rpoisline

Generate Poisson Random Line Process
is.multitype.ppp

Test Whether A Point Pattern is Multitype
qqplot.ppm

Q-Q Plot of Residuals from Fitted Point Process Model
owin.object

Class owin
istat

Point and Click Interface for Exploratory Analysis of Point Pattern
lurking

Lurking variable plot
rmpoispp

Generate Multitype Poisson Point Pattern
nbfires

Point Patterns of New Brunswick Forest Fires
rmh.ppm

Simulate from a Fitted Point Process Model
smooth.ppp

Spatial smoothing of observations at irregular points
swedishpines

Swedish Pines Point Pattern
rshift.ppp

Randomly Shift a Point Pattern
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
spatstat.options

Internal Options in Spatstat Package
print.psp

Print Brief Details of a Line Segment Pattern Dataset
markcorrint

Mark Correlation Integral
pppdist

Distance Between Two Point Patterns
rotate

Rotate
rNeymanScott

Simulate Neyman-Scott Process
quad.ppm

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

Rotate a Window
quadrat.test

Chi-Squared Dispersion Test for Spatial Point Pattern Based on Quadrat Counts
shift.owin

Apply Vector Translation To Window
pairdist.ppp

Pairwise distances
plot.fasp

Plot a Function Array
square

Square Window
rThomas

Simulate Thomas Process
rMosaicSet

Mosaic Random Set
ripras

Estimate window from points alone
tess

Create a Tessellation
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
Gmulti

Marked Nearest Neighbour Distance Function
summary.psp

Summary of a Line Segment Pattern Dataset
runifpoint

Generate N Uniform Random Points
simulate.kppm

Simulate a fitted cluster point process model.
rStrauss

Perfect Simulation of the Strauss Process
update.ppm

Update a Fitted Point Process Model
runifpointOnLines

Generate N Uniform Random Points On Line Segments
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
shift

Apply Vector Translation
urkiola

Urkiola Woods Point Pattern
superimposePSP

Superimpose Several Line Segment Patterns
shift.ppp

Apply Vector Translation To Point Pattern
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
rsyst

Simulate systematic random point pattern
pcf.fasp

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

Plot a fitted cluster point process
rescale.im

Convert Pixel Image to Another Unit of Length
contour.im

Contour plot of pixel image
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
shift.psp

Apply Vector Translation To Line Segment Pattern
rjitter

Random Perturbation of a Point Pattern
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
stieltjes

Compute Integral of Function Against Cumulative Distribution
rpoispp

Generate Poisson Point Pattern
trim.rectangle

Cut margins from rectangle
rmh.default

Simulate Point Process Models using the Metropolis-Hastings Algorithm.
ppm.object

Class of Fitted Point Process Models
split.ppp

Divide Point Pattern into Sub-patterns
is.convex

Test Whether a Window is Convex
rmhmodel.default

Build Point Process Model for Metropolis-Hastings Simulation.
spruces

Spruces Point Pattern
rotate.ppp

Rotate a Point Pattern
solutionset

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

Random Re-Labelling of Point Pattern
rpoint

Generate N Random Points
update.kppm

Update a Fitted Cluster Point Process Model
rshift.splitppp

Randomly Shift a List of Point Patterns
runifdisc

Generate N Uniform Random Points in a Disc
rescue.rectangle

Convert Window Back To Rectangle
simdat

Simulated Point Pattern
union.quad

Union of Data and Dummy Points
shapley

Galaxies in the Shapley Supercluster
predict.kppm

Prediction from a Fitted Cluster Point Process Model
spokes

Spokes pattern of dummy points
selfcrossing.psp

Crossing Points in a Line Segment Pattern
scanpp

Read Point Pattern From Data File
vertices

Vertices of a Window
summary.listof

Summary of a List of Things
redwood

California Redwoods Point Pattern (Ripley's Subset)
setcov

Set Covariance of a Window
reduced.sample

Reduced Sample Estimator using Histogram Data
rmhmodel.list

Define Point Process Model for Metropolis-Hastings Simulation.
quadscheme

Generate a Quadrature Scheme from a Point Pattern
with.fv

Evaluate an Expression in a Function Table
summary.quad

Summarizing a Quadrature Scheme
unique.ppp

Extract Unique Points from a Spatial Point Pattern
affine.ppp

Apply Affine Transformation To Point Pattern
by.ppp

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

Chorley-Ribble Cancer Data
betacells

Beta Ganglion Cells in Cat Retina
clickpoly

Interactively Define a Polygon
cut.ppp

Classify Points in a Point Pattern
crossing.psp

Crossing Points of Two Line Segment Patterns
is.ppm

Test Whether An Object Is A Fitted Point Process Model
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
plot.owin

Plot a Spatial Window
progressreport

Print Progress Reports
rMaternI

Simulate Matern Model I
rotate.psp

Rotate a Line Segment Pattern
rpoisppOnLines

Generate Poisson Point Pattern on Line Segments
setmarks

Set or Reset the Marks in a Point Pattern
summary.im

Summarizing a Pixel Image
spatstat

The Spatstat Package
areadiff

Difference of Disc Areas
as.ppp

Convert Data To Class ppp
dilate.owin

Dilate a Window
eroded.areas

Areas of Morphological Erosions
expand.owin

Expand Window By Factor
nearest.raster.point

Find Pixel Nearest to a Given Point
pairwise.family

Pairwise Interaction Process Family
rSSI

Simulate Simple Sequential Inhibition
suffstat

Sufficient Statistic of Point Process Model