Learn R Programming

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

spatstat (version 1.15-4)

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,015

Version

1.15-4

License

GPL (>= 2)

Maintainer

Adrian Baddeley

Last Published

June 16th, 2009

Functions in spatstat (1.15-4)

Gest

Nearest Neighbour Distance Function G
as.data.frame.ppp

Coerce Point Pattern to a Data Frame
is.multitype.ppm

Test Whether A Point Process Model is Multitype
is.subset.owin

Determine Whether One Window is Contained In Another
Kdot

Multitype K Function (i-to-any)
lurking

Lurking variable plot
allstats

Calculate four standard summary functions of a point pattern.
Saturated

Saturated Pairwise Interaction model
Fest

Estimate the empty space function F
as.im

Convert to Pixel Image
LennardJones

The Lennard-Jones Potential
Poisson

Poisson Point Process Model
Jcross

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

Extract Subset of Line Segment Pattern
Kest

K-function
bdist.pixels

Distance to Boundary of Window
Extract.quad

Subset of Quadrature Scheme
append.psp

Combine Two Line Segment Patterns
distmap

Distance Map
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
Extract.fv

Extract Subset of Function Values
copper

Berman-Huntington points and lines data
corners

Corners of a rectangle
model.images

Compute Images of Constructed Covariates
lut

Lookup Tables
Lest

L-function
Gdot

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

Window Frame
as.owin

Convert Data To Class owin
Kinhom

Inhomogeneous K-function
Jdot

Multitype J Function (i-to-any)
Emark

Diagnostics for random marking
plot.ppp

plot a Spatial Point Pattern
dirichlet

Dirichlet Tessellation of Point Pattern
spatstat-deprecated

Deprecated spatstat functions
Extract.ppp

Extract or Replace Subset of Point Pattern
Extract.im

Extract Subset of Image
Extract.tess

Extract or Replace Subset of Tessellation
crossdist

Pairwise distances
as.psp

Convert Data To Class psp
compatible.im

Test Whether Two Pixel Images Are Compatible
is.marked.ppp

Test Whether A Point Pattern is Marked
ants

Harkness-Isham ants' nests data
crossdist.default

Pairwise distances between two different sets of points
fitin.ppm

Extract the Interaction from a Fitted Point Process Model
identify.ppp

Identify Points in a Point Pattern
is.im

Test Whether An Object Is A Pixel Image
OrdThresh

Ord's Interaction model
markcorrint

Mark Correlation Integral
density.ppp

Kernel Smoothed Intensity of Point Pattern
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
adaptive.density

Intensity Estimate of Point Pattern Using Tessellation
eem

Exponential Energy Marks
rescale.im

Convert Pixel Image to Another Unit of Length
rescale.owin

Convert Window to Another Unit of Length
diameter

Diameter of a Window
as.ppp

Convert Data To Class ppp
bounding.box.xy

Convex Hull of Points
contour.im

Contour plot of pixel image
Jest

Estimate the J-function
Strauss

The Strauss Point Process Model
plot.psp

plot a Spatial Line Segment Pattern
colourmap

Colour Lookup Tables
logLik.ppm

Log Likelihood for Poisson Point Process Model
Replace.im

Reset Values in Subset of Image
cells

Biological Cells Point Pattern
hamster

Aherne's hamster tumour data
Extract.fasp

Extract Subset of Function Array
Hest

Spherical Contact Distribution Function
ponderosa

Ponderosa Pine Tree Point Pattern
rescue.rectangle

Convert Window Back To Rectangle
mincontrast

Method of Minimum Contrast
default.dummy

Generate a Default Pattern of Dummy Points
inside.owin

Test Whether Points Are Inside A Window
print.ppp

Print Brief Details of a Point Pattern Dataset
opening.owin

Morphological Opening of a Window
pcf

Pair Correlation Function
nncross

Nearest Neighbours Between Two Patterns
anova.ppm

ANOVA for Fitted Point Process Models
plot.im

Plot a Pixel Image
endpoints.psp

Endpoints of Line Segment Pattern
project2segment

Move Point To Nearest Line
rpoisline

Generate Poisson Random Line Process
affine.psp

Apply Affine Transformation To Line Segment Pattern
plot.quad

plot a Spatial Quadrature Scheme
nndist.psp

Nearest neighbour distances between line segments
is.marked.ppm

Test Whether A Point Process Model is Marked
betacells

Beta Ganglion Cells in Cat Retina
midpoints.psp

Midpoints of Line Segment Pattern
SatPiece

Piecewise Constant Saturated Pairwise Interaction Point Process Model
alltypes

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

Convert Point Pattern to Pixel Image
cut.im

Convert Pixel Image from Numeric to Factor
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
rStrauss

