Learn R Programming

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

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

Version

1.16-1

License

GPL (>= 2)

Maintainer

Last Published

July 27th, 2009

Functions in spatstat (1.16-1)

Extract.tess

Extract or Replace Subset of Tessellation
Jest

Estimate the J-function
Ldot

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

Diagnostics for random marking
DiggleGratton

Diggle-Gratton model
Extract.im

Extract Subset of Image
Extract.fasp

Extract Subset of Function Array
Gmulti

Marked Nearest Neighbour Distance Function
Fest

Estimate the empty space function F
Kcross.inhom

Inhomogeneous Cross K Function
affine.owin

Apply Affine Transformation To Window
adaptive.density

Intensity Estimate of Point Pattern Using Tessellation
OrdThresh

Ord's Interaction model
anova.ppm

ANOVA for Fitted Point Process Models
Extract.listof

Extract or Replace Subset of a List of Things
Kmulti

Marked K-Function
spatstat

The Spatstat Package
Kdot.inhom

Inhomogeneous Multitype K Dot Function
area.owin

Area of a Window
alltypes

Calculate Summary Statistic for All Types in a Multitype Point Pattern
clip.infline

Intersect Infinite Straight Lines with a Window
anemones

Beadlet Anemones Data
AreaInter

The Area Interaction Point Process Model
Jmulti

Marked J Function
affine

Apply Affine Transformation
Extract.ppp

Extract or Replace Subset of Point Pattern
as.ppp

Convert Data To Class ppp
bdist.points

Distance to Boundary of Window
Kinhom

Inhomogeneous K-function
allstats

Calculate four standard summary functions of a point pattern.
complement.owin

Take Complement of a Window
Ldot.inhom

Inhomogeneous Multitype L Dot Function
Kdot

Multitype K Function (i-to-any)
as.im

Convert to Pixel Image
Linhom

L-function
Lcross.inhom

Inhomogeneous Cross Type L Function
Lest

L-function
delaunay

Delaunay Triangulation of Point Pattern
amacrine

Hughes' Amacrine Cell Data
corners

Corners of a rectangle
angles.psp

Orientation Angles of Line Segments
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
connected

Connected components of an image or window
betacells

Beta Ganglion Cells in Cat Retina
BadGey

Hybrid Geyer Point Process Model
Kmeasure

Reduced Second Moment Measure
clickppp

Interactively Add Points
blur

Apply Gaussian Blur to a Pixel Image
Extract.quad

Subset of Quadrature Scheme
Kest.fft

K-function using FFT
as.owin

Convert Data To Class owin
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
cut.im

Convert Pixel Image from Numeric to Factor
convexhull

Convex Hull
Kcross

Multitype K Function (Cross-type)
Extract.fv

Extract Subset of Function Values
Kest

K-function
finpines

Pine saplings in Finland.
Replace.im

Reset Values in Subset of Image
bei

Tropical rain forest trees
concatxy

Concatenate x,y Coordinate Vectors
erosion

Morphological Erosion
Softcore

The Soft Core Point Process Model
compatible.im

Test Whether Two Pixel Images Are Compatible
Hest

Spherical Contact Distribution Function
Iest

Estimate the I-function
effectfun

Compute Fitted Effect of a Spatial Covariate in a Point Process Model
crossdist.ppp

Pairwise distances between two different point patterns
LennardJones

The Lennard-Jones Potential
crossdist.psp

Pairwise distances between two different line segment patterns
as.rectangle

Window Frame
crossing.psp

Crossing Points of Two Line Segment Patterns
Ord

Generic Ord Interaction model
Geyer

Geyer's Saturation Point Process Model
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
is.convex

Test Whether a Window is Convex
crossdist

Pairwise distances
StraussHard

The Strauss / Hard Core Point Process Model
as.tess

Convert Data To Tessellation
areadiff

Difference of Disc Areas
Extract.psp

Extract Subset of Line Segment Pattern
diameter

Diameter of a Window
distmap.psp

