Learn R Programming

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

spatstat (version 1.17-1)

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.17-1

License

GPL (>= 2)

Maintainer

Adrian Baddeley

Last Published

November 6th, 2009

Functions in spatstat (1.17-1)

MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
DiggleGratton

Diggle-Gratton model
Lcross.inhom

Inhomogeneous Cross Type L Function
closing

Morphological Closing
Extract.im

Extract Subset of Image
Geyer

Geyer's Saturation Point Process Model
Kinhom

Inhomogeneous K-function
density.psp

Kernel Smoothing of Line Segment Pattern
append.psp

Combine Two Line Segment Patterns
Linhom

L-function
bermantest

Berman's Tests for Point Process Model
Kest

K-function
connected

Connected components of an image or window
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
Hest

Spherical Contact Distribution Function
Gdot

Multitype Nearest Neighbour Distance Function (i-to-any)
as.rectangle

Window Frame
Extract.quad

Subset of Quadrature Scheme
as.box3

Convert Data to Three-Dimensional Box
Extract.tess

Extract or Replace Subset of Tessellation
gridweights

Compute Quadrature Weights Based on Grid Counts
hyperframe

Hyper Data Frame
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
Gest

Nearest Neighbour Distance Function G
bronzefilter

Bronze gradient filter data
coords

Extract Coordinates of a Spatial or Spatiotemporal Point Pattern
F3est

Empty Space Function of a Three-Dimensional Point Pattern
BadGey

Hybrid Geyer Point Process Model
allstats

Calculate four standard summary functions of a point pattern.
deltametric

Delta Metric
Kmeasure

Reduced Second Moment Measure
Emark

Diagnostics for random marking
pppmatching.object

Class of Point Matchings
Jest

Estimate the J-function
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
cells

Biological Cells Point Pattern
Poisson

Poisson Point Process Model
chorley

Chorley-Ribble Cancer Data
expand.owin

Expand Window By Factor
diameter.box3

Geometrical Calculations for Three-Dimensional Box
clickpoly

Interactively Define a Polygon
default.dummy

Generate a Default Pattern of Dummy Points
Replace.im

Reset Values in Subset of Image
areaLoss

Difference of Disc Areas
fasp.object

Function Arrays for Spatial Patterns
heather

Diggle's Heather Data
pairsat.family

Saturated Pairwise Interaction Point Process Family
nztrees

New Zealand Trees Point Pattern
nndist.psp

Nearest neighbour distances between line segments
Extract.fv

Extract Subset of Function Values
dilation

Morphological Dilation
Jcross

Multitype J Function (i-to-j)
Pairwise

Generic Pairwise Interaction model
hist.im

Histogram of Pixel Values in an Image
predict.kppm

Prediction from a Fitted Cluster Point Process Model
spatstat-internal

Internal spatstat functions
pcf.fv

Pair Correlation Function obtained from K Function
Saturated

Saturated Pairwise Interaction model
rstrat

Simulate Stratified Random Point Pattern
Ldot.inhom

Inhomogeneous Multitype L Dot Function
compatible.fv

Test Whether Two Function Objects Are Compatible
rotate

Rotate
complement.owin

Take Complement of a Window
affine

Apply Affine Transformation
runifdisc

Generate N Uniform Random Points in a Disc
as.polygonal

Convert a Window to a Polygonal Window
clip.infline

Intersect Infinite Straight Lines with a Window
diameter

Diameter of a Window
area.owin

Area of a Window
data.ppm

Extract Original Data from a Fitted Point Process Model
bounding.box.xy

Convex Hull of Points
rthin

Random Thinning
bei

Tropical rain forest trees
Strauss

The Strauss Point Process Model
adaptive.density

Intensity Estimate of Point Pattern Using Tessellation
is.marked.ppp

Test Whether A Point Pattern is Marked
box3

Three-Dimensional Box
alltypes

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

Pair Correlation Function
Fest

Estimate the empty space function F
Kdot.inhom

Inhomogeneous Multitype K Dot Function
StraussHard

The Strauss / Hard Core Point Process Model
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
is.im

Test Whether An Object Is A Pixel Image
as.data.frame.psp

Coerce Line Segment Pattern to a Data Frame
spatstat.options

Internal Options in Spatstat Package
as.matrix.im