Perfect Simulation of the Strauss Process
rmpoispp

Generate Multitype Poisson Point Pattern
Kcross

Multitype K Function (Cross-type)
area.owin

Area of a Window
pairdist.ppp

Pairwise distances
pairdist

Pairwise distances
simplify.owin

Approximate a Polygon by a Simpler Polygon
plot.owin

Plot a Spatial Window
rmhmodel.list

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

Print Brief Details of an Image
simdat

Simulated Point Pattern
eval.im

Evaluate Expression Involving Pixel Images
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
erode.owin

Erode a Window
rMatClust

Simulate Matern Cluster Process
is.multitype.ppp

Test Whether A Point Pattern is Multitype
concatxy

Concatenate x,y Coordinate Vectors
as.matrix.im

Convert Pixel Image to Matrix
centroid.owin

Centroid of a window
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
kstest.ppm

Kolmogorov-Smirnov Test for Point Process Model
pairwise.family

Pairwise Interaction Process Family
nearestsegment

Find Line Segment Nearest to Each Point
residuals.ppm

Residuals for Fitted Point Process Model
unique.ppp

Extract Unique Points from a Spatial Point Pattern
rMaternII

Simulate Matern Model II
bdist.points

Distance to Boundary of Window
summary.quad

Summarizing a Quadrature Scheme
AreaInter

The Area Interaction Point Process Model
rMaternI

Simulate Matern Model I
rsyst

Simulate systematic random point pattern
raster.x

Cartesian Coordinates for a Pixel Raster
Extract.splitppp

Extract or Replace Sub-Patterns
inforder.family

Infinite Order Interaction Family
rotate

Rotate
chorley

Chorley-Ribble Cancer Data
angles.psp

Orientation Angles of Line Segments
unitname

Name for Unit of Length
coef.ppm

Coefficients of Fitted Point Process Model
bounding.box

Bounding Box of a Window or Point Pattern
affine.owin

Apply Affine Transformation To Window
Kdot.inhom

Inhomogeneous Multitype K Dot Function
ppp.object

Class of Point Patterns
hist.im

Histogram of Pixel Values in an Image
rotate.ppp

Rotate a Point Pattern
rMosaicSet

Mosaic Random Set
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
by.ppp

Apply a Function to a Point Pattern Broken Down by Factor
pairdist.psp

Pairwise distances between line segments
data.ppm

Extract Original Data from a Fitted Point Process Model
reduced.sample

Reduced Sample Estimator using Histogram Data
closing.owin

Morphological Closing of a Window
anemones

Beadlet Anemones Data
eval.fv

Evaluate Expression Involving Functions
quadratresample

Resample a Point Pattern by Resampling Quadrats
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
BadGey

Hybrid Geyer Point Process Model
intersect.owin

Intersection or Union of Two Windows
nbfires

Point Patterns of New Brunswick Forest Fires
rescale

Convert dataset to another unit of length
pcf.fv

Pair Correlation Function obtained from K Function
rMosaicField

Mosaic Random Field
complement.owin

Take Complement of a Window
crossing.psp

Crossing Points of Two Line Segment Patterns
clickpoly

Interactively Define a Polygon
Jmulti

Marked J Function
is.marked

Test Whether Marks Are Present
distmap.owin

Distance Map of Window
shift.ppp

Apply Vector Translation To Point Pattern
hyperframe

Hyper Data Frame
with.fv

Evaluate an Expression in a Function Table
levelset

Level Set of a Pixel Image
rstrat

Simulate Stratified Random Point Pattern
rmh.default

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

plot a Fitted Point Process Model
rescale.ppp

Convert Point Pattern to Another Unit of Length
Gmulti

Marked Nearest Neighbour Distance Function
distmap.ppp

Distance Map of Point Pattern
Kmulti

Marked K-Function
nncorr

Nearest-Neighbour Correlation Indices of Marked Point Pattern
split.im

Divide Image Into Sub-images
rotate.psp

Rotate a Line Segment Pattern
rotate.owin

Rotate a Window
clip.infline

Intersect Infinite Straight Lines with a Window
summary.listof

Summary of a List of Things
Kmeasure

Reduced Second Moment Measure
pppmatching

Create a Point Matching
mean.im

Mean, Median and Range of Pixel Values in an Image
crossdist.psp

Pairwise distances between two different line segment patterns
quadrat.test.splitppp

Chi-Squared Test of CSR for Split Point Pattern
nztrees

New Zealand Trees Point Pattern
affine

Apply Affine Transformation
rmh.ppm

Simulate from a Fitted Point Process Model
Ldot

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

Diggle's Heather Data
smooth.ppp

Spatial smoothing of observations at irregular points
square

Square Window
bei

Tropical rain forest trees
Gcross

