Design functions | R Documentation |
Functions to generate points on a network.
binomialDesign(n, replications=1, rep.variable = "Time", rep.values) poissonDesign(lambda, replications=1, rep.variable = "Time", rep.values) hardCoreDesign(n, inhibition_region, replications=1, rep.variable = "Time", rep.values) systematicDesign(spacing, replications=1, rep.variable = "Time", rep.values) noPoints
n |
A numeric vector having length 1 or the same length as the number of networks. This represents the number of points to be spread across a network. |
lambda |
A numeric vector having length 1 or the same length as the number of networks. This represents the rate at which points occur on a network. |
inhibition_region |
A numeric vector having length 1 or the same length as the number of networks. This represents the size of the inhibition region on a network. |
spacing |
A numeric vector having length 1 or the same length as the number of networks. This represents the desired spacing for the regular grid of points. |
replications |
The number of replications of each point. |
rep.variable |
The name of the variable that will distinguish between the replicated points. |
rep.values |
The values that will be given to the variable named |
These design functions are intended to be used in the obsDesign
or predDesign
inputs of the createSSN function. The binomialDesign
function represents a binomial process - A number n[i]
of points are distributed randomly and uniformly across network i
(or n
points if n
is a single number).
The poissonDesign
function represents a poisson process, where points occur at rate lambda[i]
on network i
(or lambda
if lambda
is a single number).
The hardCoreDesign
function represents a hard-core process where n[i]
(or n
if n
has length 1) points are distributed uniformly and randomly on network i
, and then points are removed until all points are at least inhibition_region[i]
distant from each other (or inhibition_region
if inhibition_region
has length 1).
The systematicDesign
function gives a deterministic and regular set of points. Starting from the outlet points are placed upwards along the network, at a fixed distance from the previous point. Note that while the generated grids are regular in a certain sense, they can appear non-regular at certains points from visual inspection. This is because it is impossible to generate a grid of truly equal-spaced points on a network.
The noPoints function simply generates zero points across all networks. Note that this cannot be used as the design for the observed points as there must be at least one observed point. Also this is used directly without any parameters, unlike the other design functions.
A design function must have the form
function(tree.graphs, edge_lengths, locations, edge_updist, distance_matrices)
All inputs to the design function are lists of length n
where n
is the number of trees. Input tree.graphs[[i]]
is
an object of class igraph
which represent the ith generated network
in a graph theoretic sense; without any specific locations assigned to the
vertices. edge_lengths[[i]]
contains the lengths of the edges for the
ith tree, in the same order as the edges appear in the corresponding
igraph
object. Input locations[[i]]
is a matrix with
n[i]
rows and 2 columns giving the locations of the points on that
network. edge_updist[[i]]
is a numeric vector which gives the upstream
distance from the downstream point of every stream segment, in the same order
as these edges appear in the corresponding igraph
object.
distance_matrices[[i]]
is a matrix with n[i]
rows and columns,
giving the network distance between the downstream points of a pair of edges,
where the edges are ordered in the same way as in the igraph
object.
To summarise, on tree number i
if edge number k
has downstream
point k_
and edge number l
has downstream point l_
then edge_lengths[[i]][k]
gives the length of edge number k
,
edge_updist[[i]][k]
gives the distance from point k_
to the
outlet of the stream network, and distance_matrices[[i]][k, l]
gives
the network distance between points k_
and l_
. Note that some
of these inputs may have associated row or column names, but these should be
ignored.
A design function having the signature mentioned above.
Rohan Shah support@SpatialStreamNetworks.com
createSSN
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.