Convert Pixel Image to Matrix
distmap.psp

Distance Map of Line Segment Pattern
by.im

Apply Function to Image Broken Down by Factor
Ldot

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

Data and Code From JRSS Discussion Paper on Residuals
crossdist.default

Pairwise distances between two different sets of points
marktable

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

Ord's Interaction model
Kest.fft

K-function using FFT
Kcross.inhom

Inhomogeneous Cross K Function
spatstat-deprecated

Deprecated spatstat functions
pixellate.owin

Convert Window to Pixel Image
ppx

Multidimensional Space-Time Point Pattern
crossing.psp

Crossing Points of Two Line Segment Patterns
rlabel

Random Re-Labelling of Point Pattern
distmap

Distance Map
Jmulti

Marked J Function
setmarks

Set or Reset the Marks in a Point Pattern
nearestsegment

Find Line Segment Nearest to Each Point
contour.im

Contour plot of pixel image
kstest.ppm

Kolmogorov-Smirnov Test for Point Process Model
density.ppp

Kernel Smoothed Intensity of Point Pattern
as.ppp

Convert Data To Class ppp
summary.listof

Summary of a List of Things
inforder.family

Infinite Order Interaction Family
lansing

Lansing Woods Point Pattern
as.mask

Pixel Image Approximation of a Window
anemones

Beadlet Anemones Data
rmh.ppm

Simulate from a Fitted Point Process Model
delaunay

Delaunay Triangulation of Point Pattern
finpines

Pine saplings in Finland.
intersect.owin

Intersection, Union or Set Subtraction of Two Windows
is.ppp

Test Whether An Object Is A Point Pattern
selfcrossing.psp

Crossing Points in a Line Segment Pattern
as.hyperframe.ppx

Extract coordinates and marks of multidimensional point pattern
Extract.listof

Extract or Replace Subset of a List of Things
Ord

Generic Ord Interaction model
endpoints.psp

Endpoints of Line Segment Pattern
Extract.ppp

Extract or Replace Subset of Point Pattern
crossdist

Pairwise distances
dirichlet

Dirichlet Tessellation of Point Pattern
superimposePSP

Superimpose Several Line Segment Patterns
angles.psp

Orientation Angles of Line Segments
betacells

Beta Ganglion Cells in Cat Retina
pp3

Three Dimensional Point Pattern
gridcentres

Rectangular grid of points
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
is.marked

Test Whether Marks Are Present
shift

Apply Vector Translation
reach

Interaction Distance of a Point Process
as.im

Convert to Pixel Image
Gcross

Multitype Nearest Neighbour Distance Function (i-to-j)
pairwise.family

Pairwise Interaction Process Family
as.owin

Convert Data To Class owin
cut.im

Convert Pixel Image from Numeric to Factor
as.tess

Convert Data To Tessellation
disc

Circular Window
miplot

Morishita Index Plot
Softcore

The Soft Core Point Process Model
concatxy

Concatenate x,y Coordinate Vectors
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
as.data.frame.ppp

Coerce Point Pattern to a Data Frame
distmap.ppp

Distance Map of Point Pattern
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
Extract.psp

Extract Subset of Line Segment Pattern
eroded.areas

Areas of Morphological Erosions
print.ppp

Print Brief Details of a Point Pattern Dataset
interp.im

Interpolate a Pixel Image
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
lgcp.estK

Fit a Log-Gaussian Cox Point Process by Minimum Contrast
Extract.splitppp

Extract or Replace Sub-Patterns
nndist

Nearest neighbour distances
convexhull.xy

Convex Hull of Points
cut.ppp

Classify Points in a Point Pattern
K3est

K-function of a Three-Dimensional Point Pattern
quadrat.test

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

Print Progress Reports
eval.fv

Evaluate Expression Involving Functions
copper

Berman-Huntington points and lines data
fitin.ppm

Extract the Interaction from a Fitted Point Process Model
affine.psp

Apply Affine Transformation To Line Segment Pattern
anova.ppm

ANOVA for Fitted Point Process Models
vertices

Vertices of a Window
rGaussPoisson

Simulate Gauss-Poisson Process
rescue.rectangle

Convert Window Back To Rectangle
rmpoint

Generate N Random Multitype Points
as.hyperframe

Convert Data to Hyperframe
colourmap

