Simulate a water quality time series with an estimated error structure and simulated discharge effect
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
Returns
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).
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).
Examples
## Not run:## example datadata(daydat)## get simulated dischargesims <- lnQ_sim(daydat)## get error structure of wq time seriessims <- lnres_err(sims)## get simulated wq time series using results from previouslnres_sim(sims)## End(Not run)
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.