Learn R Programming

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

spatstat (version 1.16-3)

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

16,590

Version

1.16-3

License

GPL (>= 2)

Maintainer

Adrian Baddeley

Last Published

October 13th, 2009

Functions in spatstat (1.16-3)

Extract.fv

Extract Subset of Function Values
Extract.listof

Extract or Replace Subset of a List of Things
MultiStrauss

The Multitype Strauss Point Process Model
Extract.quad

Subset of Quadrature Scheme
Ord

Generic Ord Interaction model
affine.ppp

Apply Affine Transformation To Point Pattern
as.owin

Convert Data To Class owin
Lcross

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

Take Complement of a Window
is.multitype

Test whether Object is Multitype
Lcross.inhom

Inhomogeneous Cross Type L Function
letterR

Window in Shape of Letter R
Ldot

Multitype L-function (i-to-any)
angles.psp

Orientation Angles of Line Segments
Jcross

Multitype J Function (i-to-j)
Extract.splitppp

Extract or Replace Sub-Patterns
Kest

K-function
Kmeasure

Reduced Second Moment Measure
areaLoss

Difference of Disc Areas
Emark

Diagnostics for random marking
Fest

Estimate the empty space function F
LennardJones

The Lennard-Jones Potential
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
Extract.tess

Extract or Replace Subset of Tessellation
Linhom

L-function
bdist.points

Distance to Boundary of Window
Kmulti

Marked K-Function
Pairwise

Generic Pairwise Interaction model
alltypes

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

Marked J Function
amacrine

Hughes' Amacrine Cell Data
area.owin

Area of a Window
coef.ppm

Coefficients of Fitted Point Process Model
eval.fv

Evaluate Expression Involving Functions
hamster

Aherne's hamster tumour data
convexhull.xy

Convex Hull of Points
Softcore

The Soft Core Point Process Model
centroid.owin

Centroid of a window
lgcp.estK

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

Multitype J Function (i-to-any)
concatxy

Concatenate x,y Coordinate Vectors
inforder.family

Infinite Order Interaction Family
Kest.fft

K-function using FFT
marktable

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

Piecewise Constant Saturated Pairwise Interaction Point Process Model
as.mask

Pixel Image Approximation of a Window
cut.im

Convert Pixel Image from Numeric to Factor
markvario

Mark Variogram
matchingdist

Distance for a Point Pattern Matching
BadGey

Hybrid Geyer Point Process Model
as.data.frame.psp

Coerce Line Segment Pattern to a Data Frame
Saturated

Saturated Pairwise Interaction model
pixellate.owin

Convert Window to Pixel Image
chop.tess

Subdivide a Window or Tessellation using a Set of Lines
pppmatching

Create a Point Matching
cells

Biological Cells Point Pattern
convexhull

Convex Hull
Gdot

Multitype Nearest Neighbour Distance Function (i-to-any)
density.ppp

Kernel Smoothed Intensity of Point Pattern
Extract.psp

Extract Subset of Line Segment Pattern
bdist.pixels

Distance to Boundary of Window
Poisson

Poisson Point Process Model
crossdist.ppp

Pairwise distances between two different point patterns
affine

Apply Affine Transformation
affine.owin

Apply Affine Transformation To Window
Strauss

The Strauss Point Process Model
dirichlet

Dirichlet Tessellation of Point Pattern
Kdot.inhom

Inhomogeneous Multitype K Dot Function
markcorrint

Mark Correlation Integral
affine.psp

Apply Affine Transformation To Line Segment Pattern
effectfun

Compute Fitted Effect of a Spatial Covariate in a Point Process Model
dummy.ppm

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

Extract or Replace Subset of Point Pattern
anemones

Beadlet Anemones Data
by.im

Apply Function to Image Broken Down by Factor
nndist.psp

Nearest neighbour distances between line segments
lansing

Lansing Woods Point Pattern
Extract.im

Extract Subset of Image
as.rectangle

Window Frame
as.ppp

Convert Data To Class ppp
eval.fasp

