Learn R Programming

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

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

19,373

Version

1.15-3

License

GPL (>= 2)

Maintainer

Last Published

May 14th, 2009

Functions in spatstat (1.15-3)

betacells

Beta Ganglion Cells in Cat Retina
crossing.psp

Crossing Points of Two Line Segment Patterns
crossdist.ppp

Pairwise distances between two different point patterns
StraussHard

The Strauss / Hard Core Point Process Model
Strauss

The Strauss Point Process Model
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
as.data.frame.psp

Coerce Line Segment Pattern to a Data Frame
colourmap

Colour Lookup Tables
Softcore

The Soft Core Point Process Model
centroid.owin

Centroid of a window
demopat

Artificial Data Point Pattern
ewcdf

Weighted Empirical Cumulative Distribution Function
as.ppp

Convert Data To Class ppp
delaunay

Delaunay Triangulation of Point Pattern
distmap.owin

Distance Map of Window
hyperframe

Hyper Data Frame
as.mask

Pixel Image Approximation of a Window
complement.owin

Take Complement of a Window
compatible.fasp

Test Whether Two Function Arrays Are Compatible
clickppp

Interactively Add Points
as.tess

Convert Data To Tessellation
gpc2owin

Convert Polygonal Region into Different Format
distmap.ppp

Distance Map of Point Pattern
clarkevans

Clark and Evans Aggregation Index
eval.fv

Evaluate Expression Involving Functions
alltypes

Calculate Summary Statistic for All Types in a Multitype Point Pattern
is.subset.owin

Determine Whether One Window is Contained In Another
fasp.object

Function Arrays for Spatial Patterns
fv.object

Data Frames of Function Values
anova.ppm

ANOVA for Fitted Point Process Models
closing.owin

Morphological Closing of a Window
midpoints.psp

Midpoints of Line Segment Pattern
allstats

Calculate four standard summary functions of a point pattern.
as.matrix.im

Convert Pixel Image to Matrix
chop.tess

Subdivide a Window or Tessellation using a Set of Lines
eval.im

Evaluate Expression Involving Pixel Images
coef.ppm

Coefficients of Fitted Point Process Model
as.data.frame.ppp

Coerce Point Pattern to a Data Frame
crossdist.default

Pairwise distances between two different sets of points
copper

Berman-Huntington points and lines data
fitted.ppm

Fitted Conditional Intensity for Point Process Model
concatxy

Concatenate x,y Coordinate Vectors
bounding.box.xy

Convex Hull of Points
inforder.family

Infinite Order Interaction Family
distmap

Distance Map
bounding.box

Bounding Box of a Window or Point Pattern
crossdist

Pairwise distances
clickpoly

Interactively Define a Polygon
adaptive.density

Intensity Estimate of Point Pattern Using Tessellation
affine.psp

Apply Affine Transformation To Line Segment Pattern
angles.psp

Orientation Angles of Line Segments
by.im

Apply Function to Image Broken Down by Factor
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
bdist.points

Distance to Boundary of Window
pairdist.default

Pairwise distances
lgcp.estK

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

Hutchings' Bramble Canes data
pppmatching

Create a Point Matching
chorley

Chorley-Ribble Cancer Data
blur

Apply Gaussian Blur to a Pixel Image
pairsat.family

Saturated Pairwise Interaction Point Process Family
affine

Apply Affine Transformation
data.ppm

Extract Original Data from a Fitted Point Process Model
as.psp

Convert Data To Class psp
compatible.im

Test Whether Two Pixel Images Are Compatible
connected

Connected components of an image or window
dirichlet

Dirichlet Tessellation of Point Pattern
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
distmap.psp

Distance Map of Line Segment Pattern
density.ppp

Kernel Smoothed Intensity of Point Pattern
hamster

Aherne's hamster tumour data
predict.kppm

Prediction from a Fitted Cluster Point Process Model
fitin.ppm

Extract the Interaction from a Fitted Point Process Model
is.multitype.ppp

Test Whether A Point Pattern is Multitype
eroded.areas

Areas of Morphological Erosions
runifdisc

Generate N Uniform Random Points in a Disc
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
owin

Create a Window
eem

Exponential Energy Marks
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
bdist.pixels

Distance to Boundary of Window
pppdist

Distance Between Two Point Patterns
cut.im

Convert Pixel Image from Numeric to Factor
density.psp

Kernel Smoothing of Line Segment Pattern
is.marked

Test Whether Marks Are Present
clip.infline

Intersect Infinite Straight Lines with a Window
area.owin

Area of a Window
markcorr

Mark Correlation Function
by.ppp

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

Class of Line Segment Patterns
endpoints.psp

Endpoints of Line Segment Pattern
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
owin.object

Class owin
cells

Biological Cells Point Pattern
pairwise.family