Distance Map of Line Segment Pattern
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
Gest

Nearest Neighbour Distance Function G
as.psp

Convert Data To Class psp
ants

Harkness-Isham ants' nests data
eval.im

Evaluate Expression Involving Pixel Images
Extract.splitppp

Extract or Replace Sub-Patterns
by.im

Apply Function to Image Broken Down by Factor
affine.ppp

Apply Affine Transformation To Point Pattern
discretise

Safely Convert Point Pattern Window to Binary Mask
append.psp

Combine Two Line Segment Patterns
bermantest

Berman's Tests for Point Process Model
Pairwise

Generic Pairwise Interaction model
crossdist.default

Pairwise distances between two different sets of points
Strauss

The Strauss Point Process Model
clarkevans

Clark and Evans Aggregation Index
is.marked

Test Whether Marks Are Present
harmonic

Basis for Harmonic Functions
compatible.fasp

Test Whether Two Function Arrays Are Compatible
owin

Create a Window
bramblecanes

Hutchings' Bramble Canes data
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
Poisson

Poisson Point Process Model
bounding.box

Bounding Box of a Window or Point Pattern
clickpoly

Interactively Define a Polygon
MultiStrauss

The Multitype Strauss Point Process Model
bdist.pixels

Distance to Boundary of Window
Gcross

Multitype Nearest Neighbour Distance Function (i-to-j)
convexhull.xy

Convex Hull of Points
bounding.box.xy

Convex Hull of Points
markvario

Mark Variogram
gpc2owin

Convert Polygonal Region into Different Format
pcf.fv

Pair Correlation Function obtained from K Function
eval.fv

Evaluate Expression Involving Functions
closing

Morphological Closing
as.data.frame.ppp

Coerce Point Pattern to a Data Frame
dilation

Morphological Dilation
eem

Exponential Energy Marks
as.matrix.im

Convert Pixel Image to Matrix
residuals.ppm

Residuals for Fitted Point Process Model
fv.object

Data Frames of Function Values
hamster

Aherne's hamster tumour data
density.psp

Kernel Smoothing of Line Segment Pattern
is.owin

Test Whether An Object Is A Window
eval.fasp

Evaluate Expression Involving Function Arrays
levelset

Level Set of a Pixel Image
interp.im

Interpolate a Pixel Image
kstest.ppm

Kolmogorov-Smirnov Test for Point Process Model
rescale.ppp

Convert Point Pattern to Another Unit of Length
spatstat-deprecated

Deprecated spatstat functions
copper

Berman-Huntington points and lines data
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
fitted.ppm

Fitted Conditional Intensity for Point Process Model
plot.owin

Plot a Spatial Window
print.owin

Print Brief Details of a Spatial Window
cut.ppp

Classify Points in a Point Pattern
endpoints.psp

Endpoints of Line Segment Pattern
pairdist.ppp

Pairwise distances
im.object

Class of Images
is.ppp

Test Whether An Object Is A Point Pattern
ppp.object

Class of Point Patterns
inside.owin

Test Whether Points Are Inside A Window
intersect.owin

Intersection or Union of Two Windows
spatstat-internal

Internal spatstat functions
nndist.psp

Nearest neighbour distances between line segments
print.psp

Print Brief Details of a Line Segment Pattern Dataset
by.ppp

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

Distance Between Two Point Patterns
inforder.family

Infinite Order Interaction Family
cells

Biological Cells Point Pattern
plot.kstest

Plot a Spatial Kolmogorov-Smirnov Test
demopat

Artificial Data Point Pattern
pcf

Pair Correlation Function
distmap

Distance Map
as.mask

Pixel Image Approximation of a Window
Saturated

Saturated Pairwise Interaction model
plot.im

Plot a Pixel Image
chorley

Chorley-Ribble Cancer Data
as.polygonal

Convert a Window to a Polygonal Window
is.subset.owin

Determine Whether One Window is Contained In Another
predict.kppm

