Assess and summarise performance of Hydromad models.

# S3 method for hydromad
summary(
  object,
  breaks = NULL,
  stats = hydromad.getOption("summary.stats"),
  with.hydrostats = TRUE,
  na.action = na.exclude,
  ...
)

Arguments

object

an object of class hydromad.

breaks

if specified, break up the time series and calculate statistics for each chunk. Can be a vector of cut points or number of intervals to cut into or an interval specification, one of "sec", "min", "hour", "day", "DSTday", "week", "month" or "year", optionally preceded by an integer and a space, or followed by "s". See cut.Date.

stats

which performance statistics to compute. The definitions are looked up by name in hydromad.stats(). See Details.

with.hydrostats

to also include timesteps, missing (number of timesteps with missing data), mean.P, mean.Q, runoff (mean rainfall and streamflow, and their ratio).

na.action

an optional function to apply to the data to treat missing values before calculating statistics.

...

ignored.

Value

summary returns a list with named entries for each of the chosen stats (stats). When breaks is given it retuns a zoo object of class "summaryWithBreaks".

Details

Definitions of statistics are looked up by name in hydromad.stats(), and you can also use that function to add new statistics.

See also

hydromad.stats, objFunVal for a way to calculate statistic values directly; hydromad.object

Author

Felix Andrews felix@nfrac.org

Examples



data(HydroTestData)
mod0 <- hydromad(HydroTestData,
  sma = "scalar",
  routing = "expuh", tau_s = 10
)
mod0
#> 
#> Hydromad model with "scalar" SMA and "expuh" routing:
#> Start = 2000-01-01, End = 2000-03-31
#> 
#> SMA Parameters:
#>  scale  
#> 0.6547  
#> Routing Parameters:
#> tau_s  
#>    10  
#> TF Structure: single store
#>     Poles:0.9048 

summary(mod0)
#> 
#> Call:
#> hydromad(DATA = HydroTestData, tau_s = 10, sma = "scalar", routing = "expuh")
#> 
#> Time steps: 621 (0 missing).
#> Runoff ratio (Q/P): (0.1831 / 0.2802) = 0.6534
#> rel bias: 1.392e-16
#> r squared: 0.4177
#> r sq sqrt: 0.3642
#> r sq log: 0.2247
#> 
#> For definitions see ?hydromad.stats
#> 

summary(mod0, breaks = "months")
#>                     timesteps missing    mean.P    mean.Q    runoff   rel.bias
#> 2000-01-13 12:00:00       148       0 0.2432432 0.1128348 0.4638763  0.4241800
#> 2000-02-01 00:00:00       232       0 0.2586207 0.1612431 0.6234734  0.0359378
#> 2000-03-01 00:00:00       241       0 0.3236515 0.2472549 0.7639542 -0.1414367
#> 2000-03-31 00:00:00       241       0 0.3236515 0.2472549 0.7639542 -0.1414367
#>                       r.squared   r.sq.sqrt    r.sq.log
#> 2000-01-13 12:00:00 -0.01514814 -0.04819688 -0.13236402
#> 2000-02-01 00:00:00  0.22608518  0.12255420 -0.02928841
#> 2000-03-01 00:00:00  0.54037122  0.63470299  0.65314990
#> 2000-03-31 00:00:00  0.54037122  0.63470299  0.65314990
# summary(mod0, breaks = 3)

allstats <- names(hydromad.stats())
## Ignore r.sq.vartd because it requires event to be specified
allstats <- setdiff(allstats, "r.sq.vartd")
summary(mod0, stats = allstats)
#> 
#> Call:
#> hydromad(DATA = HydroTestData, tau_s = 10, sma = "scalar", routing = "expuh")
#> 
#> Time steps: 621 (0 missing).
#> Runoff ratio (Q/P): (0.1831 / 0.2802) = 0.6534
#> bias: 2.548e-17
#> rel bias: 1.392e-16
#> abs err: 0.09716
#> RMSE: 0.1315
#> r squared: 0.4177
#> r sq sqrt: 0.3642
#> r sq log: 0.2247
#> r sq boxcox: 0.3153
#> r sq rank: 0.2178
#> r sq diff: -0.07959
#> r sq monthly: 0.8663
#> r sq 365: -0.2487
#> r sq smooth5: 0.433
#> r sq seasonal: 0.3533
#> r sq vs tf: -0.2006
#> r sq vs tf bc: -0.03552
#> persistence: -3.695
#> persistence bc: -5.374
#> e rain5: 0.2097
#> e rain5 log: -0.004917
#> e rain5 bc: 0.1546
#> e q90: 0.2527
#> e q90 log: 0.1087
#> e q90 bc: -19.56
#> e q90 all: -0.1166
#> e q90 all log: 0.3333
#> e q90 all bc: -3.687
#> e q90 min: -0.7851
#> e q90 min log: -0.3068
#> ar1: 0.8799
#> X0: -0.3082
#> X1: -0.2825
#> U1: -0.006029
#> KGE: 0.6784
#> viney: 0.4177
#> 
#> For definitions see ?hydromad.stats
#> 

objFunVal(mod0, hmadstat("r.sq.log"))
#> [1] 0.2246999

hydromad_stats <- hydromad.stats()
# Ignore r.sq.vartd because it requires event to be specified
hydromad_stats$r.sq.vartd <- NULL
str(objFunVal(mod0, hydromad_stats))
#> List of 35
#>  $ bias          : num 2.55e-17
#>  $ rel.bias      : num 1.39e-16
#>  $ abs.err       : num 0.0972
#>  $ RMSE          : num 0.131
#>  $ r.squared     : num 0.418
#>  $ r.sq.sqrt     : num 0.364
#>  $ r.sq.log      : num 0.225
#>  $ r.sq.boxcox   : num 0.315
#>  $ r.sq.rank     : num 0.218
#>  $ r.sq.diff     : num -0.0796
#>  $ r.sq.monthly  : num 0.866
#>  $ r.sq.365      : num -0.249
#>  $ r.sq.smooth5  : num 0.433
#>  $ r.sq.seasonal : num 0.353
#>  $ r.sq.vs.tf    : num -0.201
#>  $ r.sq.vs.tf.bc : num -0.0355
#>  $ persistence   : num -3.69
#>  $ persistence.bc: num -5.37
#>  $ e.rain5       : num 0.21
#>  $ e.rain5.log   : num -0.00492
#>  $ e.rain5.bc    : num 0.155
#>  $ e.q90         : num 0.253
#>  $ e.q90.log     : num 0.109
#>  $ e.q90.bc      : num -19.6
#>  $ e.q90.all     : num -0.117
#>  $ e.q90.all.log : num 0.333
#>  $ e.q90.all.bc  : num -3.69
#>  $ e.q90.min     : num -0.785
#>  $ e.q90.min.log : num -0.307
#>  $ ar1           : num 0.88
#>  $ X0            : num -0.308
#>  $ X1            : num -0.282
#>  $ U1            : num -0.00603
#>  $ KGE           : num 0.678
#>  $ viney         : num 0.418