evalPars {hydromad}R Documentation

Utility functions to evaluate a model for a matrix of parameters

Description

evalPars evaluates a model for a named matrix of parameters. To help sample parameters, getFreeParsRanges returns the list of ranges of parameters that do not have fixed parameter values.

Usage

evalPars(par.matrix, object, objective = hydromad.getOption("objective"))
getFreeParsRanges(object)

Arguments

par.matrix

Named matrix or data.frame of parameter values, with each row corresponding to a model realisation to evaluate

object

an object of class hydromad.

objective

the objective function or expression, which can refer to Q and X. See objFunVal.hydromad

Details

The functions are used with the sensitivity package to perform sensitivity analysis. See demo(sensitivity). Note that the objective function may more generally return any scalar result, e.g. a scalar prediction calculated only using X.

Value

evalPars returns a vector of objective function values, corresponding to the evaluation of each row of par.matrix.

getFreeParsRanges returns a named list of parameter ranges, for each parameter that does not have fixed parameter values.

Author(s)

Joseph Guillaume

See Also

objFunVal.hydromad, parameterSets

Examples

data(Cotter)
obs<-Cotter[1:1000]
modx <- hydromad(obs, sma = "cwi", routing = "expuh",
tau_s = c(2,100), v_s = c(0,1))

## Sample 10 random parameters
pars<- parameterSets(getFreeParsRanges(modx),10,method="random")

## Return the default objective function value for each model realisation
evalPars(pars,object=modx)

## Calculate the 20%ile flow for each model realisation
evalPars(pars,object=modx,objective=~quantile(X,0.2))
[Package hydromad version 0.9-18 Index]