Multitype Nearest Neighbour Distance Function (i-to-j)
is.ppp

Test Whether An Object Is A Point Pattern
bramblecanes

Hutchings' Bramble Canes data
japanesepines

Japanese Pines Point Pattern
finpines

Pine saplings in Finland.
im.object

Class of Images
trim.rectangle

Cut margins from rectangle
blur

Apply Gaussian Blur to a Pixel Image
print.psp

Print Brief Details of a Line Segment Pattern Dataset
Ord

Generic Ord Interaction model
Kcross.inhom

Inhomogeneous Cross K Function
areadiff

Difference of Disc Areas
eroded.areas

Areas of Morphological Erosions
is.ppm

Test Whether An Object Is A Fitted Point Process Model
Lcross

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

Intersection of Two Tessellations
rshift.splitppp

Randomly Shift a List of Point Patterns
is.multitype

Test whether Object is Multitype
tiles

Extract List of Tiles in a Tessellation
predict.kppm

Prediction from a Fitted Cluster Point Process Model
density.psp

Kernel Smoothing of Line Segment Pattern
Softcore

The Soft Core Point Process Model
demopat

Artificial Data Point Pattern
plot.colourmap

Plot a Colour Map
plot.listof

Plot a List of Things
plot.fasp

Plot a Function Array
compatible.fv

Test Whether Two Function Objects Are Compatible
cut.ppp

Classify Points in a Point Pattern
spatstat.options

Internal Options in Spatstat Package
simulate.kppm

Simulate a fitted cluster point process model.
expand.owin

Expand Window By Factor
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
shift

Apply Vector Translation
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
print.quad

Print a Quadrature Scheme
Kest.fft

K-function using FFT
profilepl

Profile Maximum Pseudolikelihood
spatstat

The Spatstat Package
runifdisc

Generate N Uniform Random Points in a Disc
lansing

Lansing Woods Point Pattern
rpoispp

Generate Poisson Point Pattern
delaunay

Delaunay Triangulation of Point Pattern
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
incircle

Find Largest Circle Inside Window
Geyer

Geyer's Saturation Point Process Model
update.kppm

Update a Fitted Cluster Point Process Model
infline

Infinite Straight Lines
markcorr

Mark Correlation Function
rshift

Random Shift
disc

Circular Window
fasp.object

Function Arrays for Spatial Patterns
crossdist.ppp

Pairwise distances between two different point patterns
progressreport

Print Progress Reports
compatible.fasp

Test Whether Two Function Arrays Are Compatible
DiggleGratton

Diggle-Gratton model
nnwhich

Nearest neighbour
marktable

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

Generate N Uniform Random Points
vertices

Vertices of a Window
suffstat

Sufficient Statistic of Point Process Model
gridcentres

Rectangular grid of points
chop.tess

Subdivide a Window or Tessellation using a Set of Lines
clickppp

Interactively Add Points
Linhom

L-function
superimposePSP

Superimpose Several Line Segment Patterns
spokes

Spokes pattern of dummy points
convexhull.xy

Convex Hull of Points
lgcp.estK

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

Fit Point Process Model to Data
shift.im

Apply Vector Translation To Pixel Image
plot.fv

Plot Function Valuesn
Pairwise

Generic Pairwise Interaction model
pairsat.family

Saturated Pairwise Interaction Point Process Family
urkiola

Urkiola Woods Point Pattern
psp.object

Class of Line Segment Patterns
Extract.listof

Extract or Replace Subset of a List of Things
ord.family

Ord Interaction Process Family
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
clarkevans

Clark and Evans Aggregation Index
rmhmodel.default

Build Point Process Model for Metropolis-Hastings Simulation.
as.data.frame.psp

Coerce Line Segment Pattern to a Data Frame
as.mask

Pixel Image Approximation of a Window
StraussHard

The Strauss / Hard Core Point Process Model
pppmatching.object

Class of Point Matchings
km.rs

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

Apply Vector Translation To Window
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
amacrine

Hughes' Amacrine Cell Data
rpoislinetess

Poisson Line Tessellation
MultiStrauss

The Multitype Strauss Point Process Model
by.im

Apply Function to Image Broken Down by Factor
miplot

Morishita Index Plot
lengths.psp

Lengths of Line Segments
matchingdist

Distance for a Point Pattern Matching
envelope

Simulation envelopes of summary function
multiplicity.ppp

Count Multiplicity of Duplicate Points
quantile.im

Sample Quantiles of Pixel Image
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
nearest.raster.point

Find Pixel Nearest to a Given Point
quad.object

Class of Quadrature Schemes
letterR

Window in Shape of Letter R
setmarks

Set or Reset the Marks in a Point Pattern
dilate.owin

Dilate a Window
longleaf

