bern.length {streamDAG}R Documentation

Botter and Durighetto Bernoulli stream length

Description

A simple function for calculating the dot product of a vector of stream arc lengths and a corresponding vector of either binary (stream presence or absence) outcomes, probabilities of stream presence or inverse probabilites of stream presence.

Usage

bern.length(lengths, pa, mode = "local")

Arguments

lengths

A numeric vector of stream arc lengths

pa

A numeric vector of either binary (stream presence or absence) outcomes, probabilities of stream presence or inverse probabilites of stream presence. A vector outcome in lengths should correspond to an outcome for the same arc in pa.

mode

One of "local" of "global"

Value

When pa is a vector of binary (stream presence or absence) data, the function provides a measure of instantaneous stream length (in the units used in lengths). When pa is a vector of probabilities of stream presence, the function provides average stream length (in units used in lengths). When pa is a vector of inverse probabilites of stream presence, the function provides average communication distance (in units used in lengths).

Author(s)

Ken Aho

References

Botter, G., & Durighetto, N. (2020). The stream length duration curve: A tool for characterizing the time variability of the flowing stream length. Water Resources Research, 56(8), e2020WR027282.

Examples

lengths <- rexp(10, 10)
pa <- rbinom(10, 11, 0.4)
bern.length(lengths, pa)

[Package streamDAG version 1.5 Index]