lnQ_sim: Simulate a discharge time series

View source: R/lnQ_sim.R

lnQ_simR Documentation

Simulate a discharge time series

Description

Simulate a discharge time series by modelling the statistical properties of an existing daily time series

Usage

lnQ_sim(dat_in, comps = FALSE, seed = NULL)

Arguments

dat_in

input data.frame that must include discharge and decimal time columns, see example dataset daydat

comps

logical indicating if components of the simulated time series are returned, see value.

seed

optional numeric value for random generation seed

Details

Daily flow data are simulated as the additive combination of a stationary seasonal component and serially-correlated errors estimated from the observed data. The stationary seasonal component is based on a seasonal regression of discharge over time. The residuals from this regression are used to estimate the error distribution using an ARIMA model. Parameters of the ARIMA model are chosen using stepwise estimation for nonseasonal univariate time series with the auto.arima function. Random errors from a standard normal distribution for the length of the original time series are generated using the model estimates with the arima.sim function. Finally, the errors are multiplied by the standard deviation of the original residuals and added to the seasonal component to create a simulated, daily log-flow time series.

Value

The original data frame with an additional column of simulated data named lnQ_sim if comps = FALSE. Otherwise, a two-element list is returned where the first element is 1) a list with the linear seasonal model fit to the observed time series and ARIMA model fit to the seasonal residuals, and 2) a data frame with the original data, the fit from the seasonal linear model (seas_fit), residuals from observed flow and seasonal fit (seas_res), standard deviation of seasonal residuals (sd_seas), simulated errors from the ARIMA model (errs), and simulated discharge time series (sim_out). Note that sim_out vector is converted to the same range as the input flow record.

See Also

daydat

Examples


## example data
data(daydat)

## simulate
lnQ_sim(daydat)


fawda123/WRTDStidal documentation built on Oct. 22, 2023, 11:28 p.m.