Pairwise Interaction Process Family
gridcentres

Rectangular grid of points
anemones

Beadlet Anemones Data
areadiff

Difference of Disc Areas
pcf.fv

Pair Correlation Function obtained from K Function
eval.fasp

Evaluate Expression Involving Function Arrays
affine.ppp

Apply Affine Transformation To Point Pattern
interp.im

Interpolate a Pixel Image
as.owin

Convert Data To Class owin
fryplot

Fry Plot of Point Pattern
ants

Harkness-Isham ants' nests data
crossdist.psp

Pairwise distances between two different line segment patterns
spruces

Spruces Point Pattern
envelope

Simulation envelopes of summary function
amacrine

Hughes' Amacrine Cell Data
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
as.rectangle

Window Frame
is.marked.ppm

Test Whether A Point Process Model is Marked
rescale.ppp

Convert Point Pattern to Another Unit of Length
bei

Tropical rain forest trees
quadrats

Divide Region into Quadrats
reduced.sample

Reduced Sample Estimator using Histogram Data
pixellate

Convert Point Pattern to Pixel Image
multiplicity.ppp

Count Multiplicity of Duplicate Points
mean.im

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

Simulate Baddeley-Silverman Cell Process
intersect.owin

Intersection or Union of Two Windows
inside.owin

Test Whether Points Are Inside A Window
rescale.psp

Convert Line Segment Pattern to Another Unit of Length
spatstat-deprecated

Deprecated spatstat functions
hist.im

Histogram of Pixel Values in an Image
nztrees

New Zealand Trees Point Pattern
solutionset

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

Test Whether An Object Is A Fitted Point Process Model
rmhmodel.ppm

Interpret Fitted Model for Metropolis-Hastings Simulation.
nearestsegment

Find Line Segment Nearest to Each Point
ganglia

Beta Ganglion Cells in Cat Retina, Old Version
shift.owin

Apply Vector Translation To Window
pcf

Pair Correlation Function
dilate.owin

Dilate a Window
marktable

Tabulate Marks in Neighbourhood of Every Point in a Point Pattern
logLik.ppm

Log Likelihood for Poisson Point Process Model
summary.im

Summarizing a Pixel Image
murchison

Murchison gold deposits
plot.tess

Plot a tessellation
infline

Infinite Straight Lines
erode.owin

Erode a Window
plot.plotppm

Plot a plotppm Object Created by plot.ppm
plot.kppm

Plot a fitted cluster point process
rMaternII

Simulate Matern Model II
is.multitype

Test whether Object is Multitype
compatible.fv

Test Whether Two Function Objects Are Compatible
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
gridweights

Compute Quadrature Weights Based on Grid Counts
cut.ppp

Classify Points in a Point Pattern
identify.ppp

Identify Points in a Point Pattern
summary.splitppp

Summary of a Split Point Pattern
lut

Lookup Tables
discretise

Safely Convert Point Pattern Window to Binary Mask
nbfires

Point Patterns of New Brunswick Forest Fires
nnwhich

Nearest neighbour
rSSI

Simulate Simple Sequential Inhibition
rpoint

Generate N Random Points
ppm.object

Class of Fitted Point Process Models
quadrat.test

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

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

Expand Window By Factor
quadscheme

Generate a Quadrature Scheme from a Point Pattern
eval.hyper

Evaluate an Expression in Each Row of a Hyperframe
rotate.psp

Rotate a Line Segment Pattern
default.dummy

Generate a Default Pattern of Dummy Points
finpines

Pine saplings in Finland.
mincontrast

Method of Minimum Contrast
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
kstest.ppm

Kolmogorov-Smirnov Test for Point Process Model
quantile.im

Sample Quantiles of Pixel Image
rmh.ppm

Simulate from a Fitted Point Process Model
matchingdist

Distance for a Point Pattern Matching
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
nndist

Nearest neighbour distances
rshift.splitppp

Randomly Shift a List of Point Patterns
pointsOnLines

Place Points Evenly Along Specified Lines
split.ppp

Divide Point Pattern into Sub-patterns
rGaussPoisson

Simulate Gauss-Poisson Process
rStrauss

Perfect Simulation of the Strauss Process
tiles

Extract List of Tiles in a Tessellation
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
pcf.ppp

Pair Correlation Function of Point Pattern
disc

Circular Window
shift.im

Apply Vector Translation To Pixel Image
is.im

Test Whether An Object Is A Pixel Image
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
rThomas

Simulate Thomas Process
im.object

Class of Images
profilepl

Profile Maximum Pseudolikelihood
reach

Interaction Distance of a Point Process
plot.fasp

Plot a Function Array
spatstat-internal

Internal spatstat functions
lansing

Lansing Woods Point Pattern
miplot

Morishita Index Plot
quadratresample

Resample a Point Pattern by Resampling Quadrats
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
subset.fasp

