Learn R Programming

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

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

19,373

Version

1.12-1

License

GPL version 2 or newer

Maintainer

Last Published

September 22nd, 2024

Functions in spatstat (1.12-1)

Gcross

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

Geyer's Saturation Point Process Model
Kinhom

Inhomogeneous K-function
Pairwise

Generic Pairwise Interaction model
Saturated

Saturated Pairwise Interaction model
anova.ppm

ANOVA for Fitted Point Process Models
angles.psp

Orientation Angles of Line Segments
Kmeasure

Reduced Second Moment Measure
OrdThresh

Ord's Interaction model
copper

Berman-Huntington points and lines data
bei

Tropical rain forest trees
applynbd

Apply Function to Every Neighbourhood in a Point Pattern
Gest

Nearest Neighbour Distance Function G
StraussHard

The Strauss / Hard Core Point Process Model
contour.im

Contour plot of pixel image
alltypes

Calculate Statistic for All Types in a Multitype Point Pattern
crossdist.default

Pairwise distances between two different sets of points
append.psp

Combine Two Line Segment Patterns
corners

Corners of a rectangle
inside.owin

Test Whether Points Are Inside A Window
Kmulti

Marked K-Function
cut.ppp

Convert Point Pattern Marks from Numeric to Factor
is.multitype

Test whether Object is Multitype
cells

Biological Cells Point Pattern
affine.ppp

Apply Affine Transformation To Point Pattern
as.im

Convert to Pixel Image
default.dummy

Generate a Default Pattern of Dummy Points
as.rectangle

Window Frame
dilate.owin

Dilate a Window
ants

Harkness-Isham ants' nests data
markstat

Summarise Marks in Every Neighbourhood in a Point Pattern
clarkevans

Clark and Evans Aggregation Index
MultiStrauss

The Multitype Strauss Point Process Model
envelope

Simulation envelopes of summary function
is.owin

Test Whether An Object Is A Window
pairdist.ppp

Pairwise distances
is.ppp

Test Whether An Object Is A Point Pattern
discretise

Safely Convert Point Pattern Window to Binary Mask
eval.fv

Evaluate Expression Involving Functions
bdist.pixels

Distance to Boundary of Window
pppdist

Optimal Match Between Two Point Patterns
markcorr

Mark Correlation Function
crossdist

Pairwise distances
Jdot

Multitype J Function (i-to-any)
expand.owin

Expand Window By Factor
endpoints.psp

Endpoints of Line Segment Pattern
cut.im

Convert Pixel Image from Numeric to Factor
dummy.ppm

Extract Dummy Points Used to Fit a Point Process Model
fitin.ppm

Extract the Interaction from a Fitted Point Process Model
data.ppm

Extract Original Data from a Fitted Point Process Model
ewcdf

Weighted Empirical Cumulative Distribution Function
Poisson

Poisson Point Process Model
LennardJones

The Lennard-Jones Potential
im

Create a Pixel Image Object
DiggleGratton

Diggle-Gratton model
midpoints.psp

Midpoints of Line Segment Pattern
disc

Circular Window
bramblecanes

Hutchings' Bramble Canes data
owin.object

Class owin
nndist.psp

Nearest neighbour distances between line segments
Jest

Estimate the J-function
is.marked.ppm

Test Whether A Point Process Model is Marked
km.rs

Kaplan-Meier and Reduced Sample Estimator using Histograms
rlabel

Random Re-Labelling of Point Pattern
localK

Neighbourhood density function
print.ppp

Print Brief Details of a Point Pattern Dataset
plot.psp

plot a Spatial Line Segment Pattern
plot.hyperframe

Plot Entries in a Hyperframe
eval.im

Evaluate Expression Involving Pixel Images
rStrauss

Perfect Simulation of the Strauss Process
coef.ppm

Coefficients of Fitted Point Process Model
vertices

Vertices of a Window
humberside

Humberside Data on Childhood Leukaemia and Lymphoma
bounding.box.xy

Convex Hull of Points
Gdot

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

The Strauss Point Process Model
nncorr

Nearest-Neighbour Correlation of Marked Point Pattern
hist.im