Evaluate Expression Involving Function Arrays
blur

Apply Gaussian Blur to a Pixel Image
corners

Corners of a rectangle
heather

Diggle's Heather Data
default.dummy

Generate a Default Pattern of Dummy Points
crossdist.default

Pairwise distances between two different sets of points
Ldot.inhom

Inhomogeneous Multitype L Dot Function
distmap.ppp

Distance Map of Point Pattern
Gmulti

Marked Nearest Neighbour Distance Function
intersect.owin

Intersection or Union of Two Windows
is.multitype.ppp

Test Whether A Point Pattern is Multitype
OrdThresh

Ord's Interaction model
Extract.fasp

Extract Subset of Function Array
murchison

Murchison gold deposits
is.empty

Test Whether An Object Is Empty
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
plot.hyperframe

Plot Entries in a Hyperframe
owin

Create a Window
nncross

Nearest Neighbours Between Two Patterns
density.psp

Kernel Smoothing of Line Segment Pattern
Kdot

Multitype K Function (i-to-any)
rMosaicSet

Mosaic Random Set
is.subset.owin

Determine Whether One Window is Contained In Another
AreaInter

The Area Interaction Point Process Model
Kcross.inhom

Inhomogeneous Cross K Function
StraussHard

The Strauss / Hard Core Point Process Model
pcf.ppp

Pair Correlation Function of Point Pattern
finpines

Pine saplings in Finland.
plot.owin

Plot a Spatial Window
bounding.box.xy

Convex Hull of Points
iplot

Point and Click Interface for Displaying a Point Pattern
dilation

Morphological Dilation
ewcdf

Weighted Empirical Cumulative Distribution Function
clarkevans

Clark and Evans Aggregation Index
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
rMosaicField

Mosaic Random Field
Gest

Nearest Neighbour Distance Function G
data.ppm

Extract Original Data from a Fitted Point Process Model
anova.ppm

ANOVA for Fitted Point Process Models
is.convex

Test Whether a Window is Convex
DiggleGratton

Diggle-Gratton model
betacells

Beta Ganglion Cells in Cat Retina
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
Replace.im

Reset Values in Subset of Image
disc

Circular Window
as.tess

Convert Data To Tessellation
spatstat-internal

Internal spatstat functions
distfun

Distance Map as a Function
adaptive.density

Intensity Estimate of Point Pattern Using Tessellation
append.psp

Combine Two Line Segment Patterns
as.matrix.im

Convert Pixel Image to Matrix
plot.ppp

plot a Spatial Point Pattern
chorley

Chorley-Ribble Cancer Data
distmap.owin

Distance Map of Window
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
rmhmodel.ppm

Interpret Fitted Model for Metropolis-Hastings Simulation.
rotate.ppp

Rotate a Point Pattern
discpartarea

Area of Part of Disc
connected

Connected components of an image or window
bounding.box

Bounding Box of a Window or Point Pattern
clickppp

Interactively Add Points
compatible.im

Test Whether Two Pixel Images Are Compatible
split.im

Divide Image Into Sub-images
setmarks

Set or Reset the Marks in a Point Pattern
square

Square Window
identify.ppp

Identify Points in a Point Pattern
plot.bermantest

Plot Result of Berman Test
Kcross

Multitype K Function (Cross-type)
nncorr

Nearest-Neighbour Correlation Indices of Marked Point Pattern
Iest

Estimate the I-function
as.im

Convert to Pixel Image
nndist

Nearest neighbour distances
crossing.psp

Crossing Points of Two Line Segment Patterns
delaunay

Delaunay Triangulation of Point Pattern
mean.im

Mean, Median and Range of Pixel Values in an Image
as.data.frame.ppp

Coerce Point Pattern to a Data Frame
kppm

Fit cluster point process model
ants

Harkness-Isham ants' nests data
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
distmap.psp

Distance Map of Line Segment Pattern
dilated.areas

Areas of Morphological Dilations
psp.object

Class of Line Segment Patterns
bramblecanes

Hutchings' Bramble Canes data
model.images