Extract Subset of Function Array
intersect.tess

Intersection of Two Tessellations
smooth.ppp

Spatial smoothing of observations at irregular points
longleaf

Longleaf Pines Point Pattern
lurking

Lurking variable plot
heather

Diggle's Heather Data
rshift.psp

Randomly Shift a Line Segment Pattern
shapley

Galaxies in the Shapley Supercluster
levelset

Level Set of a Pixel Image
plot.owin

Plot a Spatial Window
plot.ppm

plot a Fitted Point Process Model
subset.listof

Extract or Replace Subset of a List of Things
localK

Neighbourhood density function
is.multitype.ppm

Test Whether A Point Process Model is Multitype
quadrat.test.splitppp

Chi-Squared Test of CSR for Split Point Pattern
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
rMatClust

Simulate Matern Cluster Process
opening.owin

Morphological Opening of a Window
rMosaicSet

Mosaic Random Set
plot.psp

plot a Spatial Line Segment Pattern
nncorr

Nearest-Neighbour Correlation Indices of Marked Point Pattern
harmonic

Basis for Harmonic Functions
simulate.kppm

Simulate a fitted cluster point process model.
rmhmodel.default

Build Point Process Model for Metropolis-Hastings Simulation.
[.quad

Subset of Quadrature Scheme
quadratcount

Quadrat counting for a point pattern
rotate.owin

Rotate a Window
with.fv

Evaluate an Expression in a Function Table
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
raster.x

Cartesian Coordinates for a Pixel Raster
markconnect

Mark Connection Function
suffstat

Sufficient Statistic of Point Process Model
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
plot.hyperframe

Plot Entries in a Hyperframe
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
rthin

Random Thinning
stieltjes

Compute Integral of Function Against Cumulative Distribution
kppm

Fit cluster point process model
ppm

Fit Point Process Model to Data
markcorrint

Mark Correlation Integral
summary.owin

Summary of a Spatial Window
ord.family

Ord Interaction Process Family
model.matrix.ppm

Extract Design Matrix from Point Process Model
plot.im

Plot a Pixel Image
plot.fv

Plot Function Valuesn
affine.owin

Apply Affine Transformation To Window
pixelquad

Quadrature Scheme Based on Pixel Grid
lengths.psp

Lengths of Line Segments
vertices

Vertices of a Window
project2segment

Move Point To Nearest Line
model.images

Compute Images of Constructed Covariates
nearest.raster.point

Find Pixel Nearest to a Given Point
rlabel

Random Re-Labelling of Point Pattern
selfcrossing.psp

Crossing Points in a Line Segment Pattern
summary.ppp

Summary of a Point Pattern Dataset
rsyst

Simulate systematic random point pattern
rescale

Convert dataset to another unit of length
contour.im

Contour plot of pixel image
rpoisline

Generate Poisson Random Line Process
summary.ppm

Summarizing a Fitted Point Process Model
persp.im

Perspective Plot of Pixel Image
as.im

Convert to Pixel Image
diameter

Diameter of a Window
rotate.ppp

Rotate a Point Pattern
markvario

Mark Variogram
nndist.psp

Nearest neighbour distances between line segments
rmpoispp

Generate Multitype Poisson Point Pattern
union.quad

Union of Data and Dummy Points
rpoislinetess

Poisson Line Tessellation
rMaternI

Simulate Matern Model I
plot.listof

Plot a List of Things
plot.ppp

plot a Spatial Point Pattern
quad.object

Class of Quadrature Schemes
progressreport

Print Progress Reports
pcf.fasp

Pair Correlation Function obtained from array of K functions
pairdist.psp

Pairwise distances between line segments
print.psp

Print Brief Details of a Line Segment Pattern Dataset
ppp

Create a Point Pattern
rescale.im

Convert Pixel Image to Another Unit of Length
rescale.owin

Convert Window to Another Unit of Length
subset.psp

Extract Subset of Line Segment Pattern
pcfcross

Multitype pair correlation function
ripras

Estimate window from points alone
plot.colourmap

Plot a Colour Map
japanesepines

Japanese Pines Point Pattern
rmh.default

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

California Redwoods Point Pattern (Ripley's Subset)
ponderosa

Ponderosa Pine Tree Point Pattern
print.ppp

Print Brief Details of a Point Pattern Dataset
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
swedishpines

Swedish Pines Point Pattern
plot.splitppp

Plot a List of Point Patterns
pppmatching.object

Class of Point Matchings
rescue.rectangle

Convert Window Back To Rectangle
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
rmhcontrol

Set Control Parameters for Metropolis-Hastings Algorithm.
predict.ppm

Prediction from a Fitted Point Process Model
rpoispp

Generate Poisson Point Pattern
subset.ppp

Extract or Replace Subset of Point Pattern
setcov

Set Covariance of a Window
shift.ppp

Apply Vector Translation To Point Pattern
rshift.ppp

Randomly Shift a Point Pattern
rjitter

Random Perturbation of a Point Pattern
subset.splitppp

Extract or Replace Sub-Patterns
scanpp

Read Point Pattern From Data File
subsetget.im

Reset Values in Subset of Image
ppp.object

Class of Point Patterns
spatstat.options

Internal Options in Spatstat Package
rlinegrid

Generate grid of parallel lines with random displacement
print.ppm

Print a Fitted Point Process Model
rotate

Rotate
Gmulti

Marked Nearest Neighbour Distance Function
[.tess

Extract or Replace Subset of Tessellation
rstrat

Simulate Stratified Random Point Pattern
rmhmodel.list

Define Point Process Model for Metropolis-Hastings Simulation.
subset.fv

Extract Subset of Function Values
setmarks

Set or Reset the Marks in a Point Pattern
psp

Create a Line Segment Pattern
plot.quad

plot a Spatial Quadrature Scheme
qqplot.ppm

Q-Q Plot of Residuals from Fitted Point Process Model
print.im

Print Brief Details of an Image
tess

Create a Tessellation
rMosaicField

Mosaic Random Field
update.kppm

Update a Fitted Cluster Point Process Model
is.ppp

Test Whether An Object Is A Point Pattern
unmark

Remove Marks
summary.listof

Summary of a List of Things
Poisson

Poisson Point Process Model
unique.ppp

Extract Unique Points from a Spatial Point Pattern
Linhom

L-function
rNeymanScott

Simulate Neyman-Scott Process
LennardJones

The Lennard-Jones Potential
square

Square Window
rpoisppOnLines

Generate Poisson Point Pattern on Line Segments
urkiola

Urkiola Woods Point Pattern
Kmeasure

Reduced Second Moment Measure
runifpointOnLines

Generate N Uniform Random Points On Line Segments
unitname

Name for Unit of Length
pairdist

Pairwise distances
Emark

Diagnostics for random marking
Jcross

Multitype J Function (i-to-j)
Geyer

Geyer's Saturation Point Process Model
spokes

Spokes pattern of dummy points
letterR

Window in Shape of Letter R
Kest.fft

K-function using FFT
runifpoint

Generate N Uniform Random Points
summary.quad

Summarizing a Quadrature Scheme
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
simdat

Simulated Point Pattern
rmpoint

Generate N Random Multitype Points
superimposePSP

Superimpose Several Line Segment Patterns
trim.rectangle

Cut margins from rectangle
Saturated

Saturated Pairwise Interaction model
rshift

Random Shift
Kcross

Multitype K Function (Cross-type)
Jmulti

Marked J Function
Jdot

Multitype J Function (i-to-any)
superimpose

Superimpose Several Point Patterns
print.owin

Print Brief Details of a Spatial Window
Gdot

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

Ord's Interaction model
nncross

Nearest Neighbours Between Two Patterns
MultiStraussHard

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

Pairwise distances
Gest

Nearest Neighbour Distance Function G
corners

Corners of a rectangle
subset.im

Extract Subset of Image
residuals.ppm

Residuals for Fitted Point Process Model
shift

Apply Vector Translation
AreaInter

The Area Interaction Point Process Model
Kinhom

Inhomogeneous K-function
convexhull.xy

Convex Hull of Points
print.quad

Print a Quadrature Scheme
is.marked.ppp

Test Whether A Point Pattern is Marked
spatstat

The Spatstat Package
update.ppm

Update a Fitted Point Process Model
Kest

K-function
Fest

Estimate the empty space function F
Hest

Spherical Contact Distribution Function
BadGey

Hybrid Geyer Point Process Model
Pairwise

Generic Pairwise Interaction model
Iest

Estimate the I-function
Kdot

Multitype K Function (i-to-any)
Kdot.inhom

Inhomogeneous Multitype K Dot Function
Lcross

Multitype L-function (cross-type)
Lest

L-function
Ord

Generic Ord Interaction model
Jest

Estimate the J-function
MultiStrauss

The Multitype Strauss Point Process Model
Kmulti

Marked K-Function
Kcross.inhom

Inhomogeneous Cross K Function
Ldot

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

Combine Two Line Segment Patterns
DiggleGratton

Diggle-Gratton model
Gcross

Multitype Nearest Neighbour Distance Function (i-to-j)
split.im

Divide Image Into Sub-images
shift.psp

Apply Vector Translation To Line Segment Pattern
is.owin

Test Whether An Object Is A Window
SatPiece

Piecewise Constant Saturated Pairwise Interaction Point Process Model
summary.psp

Summary of a Line Segment Pattern Dataset
incircle

Find Largest Circle Inside Window
im

Create a Pixel Image Object