fitBySCE {hydromad}R Documentation

Fit a hydromad model using the SCE (Shuffled Complex Evolution) algorithm.

Description

Fit a hydromad model using the SCE (Shuffled Complex Evolution) algorithm.

Usage

fitBySCE(MODEL, 
         objective = hydromad.getOption("objective"),
         control = hydromad.getOption("sce.control"),
         vcov = FALSE)

Arguments

MODEL

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.

objective

objective function to maximise, given as a function(Q, X, ...). See objFunVal.

control

settings for the SCE algorithm. See SCEoptim.

vcov

if vcov = TRUE, the parameter variance-covariance matrix will be estimated from the final population. It can be extract using vcov.

Value

the best model from those sampled, according to the given objective function. Also, these extra elements are inserted:

fit.result

the result from SCEoptim.

objective

the objective function used.

funevals

total number of evaluations of the model simulation function.

timing

timing vector as returned by system.time.

Author(s)

Felix Andrews felix@nfrac.org

See Also

SCEoptim, objFunVal

Examples

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

## IHACRES CWI model with power law unit hydrograph
modx <- hydromad(x, sma = "cwi", routing = "powuh")
modx

## run with cut-down settings (for a speedy example only!)
foo <- fitBySCE(modx, control = list(maxit = 5, ncomplex = 2))

summary(foo)

## return value from SCE:
str(foo$fit.result)

## plot objective function value convergence over time
xyplot(optimtrace(foo, raw = TRUE), screens = 1, type = "p",
  jitter.x = TRUE, ylim = c(0.7, NA), xlim = c(0, NA),
  xlab = "function evaluations", ylab = "objective fn. value") +
layer(panel.average(..., horiz = FALSE, fun = max, lwd = 2))
[Package hydromad version 0.9-18 Index]