Compute Images of Constructed Covariates
quadrat.test

Chi-Squared Dispersion Test for Spatial Point Pattern Based on Quadrat Counts
cut.ppp

Classify Points in a Point Pattern
Lest

L-function
print.im

Print Brief Details of an Image
project2segment

Move Point To Nearest Line
persp.im

Perspective Plot of Pixel Image
fryplot

Fry Plot of Point Pattern
owin.object

Class owin
pixellate

Convert Spatial Object to Pixel Image
pixellate.ppp

Convert Point Pattern to Pixel Image
Kinhom

Inhomogeneous K-function
pairwise.family

Pairwise Interaction Process Family
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
plot.colourmap

Plot a Colour Map
areaGain

Difference of Disc Areas
ord.family

Ord Interaction Process Family
diameter

Diameter of a Window
as.polygonal

Convert a Window to a Polygonal Window
infline

Infinite Straight Lines
bei

Tropical rain forest trees
print.ppm

Print a Fitted Point Process Model
rGaussPoisson

Simulate Gauss-Poisson Process
summary.splitppp

Summary of a Split Point Pattern
predict.ppm

Prediction from a Fitted Point Process Model
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
pppmatching.object

Class of Point Matchings
intersect.tess

Intersection of Two Tessellations
endpoints.psp

Endpoints of Line Segment Pattern
fasp.object

Function Arrays for Spatial Patterns
longleaf

Longleaf Pines Point Pattern
rNeymanScott

Simulate Neyman-Scott Process
markconnect

Mark Connection Function
rlinegrid

Generate grid of parallel lines with random displacement
gridcentres

Rectangular grid of points
summary.ppm

Summarizing a Fitted Point Process Model
summary.owin

Summary of a Spatial Window
hist.im

Histogram of Pixel Values in an Image
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
incircle

Find Largest Circle Inside Window
crossdist

Pairwise distances
inside.owin

Test Whether Points Are Inside A Window
quantile.im

Sample Quantiles of Pixel Image
eem

Exponential Energy Marks
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
rmhmodel.default

Build Point Process Model for Metropolis-Hastings Simulation.
mincontrast

Method of Minimum Contrast
is.multitype.ppm

Test Whether A Point Process Model is Multitype
pairsat.family

Saturated Pairwise Interaction Point Process Family
stieltjes

Compute Integral of Function Against Cumulative Distribution
rescale.im

Convert Pixel Image to Another Unit of Length
plot.tess

Plot a tessellation
japanesepines

Japanese Pines Point Pattern
is.marked.ppm

Test Whether A Point Process Model is Marked
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
pairdist

Pairwise distances
markcorr

Mark Correlation Function
erosion

Morphological Erosion
Hest

Spherical Contact Distribution Function
ponderosa

Ponderosa Pine Tree Point Pattern
summary.listof

Summary of a List of Things
eroded.areas

Areas of Morphological Erosions
qqplot.ppm

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

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

Chi-Squared Test of CSR for Split Point Pattern
pairdist.psp

Pairwise distances between line segments
bermantest

Berman's Tests for Point Process Model
update.kppm

Update a Fitted Cluster Point Process Model
plot.fv

Plot Function Values
vertices

Vertices of a Window
logLik.ppm

Log Likelihood for Poisson Point Process Model
crossdist.psp

Pairwise distances between two different line segment patterns
plot.listof

Plot a List of Things
rescale.ppp

Convert Point Pattern to Another Unit of Length
as.psp

Convert Data To Class psp
deltametric

Delta Metric
lurking

Lurking variable plot
quadratcount

Quadrat counting for a point pattern
spatstat-deprecated

Deprecated spatstat functions
im.object

Class of Images
rotate

Rotate
distmap

Distance Map
rlabel

Random Re-Labelling of Point Pattern
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
by.ppp

Apply a Function to a Point Pattern Broken Down by Factor
rescue.rectangle

Convert Window Back To Rectangle
pairdist.ppp

Pairwise distances
istat