Prediction from a Fitted Cluster Point Process Model
lengths.psp

Lengths of Line Segments
SatPiece

Piecewise Constant Saturated Pairwise Interaction Point Process Model
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
incircle

Find Largest Circle Inside Window
quadrat.test

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

Centroid of a window
ppm

Fit Point Process Model to Data
fasp.object

Function Arrays for Spatial Patterns
pairsat.family

Saturated Pairwise Interaction Point Process Family
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
mean.im

Mean, Median and Range of Pixel Values in an Image
eroded.areas

Areas of Morphological Erosions
heather

Diggle's Heather Data
ewcdf

Weighted Empirical Cumulative Distribution Function
markstat

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

Kernel Smoothed Intensity of Point Pattern
is.multitype

Test whether Object is Multitype
expand.owin

Expand Window By Factor
gridweights

Compute Quadrature Weights Based on Grid Counts
as.data.frame.psp

Coerce Line Segment Pattern to a Data Frame
lgcp.estK

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

Create a Point Pattern
nearest.raster.point

Find Pixel Nearest to a Given Point
hyperframe

Hyper Data Frame
hist.im

Histogram of Pixel Values in an Image
dirichlet

Dirichlet Tessellation of Point Pattern
plot.fasp

Plot a Function Array
gridcentres

Rectangular grid of points
pairdist

Pairwise distances
plot.plotppm

Plot a plotppm Object Created by plot.ppm
is.multitype.ppp

Test Whether A Point Pattern is Multitype
japanesepines

Japanese Pines Point Pattern
ponderosa

Ponderosa Pine Tree Point Pattern
miplot

Morishita Index Plot
colourmap

Colour Lookup Tables
murchison

Murchison gold deposits
is.empty

Test Whether An Object Is Empty
identify.ppp

Identify Points in a Point Pattern
pppmatching

Create a Point Matching
kppm

Fit cluster point process model
rlinegrid

Generate grid of parallel lines with random displacement
rGaussPoisson

Simulate Gauss-Poisson Process
plot.ppm

plot a Fitted Point Process Model
rlabel

Random Re-Labelling of Point Pattern
rMosaicField

Mosaic Random Field
humberside

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

Test Whether A Point Process Model is Multitype
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
nztrees

New Zealand Trees Point Pattern
plot.listof

Plot a List of Things
print.im

Print Brief Details of an Image
longleaf

Longleaf Pines Point Pattern
plot.quad

plot a Spatial Quadrature Scheme
quadratcount

Quadrat counting for a point pattern
istat

Point and Click Interface for Exploratory Analysis of Point Pattern
rpoisline

Generate Poisson Random Line Process
intersect.tess

Intersection of Two Tessellations
markcorr

Mark Correlation Function
rNeymanScott

Simulate Neyman-Scott Process
marktable

Tabulate Marks in Neighbourhood of Every Point in a Point Pattern
rshift.psp

Randomly Shift a Line Segment Pattern
qqplot.ppm

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

Place Points Evenly Along Specified Lines
rThomas

Simulate Thomas Process
print.ppp

Print Brief Details of a Point Pattern Dataset
rmpoispp

Generate Multitype Poisson Point Pattern
simulate.kppm

Simulate a Fitted Cluster Point Process Model
rotate

Rotate
rMaternI

Simulate Matern Model I
pppmatching.object

Class of Point Matchings
fryplot

Fry Plot of Point Pattern
opening

Morphological Opening
rpoispp

Generate Poisson Point Pattern
nnwhich

Nearest neighbour
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
pixellate

Convert Point Pattern to Pixel Image
nncorr

Nearest-Neighbour Correlation Indices of Marked Point Pattern
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
rthin

Random Thinning
rotate.owin

Rotate a Window
iplot

Point and Click Interface for Displaying a Point Pattern
is.marked.ppm

Test Whether A Point Process Model is Marked
nbfires

Point Patterns of New Brunswick Forest Fires
rjitter