Histogram of Pixel Values in an Image
plot.fasp

Plot a Function Array
nnwhich

Nearest neighbour
distmap.ppp

Distance Map of Point Pattern
as.data.frame.ppp

Coerce Point Pattern to a Data Frame
distmap

Distance Map
bdist.points

Distance to Boundary of Window
rMaternII

Simulate Matern Model II
rshift

Random Shift
print.psp

Print Brief Details of a Line Segment Pattern Dataset
lurking

Lurking variable plot
erode.owin

Erode a Window
pairdist.default

Pairwise distances
Jcross

Multitype J Function (i-to-j)
Softcore

The Soft Core Point Process Model
spatstat-internal

Internal spatstat functions
crossing.psp

Crossing Points of Two Line Segment Patterns
affine

Apply Affine Transformation
print.im

Print Brief Details of an Image
Iest

Estimate the I-function
print.ppm

Print a Fitted Point Process Model
qqplot.ppm

Q-Q Plot of Residuals from Fitted Point Process Model
nearest.raster.point

Find Pixel Nearest to a Given Point
print.owin

Print Brief Details of a Spatial Window
duplicated.ppp

Determine Duplicated Points in a Spatial Point Pattern
allstats

Calculate four standard summary functions of a point pattern.
pcf.fasp

Pair Correlation Function obtained from array of K functions
pcf.fv

Pair Correlation Function obtained from K Function
interp.im

Interpolate a Pixel Image
Jmulti

Marked J Function
is.im

Test Whether An Object Is A Pixel Image
Kdot.inhom

Inhomogeneous Multitype K Dot Function
betacells

Beta Ganglion Cells in Cat Retina
rmpoispp

Generate Multitype Poisson Point Pattern
rshift.splitppp

Randomly Shift a List of Point Patterns
pcf.ppp

Pair Correlation Function of Point Pattern
Ord

Generic Ord Interaction model
quadscheme

Generate a Quadrature Scheme from a Point Pattern
multiplicity.ppp

Count Multiplicity of Duplicate Points
psp.object

Class of Line Segment Patterns
rotate.psp

Rotate a Line Segment Pattern
amacrine

Hughes' Amacrine Cell Data
ppp

Create a Point Pattern
Fest

Estimate the empty space function F
shift.ppp

Apply Vector Translation To Point Pattern
rpoint

Generate N Random Points
is.multitype.ppm

Test Whether A Point Process Model is Multitype
levelset

Level Set of a Pixel Image
rshift.ppp

Randomly Shift a Point Pattern
affine.owin

Apply Affine Transformation To Window
rMaternI

Simulate Matern Model I
reduced.sample

Reduced Sample Estimator using Histogram Data
quad.ppm

Extract Quadrature Scheme Used to Fit a Point Process Model
chorley

Chorley-Ribble Cancer Data
psp

Create a Line Segment Pattern
setcov

Set Covariance of a Window
complement.owin

Take Complement of a Window
rmh

Simulate point patterns using the Metropolis-Hastings algorithm.
distmap.psp

Distance Map of Line Segment Pattern
as.mask

Pixel Image Approximation of a Window
scanpp

Read Point Pattern From Data File
eval.hyper

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

Convert Line Segment Pattern to Another Unit of Length
quantile.im

Sample Quantiles of Pixel Image
as.psp

Convert Data To Class psp
Kcross.inhom

Inhomogeneous Cross K Function
as.ppp

Convert Data To Class ppp
square

Square Window
affine.psp

Apply Affine Transformation To Line Segment Pattern
subset.listof

Extract or Replace Subset of a List of Things
eem

Exponential Energy Marks
area.owin

Area of a Window
as.matrix.im

Convert Pixel Image to Matrix
crossdist.psp

Pairwise distances between two different line segment patterns
bounding.box

Bounding Box of a Window or Point Pattern
anemones

Beadlet Anemones Data
rsyst

Simulate systematic random point pattern
density.psp

Kernel Smoothing of Line Segment Pattern
diagnose.ppm

Diagnostic Plots for Fitted Point Process Model
ganglia

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

Summary of a Spatial Window
crossdist.ppp

