hysteresis: Compute Hysteresis

View source: R/hysteresis.R

hysteresisR Documentation

Compute Hysteresis

Description

Compute a basis for estimating hysteresis effects in some variable related to the argument x.

Usage

hysteresis(x, step = 3)

Arguments

x

the sequence of observations. Missing values are permitted and will be copied in the output.

step

the number of previous observations to use to compute the local mean. See Note.

Value

A numeric vector that approximates the local trend in x.

Note

The basis for estimating hysteresis is the current value x minus the mean of the previous step values. The first step values in the output will be missing, and each missing value will result in step plus 1 missing values. This approximates the trend in x; if x is increasing in value over the previous step values, then the output will be positive and the greater the relative increase, the larger the output.

References

The use of hysteresis to help model the relations between stream water chemistry and flow are described in:

Garrett, J.D., 2012, Concentrations, loads, and yields of select constituents from major tributaries of the Mississippi and Missouri Rivers in Iowa, water years 2004-2008: U.S. Geological Survey Scientific Investigations Report 2012–5240, 61 p.

Wang, P., and Linker, L.C., 2008, Improvement of regression simulation in fluvial sediment loads: Journal of Hydraulic Engineering, v. 134, no. 10, p. 1,527–1,531.

See Also

anomalies

Examples

## Not run: 
library(smwrData)
data(Q05078770)
# Plot flow and hysteresis to show looping 
with(Q05078770, plot(log(FLOW), hysteresis(log(FLOW), 3), type="l"))

## End(Not run)

USGS-R/smwrBase documentation built on Oct. 18, 2022, 9:55 a.m.