Random Perturbation of a Point Pattern
rMosaicSet

Mosaic Random Set
print.quad

Print a Quadrature Scheme
runifdisc

Generate N Uniform Random Points in a Disc
rotate.ppp

Rotate a Point Pattern
quantile.im

Sample Quantiles of Pixel Image
reduced.sample

Reduced Sample Estimator using Histogram Data
disc

Circular Window
quadscheme

Generate a Quadrature Scheme from a Point Pattern
setmarks

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

Randomly Shift a Point Pattern
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
rmh.ppm

Simulate from a Fitted Point Process Model
plot.hyperframe

Plot Entries in a Hyperframe
pairdist.default

Pairwise distances
ord.family

Ord Interaction Process Family
suffstat

Sufficient Statistic of Point Process Model
predict.ppm

Prediction from a Fitted Point Process Model
rescale.im

Convert Pixel Image to Another Unit of Length
psp

Create a Line Segment Pattern
fitin.ppm

Extract the Interaction from a Fitted Point Process Model
infline

Infinite Straight Lines
rescue.rectangle

Convert Window Back To Rectangle
letterR

Window in Shape of Letter R
pairdist.psp

Pairwise distances between line segments
plot.tess

Plot a tessellation
rMaternII

Simulate Matern Model II
summary.splitppp

Summary of a Split Point Pattern
shift.owin

Apply Vector Translation To Window
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
print.ppm

Print a Fitted Point Process Model
plot.ppp

plot a Spatial Point Pattern
lurking

Lurking variable plot
psp.object

Class of Line Segment Patterns
compatible.fv

Test Whether Two Function Objects Are Compatible
owin.object

Class owin
persp.im

Perspective Plot of Pixel Image
rSSI

Simulate Simple Sequential Inhibition
plot.kppm

Plot a fitted cluster point process
quadratresample

Resample a Point Pattern by Resampling Quadrats
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
plot.splitppp

Plot a List of Point Patterns
nearestsegment

Find Line Segment Nearest to Each Point
multiplicity.ppp

Count Multiplicity of Duplicate Points
rescale.owin

Convert Window to Another Unit of Length
localK

Neighbourhood density function
rmhmodel.ppm

Interpret Fitted Model for Metropolis-Hastings Simulation.
is.im

Test Whether An Object Is A Pixel Image
quadrats

Divide Region into Quadrats
quadrat.test.splitppp

Chi-Squared Test of CSR for Split Point Pattern
smooth.ppp

Spatial smoothing of observations at irregular points
summary.im

Summarizing a Pixel Image
model.images

Compute Images of Constructed Covariates
pcfcross

Multitype pair correlation function
rshift

Random Shift
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
update.kppm

Update a Fitted Cluster Point Process Model
quad.object

Class of Quadrature Schemes
update.ppm

Update a Fitted Point Process Model
logLik.ppm

Log Likelihood for Poisson Point Process Model
square

Square Window
envelope

Simulation envelopes of summary function
nndist

Nearest neighbour distances
split.im

Divide Image Into Sub-images
markcorrint

Mark Correlation Integral
selfcrossing.psp

Crossing Points in a Line Segment Pattern
pcf.ppp

Pair Correlation Function of Point Pattern
rmh.default

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

Class of Fitted Point Process Models
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
midpoints.psp

Midpoints of Line Segment Pattern
setcov

Set Covariance of a Window
progressreport

Print Progress Reports
simdat

Simulated Point Pattern
rotate.psp

Rotate a Line Segment Pattern
rshift.splitppp

Randomly Shift a List of Point Patterns
shapley

Galaxies in the Shapley Supercluster
unique.ppp

Extract Unique Points from a Spatial Point Pattern
rmpoint

Generate N Random Multitype Points
quad.ppm

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

Approximate a Polygon by a Simpler Polygon
shift.im

Apply Vector Translation To Pixel Image
rpoislinetess

Poisson Line Tessellation
runifpointOnLines

Generate N Uniform Random Points On Line Segments
summary.ppm

