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

Calculate Autocorrelation Coefficient for Stream Segment Attribute

Description

Compute the autocorrelation coefficient of an attribute for a specified separation distance (lag) between stream segments.

Usage

  net.autocorr.onelag (net, dist, segatt, lag=1, eps=1e-6)

Arguments

net A net.object.
dist an upstream/downstream distance matrix from net.dist, probably using ends=0.5, and possibly using method="segment".
segatt attribute associated with each segment. If segatt is a character vector of length one, then get attribute from net$segs$segatt, else assume segatt is a numeric vector of length equal to number of segments and in correct order.
lag separation distance (in method units) at which to calculate coefficient.
eps precision of calculating lag.

Details

Uses total distances, ignoring upstream/downstream. The algorithm for autocorrelation coefficients, 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

A list with the following components:
r autocorrelation coefficient
num number of pairs used

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 net.autocorr.att net.correlogram

Examples

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

  # make rnorm and autocorrelated attributes
  att.rnorm <- net.addatt (net, dist="Normal",
    boundscaling=TRUE, vector=TRUE)
  att.autoc <- net.autocorr.att (net, dist=dmat, vector=TRUE,
    outscaling=TRUE) * 10

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

[Package stream.net version 1.0.6 Index]