net.autocorr.att {stream.net}R Documentation

Create Autocorrelated Attribute for Stream Segments

Description

Create a network autocorrelated attribute for stream segments.

Usage

  net.autocorr.att (net, dist, target=0.5, lag=1,
    outscaling=TRUE, min=0, max=1, eps=1e-6,
    vector=TRUE, name=NULL)

Arguments

net A net.object.
dist an upstream/downstream distance matrix from net.dist, probably using ends=0.5, and possibly using method="segment".
target goal for autocorrelation.
lag separation distance (in method units) at which to produce autocorrelation effect.
outscaling if TRUE, scale return values to [min, max].
min minimum value for scaling output values.
max maximum value for scaling output values.
eps precision of calculating lag distance.
vector if TRUE, return a vector else a field in $segs.
name name of the attribute to be added (if ! vector)).

Details

Uses total distances, ignoring upstream/downstream. The algorithm for calculating autocorrelation, from the reference below, is

r(x) = sum(2 * z[i] * z[j])/sum(z[i]^2 + z[j]^2)

for all segment pairs i,j at lag x. Values are in [-1, 1].

Value

If vector is TRUE, then a vector of the attribute values in segment order, else a net.object with the attribute added to $segs.

Author(s)

Denis White, white.denis@epa.gov

References

Henley S. 1975. Autocorrelation coefficients from irregularly spaced areal data. Computers and Geosciences 2(4):437-438.

See Also

net.object net.dist

Examples

  # Q model random net
  net <- net.qmodel (5)
  net <- net.addsegs (net)
  dmat <- net.dist (net, ends=0.5, method="segment")

  # make autocorrelated attributes
  att.autoc <- net.autocorr.att (net, dist=dmat, vector=TRUE,
    outscaling=TRUE) * 10

  # check autocorrelation
  net.autocorr.onelag (net, dist=dmat, segatt=att.autoc)

[Package stream.net version 1.0.6 Index]