spatstat.linnet-package | R Documentation |
The spatstat.linnet package belongs to the spatstat family of packages. It contains the functionality for analysing spatial data on a linear network.
spatstat is a family of R packages for the statistical analysis of spatial data. Its main focus is the analysis of spatial patterns of points in two-dimensional space.
The original spatstat package has now been split into several sub-packages.
This sub-package spatstat.linnet contains the user-level functions from spatstat that are concerned with spatial data on a linear network.
The orginal spatstat package grew to be very large. It has now been divided into several sub-packages:
spatstat.utils containing basic utilities
spatstat.sparse containing linear algebra utilities
spatstat.data containing datasets
spatstat.univar containing functions for estimating probability distributions of random variables
spatstat.geom containing geometrical objects and geometrical operations
spatstat.explore containing the main functionality for exploratory and non-parametric analysis of spatial data
spatstat.model containing the main functionality for statistical modelling and inference for spatial data
spatstat.linnet containing functions for spatial data on a linear network
spatstat, which simply loads the other sub-packages listed above, and provides documentation.
When you install spatstat, these sub-packages are also
installed. Then if you load the spatstat package by typing
library(spatstat)
, the other sub-packages listed above will
automatically be loaded or imported.
For an overview of all the functions available in these sub-packages,
see the help file for spatstat in the spatstat package,
Additionally there are several extension packages:
spatstat.gui for interactive graphics
spatstat.local for local likelihood (including geographically weighted regression)
spatstat.Knet for additional, computationally efficient code for linear networks
spatstat.sphere (under development) for spatial data on a sphere, including spatial data on the earth's surface
The extension packages must be installed separately and loaded explicitly if needed. They also have separate documentation.
A linear network is a subset of the two-dimensional plane composed of straight line segments. It could represent a road network, for example. Our code requires that, if two segments intersect each other, then the intersection is a single point, and the intersection point is treated as a vertex of the network.
The spatstat.linnet package supports spatial data analysis on a linear network. The primary aim is to analyse spatial patterns of points on a network. The points could represent road accidents on a road network, for example.
The spatstat.linnet package provides code for handling
linear networks
point patterns on a linear network
pixel images on a linear network
(where the network is
divided into small segments and a numerical value is assigned to each segment)
functions on a linear network
(i.e. functions that are
defined at every location along the network)
tessellations of a linear network
(where the network is
subdivided into disjoint subsets with different labels)
point process models on a linear network
Here is a list of the main functionality provided in spatstat.linnet.
Linear networks
An object of class "linnet"
represents a linear network.
Examples of such objects include the dataset
simplenet
provided in the package.
Linear network objects can be created by the following functions:
linnet | create a linear network |
as.linnet | convert other data to a network |
delaunayNetwork | network of Delaunay triangulation |
dirichletNetwork | network of Dirichlet edges |
Utilities for manipulating networks include:
[.linnet | extract subset of linear network |
clickjoin | interactively join vertices in network |
joinVertices | join existing vertices in a network |
insertVertices | insert new vertices at positions along network |
addVertices | add new vertices, extending a network |
thinNetwork | remove vertices or lines from a network |
repairNetwork | repair internal format |
vertices.linnet | extract the vertices of network |
terminalvertices | find terminal vertices of network |
affine.linnet | apply affine transformation |
shift.linnet | apply vector translation |
rotate.linnet | apply rotation |
rescale.linnet | rescale the unit of length |
scalardilate.linnet | physically rescale the network |
diameter.linnet | diameter of linear network |
is.connected.linnet | determine whether network is connected |
lineardisc | compute disc of given radius in network |
marks.linnet | extract marks of a network |
marks<-.linnet | assign marks to a network |
plot.linnet | plot a network |
as.owin.linnet | extract window containing network |
as.psp.linnet | extract line segments comprising network |
nsegments.linnet | number of segments in network |
nvertices.linnet | number of vertices in network |
pixellate.linnet | convert network to 2D pixel image |
print.linnet | print basic information |
summary.linnet | print summary information |
unitname.linnet | extract name of unit of length |
unitname<-.linnet | assign name of unit of length |
vertexdegree | number of segments meeting each vertex |
volume.linnet | total length of network |
Window.linnet | extract window containing network |
density.linnet | smoothed 2D spatial density of lines |
A network is called a tree if it has no closed loops. The following functions support the creation and manipulation of trees:
begins | check start of character string |
branchlabelfun | tree branch membership labelling function |
deletebranch | delete a branch of a tree |
extractbranch | extract a branch of a tree |
treebranchlabels | label vertices of a tree by branch membership |
treeprune | prune tree to given level |
Point patterns on a linear network
An object of class "lpp"
represents a
point pattern on a linear network (for example,
road accidents on a road network).
Examples of such objects include the following datasets provided in the spatstat.data package:
chicago | Chicago crime data |
dendrite | Dendritic spines data |
spiders | Spider webs on mortar lines of brick wall |
There is also a dataset provided in the extension package spatstat.Knet:
wacrashes | Road accidents in Western Australia |
Point patterns on a network can be created by the following functions:
lpp | create a point pattern on a linear network |
as.lpp | convert other data to point pattern on network |
clicklpp | interactively add points on a linear Network |
crossing.linnet | crossing points between network and other lines |
Point patterns on a network can be generated randomly using the following functions:
rpoislpp | Poisson points on linear network |
runiflpp | uniform random points on a linear network |
rlpp | random points on a linear network |
rSwitzerlpp | simulate Switzer-type point process on linear network |
rThomaslpp | simulate Thomas process on linear network |
rcelllpp | simulate cell process on linear network |
rjitter.lpp | randomly perturb a point pattern on a network |
Functions for manipulating a point pattern on a network include
the following. An object of class "lpp"
also belongs to the
class "ppx"
, for which additional support is available.
as.ppp.lpp | convert to 2D point pattern |
as.psp.lpp | extract line segments |
marks.ppx | extract marks associated with points |
marks<-.ppx | assign marks to points on network |
nsegments.lpp | count number of segments |
print.lpp | print basic information |
summary.lpp | print summary information |
unitname.lpp | extract name of unit of length |
unitname<-.lpp | assign name of unit of length |
unmark.lpp | remove marks |
subset.lpp | subset of points satisfying a condition |
[.lpp | extract subset of point pattern |
Window.lpp | extract window containing network |
as.owin.lpp | extract window containing network |
affine.lpp | apply affine transformation |
shift.lpp | apply vector translation |
rotate.lpp | apply rotation |
rescale.lpp | rescale the unit of length |
scalardilate.lpp | physically rescale the network and points |
connected.lpp | find connected components of point pattern on network |
cut.lpp | classify points in a Point Pattern on a Network |
distfun.lpp | distance map (function) |
distmap.lpp | distance map (image) |
domain.lpp | extract the linear network |
identify.lpp | interactively identify points |
is.multitype.lpp | recognize whether point pattern is multitype |
nncross.lpp | nearest neighbours |
nndist.lpp | nearest neighbour distances |
nnfromvertex | nearest data point from each vertex |
nnfun.lpp | nearest neighbour map |
nnwhich.lpp | identify nearest neighbours |
pairdist.lpp | pairwise shortest-path distances |
plot.lpp | plot point pattern on linear Network |
points.lpp | draw points on existing plot |
superimpose.lpp | superimpose several point patterns |
text.lpp | add text labels |
unstack.lpp | separate multiple columns of marks |
Pixel images on a network
An object of class "linim"
represents a pixel image
on a linear network. Effectively, the network is divided into small
segments (lixels) and each small segment is assigned a value,
which could be numeric, factor, logical or complex values.
Pixel images on a network can be created using the following functions:
linim | create pixel image on linear network |
as.linim | convert other data to pixel image on network |
Functions for manipulating a pixel image on a network include:
[.linim | extract subset of pixel image on linear network |
[<-.linim | reset values in subset of image on linear network |
Math.linim | S3 group generic methods for images on a linear network |
eval.linim | evaluate expression involving pixel images on linear network |
as.linnet.linim | extract linear network |
integral.linim | integral of pixel image on a linear network |
mean.linim | mean of pixel values |
median.linim | median of pixel values |
quantile.linim | quantiles of pixel values |
as.data.frame.linim | convert to data frame |
print.linim | print basic information |
summary.linim | print summary information |
affine.linim | apply affine transformation |
scalardilate.linim | apply scalar dilation |
shift.linim | apply vector translation |
pairs.linim | scatterplot matrix for images |
persp.linim | perspective view of pixel image on network |
plot.linim | plot pixel image on linear network |
Functions on a linear network
An object of class "linfun"
represents a function defined
at any location along the network. Objects of this class are created
by the following functions:
linfun | create function on a linear network |
as.linfun | convert other data to function on network |
The following supporting code is available:
print.linfun | print basic information |
summary.linfun | print summary information |
plot.linfun | plot function on network |
persp.linfun | perspective view of function on network |
as.data.frame.linfun | convert to data frame |
as.owin.linfun | extract window containing network |
as.function.linfun | convert to ordinary R function |
Tessellations of a linear network
An object of class "lintess"
represents a tessellation of the
network, that is, a subdivision of the network into disjoint subsets
called ‘tiles’. Objects of this class are created
by the following functions:
lintess | create tessellation of network |
chop.linnet | divide a linear network into tiles using infinite lines |
divide.linnet | divide linear network at cut points |
lineardirichlet | Dirichlet tessellation on a linear network |
The following functions are provided for manipulating a tessellation on a network:
as.data.frame.lintess | convert to data frame |
intersect.lintess | intersection of two tessellations on network |
lineartileindex | determine which tile contains each given point on network |
marks.lintess | extract marks of each tile |
marks<-.lintess | assign marks to each tile |
plot.lintess | plot tessellation on network |
tile.lengths | compute lengths of tiles |
tilenames.lintess | names of tiles |
as.linfun.lintess | convert tessellation to a function |
Smoothing a point pattern on a linear network:
Given a point pattern dataset on a linear network, it is often desired to estimate the spatially-varying density or intensity of points along the network. For example if the points represent road accidents, then we may wish to estimate the spatially-varying density of accidents per unit length (over a given period of time).
Related tasks include estimation of relative risk, and smoothing of of values observed at the data points.
density.lpp | kernel estimate of intensity |
densityEqualSplit | kernel estimate of intensity using equal-split algorithm |
densityHeat.lpp | kernel estimate of intensity using heat equation |
densityQuick.lpp | kernel estimate of intensity using a 2D kernel |
densityVoronoi.lpp | intensity estimate using Voronoi-Dirichlet Tessellation |
densityfun.lpp | kernel estimate of intensity as a function |
bw.lppl | Bandwidth selection for kernel estimate of intensity |
bw.voronoi | bandwidth selection for Voronoi estimator |
relrisk.lpp | kernel estimate of relative risk |
bw.relrisk.lpp | Bandwidth selection for relative risk |
Smooth.lpp | spatial smoothing of observations at points |
Exploration of dependence on a covariate:
Another task is to investigate how the spatially-varying intensity
of points depends on an explanatory variable (covariate). The
covariate may be given as a pixel image on the network
(class "linim"
) or
as a function on the network (class "linfun"
).
rhohat.lpp | nonparametric estimate of intensity as function of a covariate |
roc.lpp | Receiver Operating Characteristic for data on a network |
auc.lpp | Area Under ROC Curve for data on a network |
cdf.test.lpp | spatial distribution test for points on a linear network |
berman.test.lpp | Berman's tests for point pattern on a network |
sdr.lpp | Sufficient Dimension Reduction for a point pattern on a linear network |
Summary statistics for a point pattern on a linear network:
These are for point patterns on a linear network (class lpp
).
For unmarked patterns:
linearK |
K function on linear network |
linearKinhom |
inhomogeneous K function on linear network |
linearpcf | pair correlation function on linear network |
linearpcfinhom | inhomogeneous pair correlation on linear network |
linearJinhom |
inhomogeneous J function on linear network |
linearKEuclid |
K function on linear network using Euclidean distance |
linearKEuclidInhom |
inhomogeneous K function on linear network using Euclidean distance |
linearpcfEuclid | pair correlation function on linear network using Euclidean distance |
linearpcfEuclidInhom | inhomogeneous pair correlation on linear network using Euclidean distance |
For multitype patterns:
linearKcross |
K function between two types of points |
linearKdot |
K function from one type to any type |
linearKcross.inhom |
Inhomogeneous version of linearKcross |
linearKdot.inhom |
Inhomogeneous version of linearKdot |
linearmarkconnect | Mark connection function on linear network |
linearmarkequal | Mark equality function on linear network |
linearpcfcross | Pair correlation between two types of points |
linearpcfdot | Pair correlation from one type to any type |
linearpcfcross.inhom |
Inhomogeneous version of linearpcfcross |
linearpcfdot.inhom |
Inhomogeneous version of linearpcfdot
|
Related facilities:
pairdist.lpp | distances between pairs |
crossdist.lpp | distances between pairs |
nndist.lpp | nearest neighbour distances |
nncross.lpp | nearest neighbour distances |
nnwhich.lpp | find nearest neighbours |
nnfun.lpp | find nearest data point |
density.lpp | kernel smoothing estimator of intensity |
distfun.lpp | distance transform |
envelope.lpp | simulation envelopes |
rpoislpp | simulate Poisson points on linear network |
runiflpp | simulate random points on a linear network |
It is also possible to fit point process models to lpp
objects.
Point process models on a linear network:
An object of class "lpp"
represents a pattern of points on
a linear network. Point process models can also be fitted to these
objects. Currently only Poisson models can be fitted.
lppm | point process model on linear network |
anova.lppm | analysis of deviance for |
point process model on linear network | |
envelope.lppm | simulation envelopes for |
point process model on linear network | |
fitted.lppm | fitted intensity values |
predict.lppm | model prediction on linear network |
data.lppm | extract original data |
berman.test.lppm | Berman's tests of goodness-of-fit |
is.marked.lppm | Recognise whether model is marked |
is.multitype.lppm | Recognise whether model is multitype |
is.stationary.lppm | Recognise whether model is stationary |
model.frame.lppm | Extract the variables in model |
model.images.lppm | Compute images of constructed covariates |
model.matrix.lppm | Extract design matrix |
plot.lppm | Plot fitted point process model |
pseudoR2.lppm | Calculate Pseudo-R-Squared for model |
simulate.lppm | simulate fitted point process model |
This library and its documentation are usable under the terms of the "GNU General Public License", a copy of which is distributed with the package.
Ottmar Cronie, Tilman Davies, Greg McSwiggan and Suman Rakshit made substantial contributions of code.
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.