Colour Lookup Tables
multiplicity.ppp

Count Multiplicity of Duplicate Points
model.matrix.ppm

Extract Design Matrix from Point Process Model
Kmulti

Marked K-Function
square

Square Window
shift.owin

Apply Vector Translation To Window
chop.tess

Subdivide a Window or Tessellation using a Set of Lines
fitted.ppm

Fitted Conditional Intensity for Point Process Model
Kcross

Multitype K Function (Cross-type)
border

Border Region of a Window
midpoints.psp

Midpoints of Line Segment Pattern
opening

Morphological Opening
bramblecanes

Hutchings' Bramble Canes data
quadratcount

Quadrat counting for a point pattern
rMatClust

Simulate Matern Cluster Process
plot.owin

Plot a Spatial Window
murchison

Murchison gold deposits
pcfcross

Multitype pair correlation function
rmhmodel.list

Define Point Process Model for Metropolis-Hastings Simulation.
centroid.owin

Centroid of a window
harmonic

Basis for Harmonic Functions
quadratresample

Resample a Point Pattern by Resampling Quadrats
rshift

Random Shift
rmhmodel.default

Build Point Process Model for Metropolis-Hastings Simulation.
compatible.im

Test Whether Two Pixel Images Are Compatible
kppm

Fit cluster point process model
pcf.ppp

Pair Correlation Function of Point Pattern
discpartarea

Area of Part of Disc
intersect.tess

Intersection of Two Tessellations
psp

Create a Line Segment Pattern
methods.box3

Methods for Three-Dimensional Box
spatstat-package

The Spatstat Package
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
is.multitype.ppp

Test Whether A Point Pattern is Multitype
plot.fv

Plot Function Values
summary.splitppp

Summary of a Split Point Pattern
Lest

L-function
hamster

Aherne's hamster tumour data
with.hyperframe

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

Interpret Fitted Model for Metropolis-Hastings Simulation.
tiles

Extract List of Tiles in a Tessellation
lurking

Lurking variable plot
lengths.psp

Lengths of Line Segments
bdist.points

Distance to Boundary of Window
eval.im

Evaluate Expression Involving Pixel Images
Iest

Estimate the I-function
nnwhich

Nearest neighbour
crossdist.ppp

Pairwise distances between two different point patterns
plot.quad

plot a Spatial Quadrature Scheme
markcorrint

Mark Correlation Integral
iplot

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

Convert Point Pattern to Another Unit of Length
pairdist.default

Pairwise distances
LennardJones

The Lennard-Jones Potential
discretise

Safely Convert Point Pattern Window to Binary Mask
print.im

Print Brief Details of an Image
AreaInter

The Area Interaction Point Process Model
plot.ppm

plot a Fitted Point Process Model
gpc2owin

Convert Polygonal Region into Different Format
distfun

Distance Map as a Function
Lcross

Multitype L-function (cross-type)
union.quad

Union of Data and Dummy Points
markcorr

Mark Correlation Function
as.psp

Convert Data To Class psp
pppmatching

Create a Point Matching
rpoint

Generate N Random Points
coef.ppm

Coefficients of Fitted Point Process Model
clarkevans

Clark and Evans Aggregation Index
matchingdist

Distance for a Point Pattern Matching
MultiStrauss

The Multitype Strauss Point Process Model
model.images

Compute Images of Constructed Covariates
rmpoispp

Generate Multitype Poisson Point Pattern
is.convex

Test Whether a Window is Convex
pppdist

Distance Between Two Point Patterns
SatPiece

Piecewise Constant Saturated Pairwise Interaction Point Process Model
is.multitype

Test whether Object is Multitype
is.subset.owin

Determine Whether One Window is Contained In Another
rThomas

Simulate Thomas Process
pixellate.ppp

Convert Point Pattern to Pixel Image
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
print.psp

Print Brief Details of a Line Segment Pattern Dataset
ewcdf

Weighted Empirical Cumulative Distribution Function
profilepl

Profile Maximum Pseudolikelihood
split.im

Divide Image Into Sub-images
ppm

Fit Point Process Model to Data
bounding.box

Bounding Box of a Window or Point Pattern
redwood

