armax.ls.fit {hydromad}R Documentation

Estimate transfer function models by Least Squares.

Description

Calibrate unit hydrograph transfer function models (armax or expuh) using Least Squares with prefiltering.

Usage

armax.ls.fit(DATA,
             order = hydromad.getOption("order"),
             delay = hydromad.getOption("delay"),
             prefilter = hydromad.getOption("prefilter"),
             warmup = hydromad.getOption("warmup"),
             normalise = FALSE,
             fixed.ar = NULL,
             weights = NULL,
             initX = TRUE,
             na.action = na.pass,
             trace = hydromad.getOption("trace"))

expuh.ls.fit(DATA,
             order = hydromad.getOption("order"),
             delay = hydromad.getOption("delay"),
             quiet = FALSE,
             ...)

Arguments

DATA

a ts-like object with named columns:

U

observed input time series.

Q

observed output time series.

order

the transfer function order. See armax.

delay

delay (lag time / dead time) in number of time steps. If missing, this will be estimated from the cross correlation function.

prefilter
warmup
normalise
fixed.ar
weights
initX
na.action
trace
...

passed on to armax.ls.fit.

quiet

to suppress the message when re-fitting if non-physical poles (i.e. negative or imaginary poles) are detected.

Details

In normal usage, one would not call these functions directly, but rather specify the routing fitting method for a hydromad model using that function's rfit argument. E.g. to specify fitting an expuh routing model by least squares one could write

hydromad(..., routing = "expuh", rfit = "ls")

which uses the default order, hydromad.getOption("order"), or

hydromad(..., routing = "expuh", rfit = list("ls", order = c(2,1))).

Value

a tf object, which is a list with components

coefficients

the fitted parameter values.

fitted.values

the fitted values.

residuals

the residuals.

delay

the (possibly fitted) delay time.

Author(s)

Felix Andrews felix@nfrac.org

References

Jakeman

See Also

armax, expuh, armax.sriv.fit, arima

Examples

U <- ts(c(0, 0, 0, 1, rep(0, 30), 1, rep(0, 20)))
Y <- expuh.sim(lag(U, -1), tau_s = 10, tau_q = 2, v_s = 0.5, v_3 = 0.1)
set.seed(0)
Yh <- Y * rnorm(Y, mean = 1, sd = 0.2)
fit1 <- armax.ls.fit(ts.union(U = U, Q = Yh),
                     order = c(2, 2), warmup = 0)
fit1
xyplot(ts.union(observed = Yh, fitted = fitted(fit1)),
       superpose = TRUE)
[Package hydromad version 0.9-18 Index]