Point and Click Interface for Exploratory Analysis of Point Pattern
is.marked

Test Whether Marks Are Present
plot.im

Plot a Pixel Image
envelope

Simulation envelopes of summary function
rmhmodel

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

The Spatstat Package
eval.hyper

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

Residuals for Fitted Point Process Model
profilepl

Profile Maximum Pseudolikelihood
copper

Berman-Huntington points and lines data
rthin

Random Thinning
expand.owin

Expand Window By Factor
shift.ppp

Apply Vector Translation To Point Pattern
rotate.owin

Rotate a Window
is.ppp

Test Whether An Object Is A Point Pattern
gridweights

Compute Quadrature Weights Based on Grid Counts
discretise

Safely Convert Point Pattern Window to Binary Mask
rpoispp

Generate Poisson Point Pattern
quadscheme

Generate a Quadrature Scheme from a Point Pattern
contour.im

Contour plot of pixel image
shift.psp

Apply Vector Translation To Line Segment Pattern
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
ppp

Create a Point Pattern
is.owin

Test Whether An Object Is A Window
rstrat

Simulate Stratified Random Point Pattern
unmark

Remove Marks
simulate.ppm

Simulate a Fitted Gibbs Point Process Model
tess

Create a Tessellation
rStrauss

Perfect Simulation of the Strauss Process
localK

Neighbourhood density function
pointsOnLines

Place Points Evenly Along Specified Lines
lengths.psp

Lengths of Line Segments
nbfires

Point Patterns of New Brunswick Forest Fires
union.quad

Union of Data and Dummy Points
unique.ppp

Extract Unique Points from a Spatial Point Pattern
levelset

Level Set of a Pixel Image
model.matrix.ppm

Extract Design Matrix from Point Process Model
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
fitted.ppm

Fitted Conditional Intensity for Point Process Model
nearest.raster.point

Find Pixel Nearest to a Given Point
tiles

Extract List of Tiles in a Tessellation
lut

Lookup Tables
opening

Morphological Opening
scanpp

Read Point Pattern From Data File
rsyst

Simulate systematic random point pattern
ppp.object

Class of Point Patterns
pcf

Pair Correlation Function
print.quad

Print a Quadrature Scheme
plot.kppm

Plot a fitted cluster point process
plot.quad

plot a Spatial Quadrature Scheme
perimeter

Perimeter Length of Window
pcf.fv

Pair Correlation Function obtained from K Function
plot.fasp

Plot a Function Array
summary.ppp

Summary of a Point Pattern Dataset
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
rmhmodel.list

Define Point Process Model for Metropolis-Hastings Simulation.
summary.im

Summarizing a Pixel Image
rmh.default

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

Print Progress Reports
print.ppp

Print Brief Details of a Point Pattern Dataset
miplot

Morishita Index Plot
rThomas

Simulate Thomas Process
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
solutionset

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

Create a Line Segment Pattern
Gcross

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

Convert Polygonal Region into Different Format
Jest

Estimate the J-function
rshift.splitppp

Randomly Shift a List of Point Patterns
rpoislinetess

Poisson Line Tessellation
runifdisc

Generate N Uniform Random Points in a Disc
setcov

Set Covariance of a Window
eval.im

Evaluate Expression Involving Pixel Images
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
print.owin

Print Brief Details of a Spatial Window
spokes

Spokes pattern of dummy points
is.ppm

Test Whether An Object Is A Fitted Point Process Model
reach

Interaction Distance of a Point Process
superimposePSP

Superimpose Several Line Segment Patterns
nearestsegment

Find Line Segment Nearest to Each Point
fv.object

Data Frames of Function Values
reduced.sample

Reduced Sample Estimator using Histogram Data
kstest.ppm

Kolmogorov-Smirnov Test for Point Process Model
pcf.fasp

Pair Correlation Function obtained from array of K functions
nnwhich

Nearest neighbour
compatible.fasp

Test Whether Two Function Arrays Are Compatible
pcfcross

Multitype pair correlation function
harmonic

Basis for Harmonic Functions
plot.psp