Pairwise distances between two different point patterns
finpines

Pine saplings in Finland.
simdat

Simulated Point Pattern
eroded.areas

Areas of Morphological Erosions
subset.splitppp

Extract or Replace Sub-Patterns
identify.ppp

Identify Points in a Point Pattern
im.object

Class of Images
summary.im

Summarizing a Pixel Image
subset.im

Extract Subset of Image
logLik.ppm

Log Likelihood for Poisson Point Process Model
subsetget.im

Reset Values in Subset of Image
rescale.owin

Convert Window to Another Unit of Length
density.splitppp

Kernel Smoothed Intensity of Split Point Pattern
rpoispp

Generate Poisson Point Pattern
owin

Create a Window
compatible.fv

Test Whether Two Function Objects Are Compatible
swedishpines

Swedish Pines Point Pattern
is.marked.ppp

Test Whether A Point Pattern is Marked
rmpoint

Generate N Random Multitype Points
ord.family

Ord Interaction Process Family
summary.psp

Summary of a Line Segment Pattern Dataset
is.ppm

Test Whether An Object Is A Fitted Point Process Model
runifdisc

Generate N Uniform Random Points in a Disc
plot.plotppm

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

Interpret Fitted Model for Metropolis-Hastings Simulation.
lansing

Lansing Woods Point Pattern
spatstat-deprecated

Deprecated spatstat functions
nncross

Nearest Neighbour in Another Point Pattern
rescale

Convert dataset to another unit of length
clickppp

Interactively Add Points
plot.ppm

plot a Fitted Point Process Model
demopat

Artificial Data Point Pattern
Kdot

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

Test Whether Two Pixel Images Are Compatible
Kcross

Multitype K Function (Cross-type)
convexhull.xy

Convex Hull of Points
diameter

Diameter of a Window
matclust.estK

Fit the Matern Cluster Point Process by Minimum Contrast
selfcrossing.psp

Crossing Points in a Line Segment Pattern
split.ppp

Divide Point Pattern into Sub-patterns
Kest

K-function
hyperframe

Hyper Data Frame
pairsat.family

Saturated Pairwise Interaction Point Process Family
ppm

Fit Point Process Model to Data
Lest

L-function
smooth.ppp

Spatial smoothing of observations at irregular points
plot.ppp

plot a Spatial Point Pattern
dirichlet.weights

Compute Quadrature Weights Based on Dirichlet Tessellation
pairdist

Pairwise distances
rmhstart

Determine Initial State for Metropolis-Hastings Simulation.
as.owin

Convert Data To Class owin
distmap.owin

Distance Map of Window
mean.im

Mean Pixel Value in an Image
intersect.owin

Intersection or Union of Two Windows
hamster

Aherne's hamster tumour data
nbfires

Point Patterns of New Brunswick Forest Fires
plot.im

Plot a Pixel Image
ppp.object

Class of Point Patterns
is.multitype.ppp

Test Whether A Point Pattern is Multitype
rotate.ppp

Rotate a Point Pattern
fv.object

Data Frames of Function Values
gridcentres

Rectangular grid of points
plot.splitppp

Plot a List of Point Patterns
quadrat.test

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

Basis for Harmonic Functions
ks.test.ppm

Kolmogorov-Smirnov Test for Point Process Model
progressreport

Print Progress Reports
pcf

Pair Correlation Function
fasp.object

Function Arrays for Spatial Patterns
redwood

