13 April 2014

[R] Try out Armax and Expuh Routing

Try out Armax and Expuh Routing

Try out Armax and Expuh Routing

This code is based on:

  • Hydromad Tutorial by Felix Andrews
  • Willem Vervoort class (LWSC3007)
  • Discussion in Hydromad User Groups

Using armax

Code

ckpModel.armax <- hydromad(ts.cal,sma="cmd",routing="armax", 
                           rfit=list("sriv", order=c(n=2,m=1)))
ckpFit.armax <- fitByOptim(ckpModel.armax, samples=100, method="PORT")
summary(ckpFit.armax)
print(ckpFit.armax)
xyplot(ckpFit.armax, with.P=TRUE, type=c("l","g")) 

Results Summary

Call:
hydromad(DATA = ts.cal, tau_s = c(5, 100), tau_q = c(0, 5), v_s = c(0, 
    1), sma = "cmd", routing = "armax", rfit = list("sriv", order = c(n = 2, 
    m = 1)), f = 0.342265, e = 1.24435, d = 539.901)

Time steps: 631 (3 missing).
Runoff ratio (Q/P): (3.941 / 9.398) = 0.4194
rel bias: -0.07458
r squared: -0.3214
r sq sqrt: -0.3921
r sq log: -0.4041

print

Hydromad model with "cmd" SMA and "armax" routing:
Start = 2007-01-01, End = 2008-12-31

SMA Parameters:
       f         e         d     shape  
  0.3423    1.2444  539.9013    0.0000  
Routing Parameters:
     a_1       a_2       b_0       b_1     delay  
 1.92278  -0.92388  -0.01885   0.01995   2.00000  
TF Structure: S + Q (two stores in parallel)
    Poles:0.9415, 0.9813 

Fit: ($fit.result)
fitByOptim(MODEL = ckpModel, method = "PORT", samples = 100)
     173 function evaluations in 22.49 seconds 

Routing fit info:  list(converged = FALSE, iteration = 12) 

Message: false convergence (8) 

plot armax

Using expuh

Code

ckpModel.expuh <- hydromad(ts.cal,sma="cwi",routing="expuh",
                           tau_s=c(5,100),tau_q=c(0,5),v_s=c(0,1))
ckpFit.expuh <- fitByOptim(ckpModel.expuh, samples=100, method="PORT")
summary(ckpFit.expuh)
print(ckpFit.expuh)
xyplot(ckpFit.expuh, with.P=TRUE, type=c("l","g")) 

Results summary

all:
hydromad(DATA = ts.cal, tau_s = 100, tau_q = 1.60298, v_s = 0.921673, 
    sma = "cwi", routing = "expuh", tw = 6.42525, f = 8, scale = 0.00548436)

Time steps: 631 (1 missing).
Runoff ratio (Q/P): (3.947 / 9.38) = 0.4208
rel bias: 1.058e-16
r squared: -0.1464
r sq sqrt: -0.1787
r sq log: -0.1894

For definitions see ?hydromad.stats

print

Hydromad model with "cwi" SMA and "expuh" routing:
Start = 2007-01-01, End = 2008-12-31

SMA Parameters:
       tw          f      scale          l          p      t_ref  
 6.425251   8.000000   0.005484   0.000000   1.000000  20.000000  
Routing Parameters:
   tau_s     tau_q       v_s  
100.0000    1.6030    0.9217  
TF Structure: S + Q (two stores in parallel)
    Poles:0.5359, 0.99 

Fit: ($fit.result)
fitByOptim(MODEL = ckpModel.expuh, method = "PORT", samples = 100)
     204 function evaluations in 18.28 seconds 

plot expuh:


which one is the best fit?

No comments: