hydromad.stats {hydromad} | R Documentation |
These functions provide access to a built-in set of statistics, and
also allow the user to change or add named statistics.
Its usage is similar to hydromad.options
.
hmadstat(name, DATA = NULL, Q = DATA[,"Q"]) hydromad.stats(...)
name |
character giving the name of a statistic. |
DATA, Q |
If either |
... |
new stats can be defined, or existing ones modified, using one or more arguments of the form 'name = value' or by passing a list of such tagged values. Existing values can be retrieved by supplying the names (as character strings) of the components as unnamed arguments. |
hmadstat
returns the named statistical function, while
hydromad.stats
gets or sets a list of named functions.
The default set of available statistics can be listed with
str(hydromad.stats())
, and consists of:
the mean absolute error.
Root Mean Squared Error.
bias in data units, ∑ ( X - Q )
bias as a fraction of the total observed flow, ∑ ( X - Q ) / ∑ Q (excluding any time steps with missing values).
R Squared (Nash-Sutcliffe Efficiency), 1 - ∑ (Q - X)^2 / ∑ (Q - \bar{Q})^2
R Squared using square-root transformed data (less weight on peak flows), 1 - \frac{∑ |√{Q} - √{X}|^2 }{ ∑ |√{Q} - \bar{√{Q}}|^2 }
R Squared using log transformed data, with an offset: 1 - \frac{∑ |\log{(Q+ε)} - \log{(X+ε)}|^2 } {∑ |\log{(Q+ε)} - \bar{\log{(Q+ε)}}|^2 }. Here ε is the 10 percentile (i.e. lowest decile) of the non-zero values of Q.
R Squared using a Box-Cox transform. The power lambda is chosen to fit Q to a normal distribution. When lambda = 0 it is a log transform; otherwise it is y_* = \frac{(y+ε)^λ - 1}{λ} Here ε is the 10 percentile (i.e. lowest decile) of the non-zero values of Q.
R Squared using differences between successive time steps, i.e. rises and falls.
R Squared with data aggregated into calendar months.
R Squared using data smoothed with a triangular kernel of width 5
time steps: c(1,2,3,2,1)/9
.
R Squared where the reference model is the mean in each calendar month, rather than the default which is the overall mean.
nseVarTd
R Squared where the modelled peaks have been coalesced to observed
peaks, minimising timing error. Note that this statistic requires event
to be
specified using eventseq
R Squared where the reference model predicts each time step as the previous observed value. This statistic therefore represents a model's performance compared to a naive one-time-step forecast.
correlation of modelled flow with the model residuals.
correlation of modelled flow with the model residuals from the previous time step.
Average Relative Parameter Error. Requires that a variance-covariance matrix was estimated during calibration.
buildTsObjective
,
nseStat
,
objFunVal
,
summary.hydromad
## see current set of stats names(hydromad.stats()) ## extract only one hmadstat("RMSE") ## calculate stat value with random data hmadstat("rel.bias")(Q = 1:10, X = 2:11) ## add a new objective function. ## A weighted combination of NSE and bias ## as proposed by Neil Viney ## OF = NSE â€“ 5*|ln(1+Bias)|^2.5 hydromad.stats("viney" = function(Q, X, ...) { hmadstat("r.squared")(Q, X, ...) - 5*(abs(log(1+hmadstat("rel.bias")(Q,X)))^2.5) })