seasonalWave: Seasonal Wave

View source: R/seasonalWave.R

seasonalWaveR Documentation

Seasonal Wave

Description

Computes a seasonal wave model to describe the variation of a constituent over the course of a year. This model is particularly well suited to describe the concentration of pesticides.

Usage

seasonalWave(x, cmax, loading, hlife, second.peak = NULL)

Arguments

x

a vector of decimal time representing dates. Missing values (NAs) are permitted.

cmax

the time of the greatest peak value, expressed as a fraction of the year.

loading

the number of months of contituent loading for the primary peak.

hlife

the half life of the decay rate, expressed in units of months. This should be in the range of 1 though 4.

second.peak

a list of the parameters for the second peak. See Details.

Details

The seasonal wave model W(t) is expressed as a differential equation

dW(t)/dt = λ(t) - φ W(t) [0 ≤ t ≤ 1, W(0)=W(1)]

dW(t)/dt = λ(t) - φ W(t) [0 ≤ t ≤ 1, W(0)=W(1)]

λ(t) = ∑ ω_k I((k-1)/12 ≤ t < k/12)

λ(t) = ∑ ω_k I((k-1)/12 ≤ t < k/12)

where φ is a specified constant, which represents the rate of removal or chemical decay; [ω_k, k=1,2,...,12] are specified nonnegative constants, which represent monthly input amounts; I(.) is the indicator function with I(.)=1 if t lies in the given interval and I(.)=0 otherwise; and λ(t) is the input amount at time t.

The value of hlife is used to define the decay rate φ in the differential equation. The value of φ is 12/hlife and W(t) decays at a a rate of exp(-φ/12) per month.

The list for second.peak must contain these components:
la, the lag from the primary peak to the second peak, in months. This is always the time from the primary peak to the second peak, even if the second peak occurs earlier in the year.
lo, the loading duration in months, this value must be leas than la. w, the load scaling factor relative to the primary peak. Must be greater than 0 and less than or equal to 1. For practical pruposes, it should be greater than 0.5.

Value

A vector expressing the expected variation of concentration for each value in x; the values are scaled to a range of -0.5 to 0.5.

Author(s)

Dave Lorenz, original coding by Aldo Vecchia.

References

Vecchia, A.V., Martin, J.D., and Gilliom, R.J., 2008, Modeling variability and trends in pesticide concentrations in streams: Journal of the American Water Resources Association, v. 44, no. 5, p. 1308-1324.

See Also

seasonalPeak, confirm.seasonalPeak

Examples

## Not run: 
# Selected single peak models
# 1 month loading, 1 month half-life
curve(seasonalWave(x, 3/12, 1, 1), 0, 1, n=361, xlab='fraction of year', ylab="W")
# 1 month loading, 3 month half-life
curve(seasonalWave(x, 3/12, 1, 3), 0, 1, n=361, add=TRUE, col="blue")
# 3 month loading, 2 month half-life
curve(seasonalWave(x, 3/12, 3, 2), 0, 1, n=361, add=TRUE, col="green")
# Add a second peak model
curve(seasonalWave(x, 3/12, 3, 2, second.peak=list(la=6, lo=2, w=.75) ), 0, 1,
  n=361, add=TRUE, col="red")

## End(Not run)

USGS-R/smwrStats documentation built on Oct. 11, 2022, 6:15 a.m.