California Redwoods Point Pattern (Ripley's Subset)
amacrine

Hughes' Amacrine Cell Data
owin.object

Class owin
identify.ppp

Identify Points in a Point Pattern
rMosaicSet

Mosaic Random Set
raster.x

Cartesian Coordinates for a Pixel Raster
simulate.ppm

Simulate a Fitted Gibbs Point Process Model
is.empty

Test Whether An Object Is Empty
infline

Infinite Straight Lines
plot.splitppp

Plot a List of Point Patterns
print.owin

Print Brief Details of a Spatial Window
nearest.raster.point

Find Pixel Nearest to a Given Point
G3est

Nearest Neighbour Distance Distribution Function of a Three-Dimensional Point Pattern
runifpointOnLines

Generate N Uniform Random Points On Line Segments
Jdot

Multitype J Function (i-to-any)
plot.colourmap

Plot a Colour Map
rMaternII

Simulate Matern Model II
summary.quad

Summarizing a Quadrature Scheme
pairdist.psp

Pairwise distances between line segments
rsyst

Simulate systematic random point pattern
print.quad

Print a Quadrature Scheme
plot.psp

plot a Spatial Line Segment Pattern
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
effectfun

Compute Fitted Effect of a Spatial Covariate in a Point Process Model
inside.owin

Test Whether Points Are Inside A Window
runifpoint

Generate N Uniform Random Points
plot.im

Plot a Pixel Image
corners

Corners of a rectangle
eem

Exponential Energy Marks
plot.bermantest

Plot Result of Berman Test
print.ppm

Print a Fitted Point Process Model
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
rotate.psp

Rotate a Line Segment Pattern
project2segment

Move Point To Nearest Line
rshift.splitppp

Randomly Shift a List of Point Patterns
Extract.fasp

Extract Subset of Function Array
dilated.areas

Areas of Morphological Dilations
rescale.im

Convert Pixel Image to Another Unit of Length
superimpose

Superimpose Several Point Patterns
distmap.owin

Distance Map of Window
summary.ppm

Summarizing a Fitted Point Process Model
quadrat.test.splitppp

Chi-Squared Test of CSR for Split Point Pattern
setcov

Set Covariance of a Window
pixellate

Convert Spatial Object to Pixel Image
rescale.owin

Convert Window to Another Unit of Length
quad.object

Class of Quadrature Schemes
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
trim.rectangle

Cut margins from rectangle
affine.owin

Apply Affine Transformation To Window
rshift.ppp

Randomly Shift a Point Pattern
urkiola

Urkiola Woods Point Pattern
update.kppm

Update a Fitted Cluster Point Process Model
rshift.psp

Randomly Shift a Line Segment Pattern
simdat

Simulated Point Pattern
levelset

Level Set of a Pixel Image
plot.fasp

Plot a Function Array
nbfires

Point Patterns of New Brunswick Forest Fires
rpoislinetess

Poisson Line Tessellation
plot.tess

Plot a tessellation
crossdist.psp

Pairwise distances between two different line segment patterns
rjitter

Random Perturbation of a Point Pattern
ord.family

Ord Interaction Process Family
rescale

Convert dataset to another unit of length
fryplot

Fry Plot of Point Pattern
is.multitype.ppm

Test Whether A Point Process Model is Multitype
unitname

Name for Unit of Length
japanesepines

Japanese Pines Point Pattern
im.object

Class of Images
solutionset

Evaluate Logical Expression Involving Pixel Images and Return Region Where Expression is True
rotate.ppp

Rotate a Point Pattern
markvario

Mark Variogram
pcf.fasp

Pair Correlation Function obtained from array of K functions
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
compatible.fasp

Test Whether Two Function Arrays Are Compatible
shapley

Galaxies in the Shapley Supercluster
plot.kstest

Plot a Spatial Kolmogorov-Smirnov Test
rpoisline

Generate Poisson Random Line Process
plot.pp3

Plot a three-dimensional point pattern
methods.ppx

Methods for Multidimensional Space-Time Point Patterns
tess

Create a Tessellation
shift.im

Apply Vector Translation To Pixel Image
update.ppm

Update a Fitted Point Process Model
with.fv

Evaluate an Expression in a Function Table
scanpp

Read Point Pattern From Data File
plot.ppp

plot a Spatial Point Pattern
rcell

Simulate Baddeley-Silverman Cell Process
nncorr

Nearest-Neighbour Correlation Indices of Marked Point Pattern
unique.ppp

Extract Unique Points from a Spatial Point Pattern
quadscheme

Generate a Quadrature Scheme from a Point Pattern
logLik.ppm

Log Likelihood for Poisson Point Process Model
markconnect

Mark Connection Function
is.ppm

Test Whether An Object Is A Fitted Point Process Model
summary.im

Summarizing a Pixel Image
reduced.sample

Reduced Sample Estimator using Histogram Data
Gmulti

Marked Nearest Neighbour Distance Function
simulate.kppm

Simulate a Fitted Cluster Point Process Model
rlinegrid

Generate grid of parallel lines with random displacement
rMosaicField

Mosaic Random Field
residuals.ppm

Residuals for Fitted Point Process Model
rpoispp

Generate Poisson Point Pattern
owin

Create a Window
stieltjes

Compute Integral of Function Against Cumulative Distribution
letterR

Window in Shape of Letter R
predict.ppm

Prediction from a Fitted Point Process Model
is.owin

Test Whether An Object Is A Window
pixelquad

Quadrature Scheme Based on Pixel Grid
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
rStrauss

Perfect Simulation of the Strauss Process
ppp

Create a Point Pattern
rmh.default

Simulate Point Process Models using the Metropolis-Hastings Algorithm.
rescale.psp

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

Class of Line Segment Patterns
shift.ppp

Apply Vector Translation To Point Pattern
localK

Neighbourhood density function
incircle

Find Largest Circle Inside Window
suffstat

Sufficient Statistic of Point Process Model
spruces

Spruces Point Pattern
nncross

Nearest Neighbours Between Two Patterns
fv.object

Data Frames of Function Values
summary.owin

Summary of a Spatial Window
ppm.object

Class of Fitted Point Process Models
shift.psp

Apply Vector Translation To Line Segment Pattern
bdist.tiles

Distance to Boundary of Window
split.ppp

Divide Point Pattern into Sub-patterns
methods.pp3

Methods for three-dimensional point patterns
summary.psp

Summary of a Line Segment Pattern Dataset
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
persp.im

Perspective Plot of Pixel Image
im

Create a Pixel Image Object
rpoisppOnLines

Generate Poisson Point Pattern on Line Segments
plot.listof

Plot a List of Things
summary.ppp

Summary of a Point Pattern Dataset
pointsOnLines

Place Points Evenly Along Specified Lines
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
plot.hyperframe

Plot Entries in a Hyperframe
rSSI

Simulate Simple Sequential Inhibition
swedishpines

Swedish Pines Point Pattern
longleaf

Longleaf Pines Point Pattern
ppp.object

Class of Point Patterns
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
plot.kppm

Plot a fitted cluster point process
qqplot.ppm

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

Pairwise distances
mincontrast

Method of Minimum Contrast
Kdot

Multitype K Function (i-to-any)
perimeter

Perimeter Length of Window
is.marked.ppm

Test Whether A Point Process Model is Marked
convexhull

Convex Hull
areaGain

Difference of Disc Areas
erosion

Morphological Erosion
mean.im

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

Simulation envelopes of summary function
affine.ppp

Apply Affine Transformation To Point Pattern
bdist.pixels

Distance to Boundary of Window
ants

Harkness-Isham ants' nests data
by.ppp

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

Interactively Add Points
lut

Lookup Tables
demopat

Artificial Data Point Pattern
istat

Point and Click Interface for Exploratory Analysis of Point Pattern
blur

Apply Gaussian Blur to a Pixel Image
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
ponderosa

Ponderosa Pine Tree Point Pattern
ripras

Estimate window from points alone
smooth.ppp

Spatial smoothing of observations at irregular points
simplify.owin

Approximate a Polygon by a Simpler Polygon
quadrats

Divide Region into Quadrats
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
quantile.im

Sample Quantiles of Pixel Image
unmark

Remove Marks
eval.fasp

Evaluate Expression Involving Function Arrays
pairdist.ppp

Pairwise distances
rNeymanScott

Simulate Neyman-Scott Process
rotate.owin

Rotate a Window
rMaternI

Simulate Matern Model I
spokes

Spokes pattern of dummy points
plot.plotppm

Plot a plotppm Object Created by plot.ppm