lnres_sim: Simulate a water quality time series

View source: R/lnres_sim.R

lnres_simR Documentation

Simulate a water quality time series

Description

Simulate a water quality time series with an estimated error structure and simulated discharge effect

Usage

lnres_sim(dat_in, lnQ_coef = NULL)

Arguments

dat_in

input data.frame that must include estimated error and simulated discharge time series, see lnres_err and lnQ_sim respectively

lnQ_coef

numeric vector of coefficients of the same length of the time series in dat_in that is multiplied by the discharge vector, see details

Details

This function creates a simulated water quality time series and requires error estimates for an observed water quality dataset and a simulated discharge time series. The water quality time series is created as the additive combination of a seasonal, stationary time component (as in lnQ_sim for discharge), a random error component from lnres_err, and a simulated discharge time series from lnQ_sim. The discharge time series is considered an explicit component of the water quality time series and is first centered at zero prior to adding. The optional vector of coefficients passed to lnQ_coef can mediate the influence of discharge on the water quality time series. For example, a vector of all zeroes implies no effect, whereas a vector of all ones implies a constant effect (default).

Value

The original data frame with additional columns for the seasonal water quality model (lnres_seas), a flow-independent water quality time series (lnres_noQ), and a flow-dependent time series (lnres_Q).

See Also

daydat for the format of an input dataset, lnQ_sim for simulating discharge, and lnres_err for estimating the error distribution of the water quality time series, all_sims for completing all steps at once.

Examples

## Not run: 
## example data
data(daydat)

## get simulated discharge
sims <- lnQ_sim(daydat)

## get error structure of wq time series
sims <- lnres_err(sims)

## get simulated wq time series using results from previous
lnres_sim(sims)

## End(Not run)

WRTDStidal documentation built on Oct. 20, 2023, 5:08 p.m.