
hydromodInR
hydromodInR.RdThis function runs an R-based model using a single parameter set taken from a matrix/data.frame with many parameter sets, or from a single named numeric vector.
This function is for internal use within the package, and it is only documented in case it be useful to other packages. See Details section for more information.
Arguments
- part
numeric, a single integer value indicating the row number in
param.valueswhich is used to select the parameter set used to run the model specified inmodel.FUN. Whenparam.valuesis a named numeric vector,partmust be equal to 1.- param.values
matrix/data.frame with all the parameter sets that can be used to run the model defined in
model.FUN, or a single named numeric vector with one parameter set.When
param.valuesis a matrix/data.frame, it has as many columns as parameters used by the model, and as many rows as parameter sets provided by the user inparam.values. Whenparam.valuesis a named numeric vector, its names are used as parameter names and the vector is treated as a one-row parameter matrix.- model.FUN
character, valid R function representing the model code to be calibrated/optimised.
- model.FUN.args
list with the arguments to be passed to
model.FUN.- ...
additional arguments. The deprecated argument
Particlesis temporarily accepted as an alias ofparam.values.
Details
This function takes an R-based user-defined model, a matrix/data.frame with many parameter sets (e.g., randomly generated or the output of a previous optimisation/calibration), and index indicating which specific parameter set must be used from the matrix/data.frame. Alternatively, param.values may be a single named numeric vector, which is converted internally into a one-row matrix. The function then runs the model and returns a goodness-of-fit value as measure of model performance, by comparing observations against simulated equivalents.
This function it was designed to run a model implemented as an R function, not an executable file that runs in the system console.
Value
This function MUST return a list with two elements:
- sim
numeric, with the simulated values obtained by running the model
.
- GoF
numeric, goodness-of-fit value representing how close each one of the simulated values in
simare to their observed counterparts, by using the USER-DEFINEDgof.FUNfunction
.
Author
Mauricio Zambrano-Bigiarini, mzb.devel@gmail.com