plot a Spatial Line Segment Pattern
im

Create a Pixel Image Object
plot.kstest

Plot a Spatial Kolmogorov-Smirnov Test
rjitter

Random Perturbation of a Point Pattern
pppdist

Distance Between Two Point Patterns
ripras

Estimate window from points alone
spruces

Spruces Point Pattern
is.im

Test Whether An Object Is A Pixel Image
rpoisppOnLines

Generate Poisson Point Pattern on Line Segments
closing

Morphological Closing
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
split.ppp

Divide Point Pattern into Sub-patterns
rshift

Random Shift
ppm.object

Class of Fitted Point Process Models
fitin.ppm

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

Rotate a Line Segment Pattern
update.ppm

Update a Fitted Point Process Model
urkiola

Urkiola Woods Point Pattern
demopat

Artificial Data Point Pattern
rpoisline

Generate Poisson Random Line Process
is.marked.ppp

Test Whether A Point Pattern is Marked
plot.splitppp

Plot a List of Point Patterns
plot.ppm

plot a Fitted Point Process Model
swedishpines

Swedish Pines Point Pattern
unitname

Name for Unit of Length
print.psp

Print Brief Details of a Line Segment Pattern Dataset
shift.im

Apply Vector Translation To Pixel Image
shift

Apply Vector Translation
suffstat

Sufficient Statistic of Point Process Model
rMatClust

Simulate Matern Cluster Process
runifpoint

Generate N Uniform Random Points
selfcrossing.psp

Crossing Points in a Line Segment Pattern
simplify.owin

Approximate a Polygon by a Simpler Polygon
rmpoispp

Generate Multitype Poisson Point Pattern
summary.quad

Summarizing a Quadrature Scheme
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
rSSI

Simulate Simple Sequential Inhibition
simdat

Simulated Point Pattern
clip.infline

Intersect Infinite Straight Lines with a Window
midpoints.psp

Midpoints of Line Segment Pattern
colourmap

Colour Lookup Tables
quadratresample

Resample a Point Pattern by Resampling Quadrats
smooth.ppp

Spatial smoothing of observations at irregular points
summary.psp

Summary of a Line Segment Pattern Dataset
with.fv

Evaluate an Expression in a Function Table
spatstat.options

Internal Options in Spatstat Package
simulate.kppm

Simulate a Fitted Cluster Point Process Model
pairdist.default

Pairwise distances
rescale

Convert dataset to another unit of length
redwood

California Redwoods Point Pattern (Ripley's Subset)
rescale.owin

Convert Window to Another Unit of Length
raster.x

Cartesian Coordinates for a Pixel Raster
rmh.ppm

Simulate from a Fitted Point Process Model
trim.rectangle

Cut margins from rectangle
rshift.ppp

Randomly Shift a Point Pattern
rpoint

Generate N Random Points
ppm

Fit Point Process Model to Data
rmpoint

Generate N Random Multitype Points
shift.owin

Apply Vector Translation To Window
Geyer

Geyer's Saturation Point Process Model
allstats

Calculate four standard summary functions of a point pattern.
clickpoly

Interactively Define a Polygon
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
compatible.fv

Test Whether Two Function Objects Are Compatible
interp.im

Interpolate a Pixel Image
hyperframe

Hyper Data Frame
nztrees

New Zealand Trees Point Pattern
multiplicity.ppp

Count Multiplicity of Duplicate Points
pixelquad

Quadrature Scheme Based on Pixel Grid
plot.plotppm

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

Class of Quadrature Schemes
rcell

Simulate Baddeley-Silverman Cell Process
quadrats

Divide Region into Quadrats
rMaternI

Simulate Matern Model I
predict.kppm

Prediction from a Fitted Cluster Point Process Model
rMaternII

Simulate Matern Model II
runifpointOnLines

Generate N Uniform Random Points On Line Segments
rshift.psp

Randomly Shift a Line Segment Pattern
shapley

Galaxies in the Shapley Supercluster
superimpose

Superimpose Several Point Patterns