California Redwoods Point Pattern (Ripley's Subset)
spruces

Spruces Point Pattern
is.marked

Test Whether Marks Are Present
is.subset.owin

Determine Whether One Window is Contained In Another
persp.im

Perspective Plot of Pixel Image
profilepl

Profile Maximum Pseudolikelihood
plot.fv

Plot Function Valuesn
rmhmodel

Define Point Process Model for Metropolis-Hastings Simulation.
nztrees

New Zealand Trees Point Pattern
unmark

Remove Marks from a Marked Point Pattern
rThomas

Simulate Thomas Process
ripras

Estimate window from points alone
rcell

Simulate Baddeley-Silverman Cell Process
ppm.object

Class of Fitted Point Process Models
mincontrast

Method of Minimum Contrast
quadratcount

Quadrat counting for a point pattern
pairdist.psp

Pairwise distances between line segments
density.ppp

Kernel Smoothed Intensity of Point Pattern
pairwise.family

Pairwise Interaction Process Family
update.ppm

Update a Fitted Point Process Model
reach

Interaction Distance of a Point Process
lengths.psp

Lengths of Line Segments
rmhmodel.list

Define Point Process Model for Metropolis-Hastings Simulation.
rNeymanScott

Simulate Neyman-Scott Process
plot.listof

Plot a List of Things
rshift.psp

Randomly Shift a Line Segment Pattern
summary.ppp

Summary of a Point Pattern Dataset
setmarks

Set or Reset the Marks in a Point Pattern
Gmulti

Marked Nearest Neighbour Distance Function
kaplan.meier

Kaplan-Meier Estimator using Histogram Data
summary.listof

Summary of a List of Things
MultiStraussHard

The Multitype/Hard Core Strauss Point Process Model
summary.ppm

Summarizing a Fitted Point Process Model
thomas.estK

Fit the Thomas Point Process by Minimum Contrast
unique.ppp

Extract Unique Points from a Spatial Point Pattern
shift.owin

Apply Vector Translation To Window
clickpoly

Interactively Define a Polygon
predict.ppm

Prediction from a Fitted Point Process Model
summary.splitppp

Summary of a Split Point Pattern
letterR

Window in Shape of Letter R
vcov.ppm

Variance-Covariance Matrix for a Fitted Point Process Model
rMatClust

Simulate Matern Cluster Process
lgcp.estK

Fit a Log-Gaussian Cox Point Process by Minimum Contrast
raster.x

Cartesian Coordinates for a Pixel Raster
nndist

Nearest neighbour distances
centroid.owin

Centroid of a window
rmh.ppm

Simulate from a Fitted Point Process Model
gridweights

Compute Quadrature Weights Based on Grid Counts
plot.quad

plot a Spatial Quadrature Scheme
spatstat

The Spatstat Package
residuals.ppm

Residuals for Fitted Point Process Model
Kest.fft

K-function using FFT
rmhcontrol

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

Apply Vector Translation To Pixel Image
PairPiece

The Piecewise Constant Pairwise Interaction Point Process Model
rotate

Rotate
concatxy

Concatenate x,y Coordinate Vectors
rotate.owin

Rotate a Window
units

Name for Unit of Length
longleaf

Longleaf Pines Point Pattern
rstrat

Simulate Stratified Random Point Pattern
fitted.ppm

Fitted Conditional Intensity for Point Process Model
plot.owin

Plot a Spatial Window
redwoodfull

California Redwoods Point Pattern (Entire Dataset)
rescue.rectangle

Convert Window Back To Rectangle
spokes

Spokes pattern of dummy points
ponderosa

Ponderosa Pine Tree Point Pattern
print.quad

Print a Quadrature Scheme
rescale.ppp

Convert Point Pattern to Another Unit of Length
rmhmodel.default

Build Point Process Model for Metropolis-Hastings Simulation.
japanesepines

Japanese Pines Point Pattern
quad.object

Class of Quadrature Schemes
subset.ppp

Extract or Replace Subset of Point Pattern
residualspaper

Data and Code From JRSS Discussion Paper on Residuals
rlinegrid

Generate grid of parallel lines with random displacement
rmh.default

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

Generate Poisson Random Line Process
summary.quad

Summarizing a Quadrature Scheme
runifpoint

Generate N Uniform Random Points
superimpose

Superimpose Several Point Patterns
shift.psp

Apply Vector Translation To Line Segment Pattern
rthin

Random Thinning
subset.psp

Extract Subset of Line Segment Pattern
rSSI

Simulate Simple Sequential Inhibition
suffstat

Sufficient Statistic of Point Process Model
union.quad

Union of Data and Dummy Points
shift

Apply Vector Translation
solutionset

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

Extract Subset of Function Array
spatstat.options

Internal Options in Spatstat Package
subset.fv

Extract Subset of Function Values
trim.rectangle

Cut margins from rectangle