Longleaf Pines Point Pattern
as.tess

Convert Data To Tessellation
plot.plotppm

Plot a plotppm Object Created by plot.ppm
summary.im

Summarizing a Pixel Image
summary.ppm

Summarizing a Fitted Point Process Model
plot.tess

Plot a tessellation
markconnect

Mark Connection Function
markvario

Mark Variogram
is.owin

Test Whether An Object Is A Window
reach

Interaction Distance of a Point Process
pointsOnLines

Place Points Evenly Along Specified Lines
discretise

Safely Convert Point Pattern Window to Binary Mask
tess

Create a Tessellation
fitted.ppm

Fitted Conditional Intensity for Point Process Model
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
eval.fasp

Evaluate Expression Involving Function Arrays
owin

Create a Window
plot.splitppp

Plot a List of Point Patterns
update.ppm

Update a Fitted Point Process Model
predict.ppm

Prediction from a Fitted Point Process Model
owin.object

Class owin
fv.object

Data Frames of Function Values
interp.im

Interpolate a Pixel Image
distmap.psp

Distance Map of Line Segment Pattern
quadscheme

Generate a Quadrature Scheme from a Point Pattern
spatstat-internal

Internal spatstat functions
superimpose

Superimpose Several Point Patterns
redwood

California Redwoods Point Pattern (Ripley's Subset)
rNeymanScott

Simulate Neyman-Scott Process
quadrat.test

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

Remove Marks
effectfun

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

Generate grid of parallel lines with random displacement
ppm.object

Class of Fitted Point Process Models
fryplot

Fry Plot of Point Pattern
rpoint

Generate N Random Points
model.matrix.ppm

Extract Design Matrix from Point Process Model
harmonic

Basis for Harmonic Functions
union.quad

Union of Data and Dummy Points
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
pairdist.default

Pairwise distances
stieltjes

Compute Integral of Function Against Cumulative Distribution
ppp

Create a Point Pattern
quadratcount

Quadrat counting for a point pattern
psp

Create a Line Segment Pattern
gridweights

Compute Quadrature Weights Based on Grid Counts
kppm

Fit cluster point process model
quadrats

Divide Region into Quadrats
rmhmodel.ppm

Interpret Fitted Model for Metropolis-Hastings Simulation.
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
pcfcross

Multitype pair correlation function
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
scanpp

Read Point Pattern From Data File
ewcdf

Weighted Empirical Cumulative Distribution Function
rmpoint

Generate N Random Multitype Points
summary.ppp

Summary of a Point Pattern Dataset
localK

Neighbourhood density function
murchison

Murchison gold deposits
rThomas

Simulate Thomas Process
rlabel

Random Re-Labelling of Point Pattern
rshift.ppp

Randomly Shift a Point Pattern
print.ppm

Print a Fitted Point Process Model
pcf.fasp

Pair Correlation Function obtained from array of K functions
affine.ppp

Apply Affine Transformation To Point Pattern
plot.kppm

Plot a fitted cluster point process
rcell

Simulate Baddeley-Silverman Cell Process
pixelquad

Quadrature Scheme Based on Pixel Grid
connected

Connected components of an image or window
summary.psp

Summary of a Line Segment Pattern Dataset
rjitter

Random Perturbation of a Point Pattern
split.ppp

Divide Point Pattern into Sub-patterns
rSSI

Simulate Simple Sequential Inhibition
setcov

Set Covariance of a Window
nndist

Nearest neighbour distances
Iest

Estimate the I-function
persp.im

Perspective Plot of Pixel Image
rpoisppOnLines

Generate Poisson Point Pattern on Line Segments
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
rGaussPoisson

Simulate Gauss-Poisson Process
pcf.ppp

Pair Correlation Function of Point Pattern
selfcrossing.psp

Crossing Points in a Line Segment Pattern
qqplot.ppm

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

Apply Vector Translation To Line Segment Pattern
runifpointOnLines

Generate N Uniform Random Points On Line Segments
eval.hyper

Evaluate an Expression in Each Row of a Hyperframe
ripras

Estimate window from points alone
swedishpines

Swedish Pines Point Pattern
solutionset

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

Create a Pixel Image Object
spruces

Spruces Point Pattern
rthin

Random Thinning
gpc2owin

Convert Polygonal Region into Different Format
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
shapley

Galaxies in the Shapley Supercluster
summary.owin

Summary of a Spatial Window
summary.splitppp

Summary of a Split Point Pattern
print.owin

Print Brief Details of a Spatial Window
rshift.psp

Randomly Shift a Line Segment Pattern
pppdist

Distance Between Two Point Patterns
plot.hyperframe

Plot Entries in a Hyperframe
residualspaper

Data and Code From JRSS Discussion Paper on Residuals