Summarizing a Fitted Point Process Model
rstrat

Simulate Stratified Random Point Pattern
mincontrast

Method of Minimum Contrast
project2segment

Move Point To Nearest Line
unmark

Remove Marks
markconnect

Mark Connection Function
plot.psp

plot a Spatial Line Segment Pattern
split.ppp

Divide Point Pattern into Sub-patterns
rStrauss

Perfect Simulation of the Strauss Process
tess

Create a Tessellation
pairwise.family

Pairwise Interaction Process Family
runifpoint

Generate N Uniform Random Points
reach

Interaction Distance of a Point Process
shift

Apply Vector Translation
ripras

Estimate window from points alone
perimeter

Perimeter Length of Window
vertices

Vertices of a Window
rpoint

Generate N Random Points
spokes

Spokes pattern of dummy points
superimpose

Superimpose Several Point Patterns
rpoisppOnLines

Generate Poisson Point Pattern on Line Segments
unitname

Name for Unit of Length
shift.ppp

Apply Vector Translation To Point Pattern
rsyst

Simulate systematic random point pattern
summary.psp

Summary of a Line Segment Pattern Dataset
pixelquad

Quadrature Scheme Based on Pixel Grid
urkiola

Urkiola Woods Point Pattern
is.marked.ppp

Test Whether A Point Pattern is Marked
stieltjes

Compute Integral of Function Against Cumulative Distribution
rescale

Convert dataset to another unit of length
summary.ppp

Summary of a Point Pattern Dataset
plot.fv

Plot Function Values
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
tiles

Extract List of Tiles in a Tessellation
profilepl

Profile Maximum Pseudolikelihood
rmhmodel.list

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

Summary of a List of Things
scanpp

Read Point Pattern From Data File
summary.quad

Summarizing a Quadrature Scheme
redwood

California Redwoods Point Pattern (Ripley's Subset)
raster.x

Cartesian Coordinates for a Pixel Raster
swedishpines

Swedish Pines Point Pattern
shift.psp

Apply Vector Translation To Line Segment Pattern
spruces

Spruces Point Pattern
trim.rectangle

Cut margins from rectangle
solutionset

Evaluate Logical Expression Involving Pixel Images and Return Region Where Expression is True
union.quad

Union of Data and Dummy Points
superimposePSP

Superimpose Several Line Segment Patterns
Jdot

Multitype J Function (i-to-any)
Gdot

Multitype Nearest Neighbour Distance Function (i-to-any)
coef.ppm

Coefficients of Fitted Point Process Model
affine.psp

Apply Affine Transformation To Line Segment Pattern
default.dummy

Generate a Default Pattern of Dummy Points
distmap.ppp

Distance Map of Point Pattern
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
lansing

Lansing Woods Point Pattern
lut

Lookup Tables
matchingdist

Distance for a Point Pattern Matching
model.matrix.ppm

Extract Design Matrix from Point Process Model
summary.owin

Summary of a Spatial Window
nncross

Nearest Neighbours Between Two Patterns
simulate.ppm

Simulate a Fitted Gibbs Point Process Model
Jcross

Multitype J Function (i-to-j)
Lcross

Multitype L-function (cross-type)
chop.tess

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

Extract Original Data from a Fitted Point Process Model
contour.im

Contour plot of pixel image
distmap.owin

Distance Map of Window
eval.hyper

Evaluate an Expression in Each Row of a Hyperframe
im

Create a Pixel Image Object
plot.colourmap

Plot a Colour Map
is.ppm

Test Whether An Object Is A Fitted Point Process Model
pcf.fasp

Pair Correlation Function obtained from array of K functions
rcell

Simulate Baddeley-Silverman Cell Process
rMatClust

Simulate Matern Cluster Process
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
rmhmodel.default

Build Point Process Model for Metropolis-Hastings Simulation.
with.fv

Evaluate an Expression in a Function Table
spatstat.options

Internal Options in Spatstat Package