Find bounds on parameters within which a threshold of performance is satisfied by solving objective(single.par)=thres using univariate line searches for the lower and upper bounds of each parameter.

findUnivariateBounds(
  modx,
  fitx,
  thres,
  objective = hydromad.getOption("objective")
)

Arguments

modx

a model specification created by hydromad. It should not be fully specified, i.e one or more parameters should be defined by ranges of values rather than exact values.

fitx

a best guess model with fully specified parameters. This will be used as one end point for a line search

thres

Minimum threshold on objective, defining a feasible region. Should be less than objFunVal(fitx,objective=objective)

objective

objective function used to determine feasible region, given as a function(Q, X, ...). See objFunVal.

Value

A named list of bounds for each free parameter in modx.

Details

This is intended as a heuristic method for identifying feasible bounds. It may not work as desired in some cases.

Errors may be produced by uniroot of the type f() values at end points not of opposite sign. This indicates that no parameter value could be found that has an objective value equal to thres. In that case, the relevant bound is kept unchanged as specified in modx.

Errors of the type lower < upper is not fulfilled occur if the parameters of fitx are at the boundaries specified in modx. This error can usually be ignored, though it suggests that the fitx parameter estimation could perhaps be improved.

See also

runRSM which requires narrowed bounds

Author

Joseph Guillaume

Examples


data(Cotter)
x <- Cotter[1:1000]

## IHACRES CWI model with exponential unit hydrograph
## an unfitted model, with ranges of possible parameter values
modx <- hydromad(x,
  sma = "cwi", routing = "expuh",
  tau_s = c(2, 100), v_s = c(0, 1)
)

## Best fit, used as initial feasible solution
fitx <- fitByOptim(modx)

## Identify bounds
thres <- objFunVal(fitx) - 0.05 ## Look for models within 0.05 of best fit
bounds <- findUnivariateBounds(modx, fitx, thres)
#> Error in uniroot(function(val) { : lower < upper  is not fulfilled
#> Error in uniroot(function(val) { : 
#>   f() values at end points not of opposite sign
#> Error in uniroot(function(val) { : 
#>   f() values at end points not of opposite sign

## Create model object with the new bounds
modx2 <- update(modx, newpars = bounds)

bounds
#> $tw
#> [1]  54.19314 100.00000
#> 
#> $f
#> [1] 2.560102 8.000000
#> 
#> $tau_s
#> [1] 12.73112 46.55389
#> 
#> $v_s
#> [1] 0.7606208 1.0000000
#> 
modx2
#> 
#> Hydromad model with "cwi" SMA and "expuh" routing:
#> Start = 1966-05-01, End = 1969-01-24
#> 
#> SMA Parameters:
#>       lower upper     
#> tw    54.19   100     
#> f      2.56     8     
#> scale    NA    NA     
#> l      0.00     0 (==)
#> p      1.00     1 (==)
#> t_ref 20.00    20 (==)
#> Routing Parameters:
#>         lower upper  
#> tau_s 12.7311 46.55  
#> v_s    0.7606  1.00