Learn R Programming

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

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

17,668

Version

1.15-2

License

GPL (>= 2)

Maintainer

Adrian Baddeley

Last Published

April 16th, 2009

Functions in spatstat (1.15-2)

rotate.owin

Rotate a Window
rsyst

Simulate systematic random point pattern
runifpointOnLines

Generate N Uniform Random Points On Line Segments
square

Square Window
subset.fasp

Extract Subset of Function Array
update.kppm

Update a Fitted Cluster Point Process Model
summary.ppp

Summary of a Point Pattern Dataset
rmhmodel.ppm

Interpret Fitted Model for Metropolis-Hastings Simulation.
subset.fv

Extract Subset of Function Values
as.data.frame.ppp

Coerce Point Pattern to a Data Frame
Kcross.inhom

Inhomogeneous Cross K Function
rthin

Random Thinning
unique.ppp

Extract Unique Points from a Spatial Point Pattern
superimpose

Superimpose Several Point Patterns
summary.owin

Summary of a Spatial Window
simulate.kppm

Simulate a fitted cluster point process model.
tiles

Extract List of Tiles in a Tessellation
envelope

Simulation envelopes of summary function
subset.splitppp

Extract or Replace Sub-Patterns
rpoisline

Generate Poisson Random Line Process
ppp

Create a Point Pattern
rmhstart

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

Data Frames of Function Values
scanpp

Read Point Pattern From Data File
stieltjes

Compute Integral of Function Against Cumulative Distribution
solutionset

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

Rotate
fitted.ppm

Fitted Conditional Intensity for Point Process Model
spokes

Spokes pattern of dummy points
[.quad

Subset of Quadrature Scheme
subset.im

Extract Subset of Image
split.im

Divide Image Into Sub-images
rstrat

Simulate Stratified Random Point Pattern
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
trim.rectangle

Cut margins from rectangle
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
rmpoispp

Generate Multitype Poisson Point Pattern
subset.listof

Extract or Replace Subset of a List of Things
superimposePSP

Superimpose Several Line Segment Patterns
update.ppm

Update a Fitted Point Process Model
rotate.psp

Rotate a Line Segment Pattern
summary.listof

Summary of a List of Things
subset.psp

Extract Subset of Line Segment Pattern
summary.splitppp

Summary of a Split Point Pattern
shift.psp

Apply Vector Translation To Line Segment Pattern
shift.ppp

Apply Vector Translation To Point Pattern
rmhmodel.list

Define Point Process Model for Metropolis-Hastings Simulation.
swedishpines

Swedish Pines Point Pattern
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
runifdisc

Generate N Uniform Random Points in a Disc
tess

Create a Tessellation
setcov

Set Covariance of a Window
subset.ppp

Extract or Replace Subset of Point Pattern
rshift.ppp

Randomly Shift a Point Pattern
unmark

Remove Marks
subsetget.im

Reset Values in Subset of Image
setmarks

Set or Reset the Marks in a Point Pattern
split.ppp

Divide Point Pattern into Sub-patterns
bounding.box.xy

Convex Hull of Points
[.tess

Extract or Replace Subset of Tessellation
unitname

Name for Unit of Length
rshift

Random Shift
Linhom

L-function
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
affine.ppp

Apply Affine Transformation To Point Pattern
spruces

Spruces Point Pattern
rpoisppOnLines

Generate Poisson Point Pattern on Line Segments
angles.psp

Orientation Angles of Line Segments
rshift.psp

Randomly Shift a Line Segment Pattern
shift.im

Apply Vector Translation To Pixel Image
rmpoint

Generate N Random Multitype Points
shift.owin

Apply Vector Translation To Window
shift

Apply Vector Translation
Kdot

Multitype K Function (i-to-any)
rpoislinetess

Poisson Line Tessellation
Geyer

Geyer's Saturation Point Process Model
runifpoint

Generate N Uniform Random Points
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
as.owin

Convert Data To Class owin
as.psp

Convert Data To Class psp
clip.infline

Intersect Infinite Straight Lines with a Window
summary.ppm

Summarizing a Fitted Point Process Model
rotate.ppp

Rotate a Point Pattern
intersect.tess

Intersection of Two Tessellations
as.ppp

Convert Data To Class ppp
effectfun

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

Generate Poisson Point Pattern
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
rpoint

Generate N Random Points
Lcross

Multitype L-function (cross-type)
affine.owin

Apply Affine Transformation To Window
simdat

Simulated Point Pattern
density.psp

Kernel Smoothing of Line Segment Pattern
dirichlet

Dirichlet Tessellation of Point Pattern
summary.im

Summarizing a Pixel Image
fryplot

Fry Plot of Point Pattern
smooth.ppp

Spatial smoothing of observations at irregular points
append.psp

Combine Two Line Segment Patterns
Pairwise

Generic Pairwise Interaction model
bdist.points

Distance to Boundary of Window
as.matrix.im

Convert Pixel Image to Matrix
Ldot

Multitype L-function (i-to-any)
is.multitype

Test whether Object is Multitype
endpoints.psp

Endpoints of Line Segment Pattern
Fest

Estimate the empty space function F
crossing.psp

Crossing Points of Two Line Segment Patterns
suffstat

Sufficient Statistic of Point Process Model
ants

Harkness-Isham ants' nests data
summary.psp

Summary of a Line Segment Pattern Dataset
urkiola

Urkiola Woods Point Pattern
crossdist.ppp

Pairwise distances between two different point patterns
clarkevans

Clark and Evans Aggregation Index
rshift.splitppp

Randomly Shift a List of Point Patterns
im.object

Class of Images
quadrat.test

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

Safely Convert Point Pattern Window to Binary Mask
cut.ppp

Classify Points in a Point Pattern
print.quad

Print a Quadrature Scheme
pairwise.family

Pairwise Interaction Process Family
pcf

Pair Correlation Function
colourmap

Colour Lookup Tables
areadiff

Difference of Disc Areas
Lest

L-function
predict.ppm

Prediction from a Fitted Point Process Model
amacrine

Hughes' Amacrine Cell Data
nearestsegment

Find Line Segment Nearest to Each Point
density.ppp

Kernel Smoothed Intensity of Point Pattern
BadGey

Hybrid Geyer Point Process Model
rNeymanScott

Simulate Neyman-Scott Process
coef.ppm

Coefficients of Fitted Point Process Model
by.ppp

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

Ord's Interaction model
Emark

Diagnostics for random marking
complement.owin

Take Complement of a Window
eval.hyper

Evaluate an Expression in Each Row of a Hyperframe
erode.owin

Erode a Window
Strauss

The Strauss Point Process Model
crossdist

Pairwise distances
is.ppp

Test Whether An Object Is A Point Pattern
rjitter

Random Perturbation of a Point Pattern
inforder.family

Infinite Order Interaction Family
gpc2owin

Convert Polygonal Region into Different Format
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
plot.splitppp

Plot a List of Point Patterns
rThomas

Simulate Thomas Process
pairdist.psp

Pairwise distances between line segments
eval.fv

Evaluate Expression Involving Functions
as.tess

Convert Data To Tessellation
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
hamster

Aherne's hamster tumour data
Jest

Estimate the J-function
eem

Exponential Energy Marks
plot.colourmap

Plot a Colour Map
rescue.rectangle

Convert Window Back To Rectangle
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
Kinhom

Inhomogeneous K-function
affine

Apply Affine Transformation
clickppp

Interactively Add Points
psp.object

Class of Line Segment Patterns
adaptive.density

Intensity Estimate of Point Pattern Using Tessellation
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
rStrauss

Perfect Simulation of the Strauss Process
concatxy

Concatenate x,y Coordinate Vectors
spatstat-internal

Internal spatstat functions
Kdot.inhom

Inhomogeneous Multitype K Dot Function
Gcross

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

California Redwoods Point Pattern (Ripley's Subset)
murchison

Murchison gold deposits
is.marked.ppp

Test Whether A Point Pattern is Marked
Kest

K-function
nncross

Nearest Neighbours Between Two Patterns
Kcross

Multitype K Function (Cross-type)
distmap.psp

Distance Map of Line Segment Pattern
compatible.fasp

Test Whether Two Function Arrays Are Compatible
plot.psp

plot a Spatial Line Segment Pattern
model.matrix.ppm

Extract Design Matrix from Point Process Model
plot.plotppm

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

Class of Point Patterns
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
nearest.raster.point

Find Pixel Nearest to a Given Point
LennardJones

The Lennard-Jones Potential
Jcross

Multitype J Function (i-to-j)
pppdist

Distance Between Two Point Patterns
quadratcount

Quadrat counting for a point pattern
as.mask

Pixel Image Approximation of a Window
persp.im

Perspective Plot of Pixel Image
allstats

Calculate four standard summary functions of a point pattern.
Kmulti

Marked K-Function
blur

Apply Gaussian Blur to a Pixel Image
longleaf

Longleaf Pines Point Pattern
pcf.ppp

Pair Correlation Function of Point Pattern
demopat

Artificial Data Point Pattern
spatstat-deprecated

Deprecated spatstat functions
plot.tess

Plot a tessellation
Gest

Nearest Neighbour Distance Function G
pairdist

Pairwise distances
as.im

Convert to Pixel Image
rlabel

Random Re-Labelling of Point Pattern
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
predict.kppm

Prediction from a Fitted Cluster Point Process Model
bdist.pixels

Distance to Boundary of Window
rMosaicSet

Mosaic Random Set
Hest

Spherical Contact Distribution Function
marktable

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

Estimate the I-function
rlinegrid

Generate grid of parallel lines with random displacement
Gdot

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

Define Point Process Model for Metropolis-Hastings Simulation.
model.images

Compute Images of Constructed Covariates
chop.tess

Subdivide a Window or Tessellation using a Set of Lines
disc

Circular Window
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
fitin.ppm

Extract the Interaction from a Fitted Point Process Model
reach

Interaction Distance of a Point Process
data.ppm

Extract Original Data from a Fitted Point Process Model
alltypes

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

The Area Interaction Point Process Model
pixelquad

Quadrature Scheme Based on Pixel Grid
rescale.im

Convert Pixel Image to Another Unit of Length
ppm.object

Class of Fitted Point Process Models
mean.im

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

Test Whether An Object Is A Pixel Image
heather

Diggle's Heather Data
centroid.owin

Centroid of a window
hyperframe

Hyper Data Frame
lgcp.estK

Fit a Log-Gaussian Cox Point Process by Minimum Contrast
Kest.fft

K-function using FFT
residuals.ppm

Residuals for Fitted Point Process Model
rMaternII

Simulate Matern Model II
convexhull.xy

Convex Hull of Points
anova.ppm

ANOVA for Fitted Point Process Models
DiggleGratton

Diggle-Gratton model
bei

Tropical rain forest trees
Jdot

Multitype J Function (i-to-any)
project2segment

Move Point To Nearest Line
chorley

Chorley-Ribble Cancer Data
nndist.psp

Nearest neighbour distances between line segments
markvario

Mark Variogram
default.dummy

Generate a Default Pattern of Dummy Points
pcf.fv

Pair Correlation Function obtained from K Function
im

Create a Pixel Image Object
incircle

Find Largest Circle Inside Window
psp

Create a Line Segment Pattern
is.marked

Test Whether Marks Are Present
hist.im

Histogram of Pixel Values in an Image
rmh.ppm

Simulate from a Fitted Point Process Model
nndist

Nearest neighbour distances
lansing

Lansing Woods Point Pattern
kstest.ppm

Kolmogorov-Smirnov Test for Point Process Model
rescale.ppp

Convert Point Pattern to Another Unit of Length
Jmulti

Marked J Function
corners

Corners of a rectangle
plot.owin

Plot a Spatial Window
multiplicity.ppp

Count Multiplicity of Duplicate Points
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
miplot

Morishita Index Plot
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
dilate.owin

Dilate a Window
lengths.psp

Lengths of Line Segments
owin

Create a Window
localK

Neighbourhood density function
plot.listof

Plot a List of Things
ord.family

Ord Interaction Process Family
area.owin

Area of a Window
pixellate

Convert Point Pattern to Pixel Image
compatible.fv

Test Whether Two Function Objects Are Compatible
ewcdf

Weighted Empirical Cumulative Distribution Function
japanesepines

Japanese Pines Point Pattern
kppm

Fit cluster point process model
lut

Lookup Tables
infline

Infinite Straight Lines
affine.psp

Apply Affine Transformation To Line Segment Pattern
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
MultiStrauss

The Multitype Strauss Point Process Model
plot.ppm

plot a Fitted Point Process Model
is.ppm

Test Whether An Object Is A Fitted Point Process Model
betacells

Beta Ganglion Cells in Cat Retina
closing.owin

Morphological Closing of a Window
finpines

Pine saplings in Finland.
clickpoly

Interactively Define a Polygon
expand.owin

Expand Window By Factor
pcfcross

Multitype pair correlation function
rmhcontrol

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

Plot a Pixel Image
distmap.owin

Distance Map of Window
eval.im

Evaluate Expression Involving Pixel Images
matchingdist

Distance for a Point Pattern Matching
print.ppm

Print a Fitted Point Process Model
qqplot.ppm

Q-Q Plot of Residuals from Fitted Point Process Model
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
Softcore

The Soft Core Point Process Model
intersect.owin

Intersection or Union of Two Windows
contour.im

Contour plot of pixel image
rescale.owin

Convert Window to Another Unit of Length
pppmatching.object

Class of Point Matchings
cut.im

Convert Pixel Image from Numeric to Factor
rMaternI

Simulate Matern Model I
owin.object

Class owin
rSSI

Simulate Simple Sequential Inhibition
print.owin

Print Brief Details of a Spatial Window
eroded.areas

Areas of Morphological Erosions
rmh.default

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

Method of Minimum Contrast
spatstat.options

Internal Options in Spatstat Package
fasp.object

Function Arrays for Spatial Patterns
plot.fasp

Plot a Function Array
delaunay

Delaunay Triangulation of Point Pattern
bramblecanes

Hutchings' Bramble Canes data
cells

Biological Cells Point Pattern
nztrees

New Zealand Trees Point Pattern
as.data.frame.psp

Coerce Line Segment Pattern to a Data Frame
is.subset.owin

Determine Whether One Window is Contained In Another
gridcentres

Rectangular grid of points
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
spatstat

The Spatstat Package
by.im

Apply Function to Image Broken Down by Factor
markcorr

Mark Correlation Function
Poisson

Poisson Point Process Model
pppmatching

Create a Point Matching
letterR

Window in Shape of Letter R
rGaussPoisson

Simulate Gauss-Poisson Process
eval.fasp

Evaluate Expression Involving Function Arrays
SatPiece

Piecewise Constant Saturated Pairwise Interaction Point Process Model
progressreport

Print Progress Reports
distmap.ppp

Distance Map of Point Pattern
levelset

Level Set of a Pixel Image
pcf.fasp

Pair Correlation Function obtained from array of K functions
ripras

Estimate window from points alone
is.multitype.ppm

Test Whether A Point Process Model is Multitype
pairsat.family

Saturated Pairwise Interaction Point Process Family
ponderosa

Ponderosa Pine Tree Point Pattern
rMosaicField

Mosaic Random Field
Kmeasure

Reduced Second Moment Measure
rmhmodel.default

Build Point Process Model for Metropolis-Hastings Simulation.
Ord

Generic Ord Interaction model
copper

Berman-Huntington points and lines data
quadrat.test.splitppp

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

Log Likelihood for Poisson Point Process Model
ppm

Fit Point Process Model to Data
nbfires

Point Patterns of New Brunswick Forest Fires
rMatClust

Simulate Matern Cluster Process
pointsOnLines

Place Points Evenly Along Specified Lines
selfcrossing.psp

Crossing Points in a Line Segment Pattern
raster.x

Cartesian Coordinates for a Pixel Raster
gridweights

Compute Quadrature Weights Based on Grid Counts
markcorrint

Mark Correlation Integral
plot.ppp

plot a Spatial Point Pattern
distmap

Distance Map
diameter

Diameter of a Window
profilepl

Profile Maximum Pseudolikelihood
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
pairdist.default

Pairwise distances
lurking

Lurking variable plot
rcell

Simulate Baddeley-Silverman Cell Process
union.quad

Union of Data and Dummy Points
markconnect

Mark Connection Function
quantile.im

Sample Quantiles of Pixel Image
harmonic

Basis for Harmonic Functions
print.im

Print Brief Details of an Image
Saturated

Saturated Pairwise Interaction model
print.ppp

Print Brief Details of a Point Pattern Dataset
StraussHard

The Strauss / Hard Core Point Process Model
quad.object

Class of Quadrature Schemes
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
midpoints.psp

Midpoints of Line Segment Pattern
quadrats

Divide Region into Quadrats
crossdist.default

Pairwise distances between two different sets of points
is.marked.ppm

Test Whether A Point Process Model is Marked
bounding.box

Bounding Box of a Window or Point Pattern
nnwhich

Nearest neighbour
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
interp.im

Interpolate a Pixel Image
identify.ppp

Identify Points in a Point Pattern
plot.fv

Plot Function Valuesn
is.owin

Test Whether An Object Is A Window
Gmulti

Marked Nearest Neighbour Distance Function
pairdist.ppp

Pairwise distances
is.multitype.ppp

Test Whether A Point Pattern is Multitype
opening.owin

Morphological Opening of a Window
plot.quad

plot a Spatial Quadrature Scheme
compatible.im

Test Whether Two Pixel Images Are Compatible
inside.owin

Test Whether Points Are Inside A Window
vertices

Vertices of a Window
quadscheme

Generate a Quadrature Scheme from a Point Pattern
crossdist.psp

Pairwise distances between two different line segment patterns
with.fv

Evaluate an Expression in a Function Table
print.psp

Print Brief Details of a Line Segment Pattern Dataset
as.rectangle

Window Frame
plot.hyperframe

Plot Entries in a Hyperframe
quadratresample

Resample a Point Pattern by Resampling Quadrats
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
plot.kppm

Plot a fitted cluster point process
reduced.sample

Reduced Sample Estimator using Histogram Data
summary.quad

Summarizing a Quadrature Scheme
anemones

Beadlet Anemones Data
rescale

Convert dataset to another unit of length