fitBySampling {hydromad}R Documentation

Fit a hydromad model by sampling the parameter space.

Description

Fit a hydromad model by sampling the parameter space. Returns best result from sampling in parameter ranges using random, latin hypercube sampling, or a uniform grid (all combinations). The function also retains the parameter sets and objective function values, which can be used to define a feasible parameter set

Usage

fitBySampling(MODEL, objective = hydromad.getOption("objective"),
              samples = hydromad.getOption("fit.samples"),
              sampletype = c("latin.hypercube", "random", "all.combinations"))

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.

samples

number of parameter sets to test.

sampletype

sampling scheme – see parameterSets.

Details

See parameterSets.

Value

the best model from those sampled, according to the given objective function.

Author(s)

Felix Andrews felix@nfrac.org

See Also

fitByOptim, parameterSets, objFunVal

Examples


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

## IHACRES CWI model with armax unit hydrograph fitted by least squares
modx <- hydromad(x, sma = "cwi", routing = "armax", rfit = "ls")
modx

foo <- fitBySampling(modx)

summary(foo)

## plot objective function value improvement over time
xyplot(optimtrace(foo), type = "b",
  xlab = "function evaluations", ylab = "objective fn. value")
[Package hydromad version 0.9-18 Index]