View source: R/ErrorCrit_KGE.R
ErrorCrit_KGE | R Documentation |
Function which computes an error criterion based on the KGE formula proposed by Gupta et al. (2009).
ErrorCrit_KGE(InputsCrit, OutputsModel, warnings = TRUE, verbose = TRUE)
InputsCrit |
[object of class InputsCrit] see |
OutputsModel |
[object of class OutputsModel] see |
warnings |
(optional) [boolean] boolean indicating if the warning messages are shown, default = |
verbose |
(optional) [boolean] boolean indicating if the function is run in verbose mode or not, default = |
In addition to the criterion value, the function outputs include a multiplier (-1 or +1) which allows
the use of the function for model calibration: the product CritValue \times Multiplier
is the criterion to be minimised (Multiplier = -1 for KGE).
The KGE formula is
KGE = 1 - \sqrt{(r - 1)^2 + (\alpha - 1)^2 + (\beta - 1)^2}
with the following sub-criteria:
r = \mathrm{the\: linear\: correlation\: coefficient\: between\:} sim\: \mathrm{and\:} obs
\alpha = \frac{\sigma_{sim}}{\sigma_{obs}}
\beta = \frac{\mu_{sim}}{\mu_{obs}}
[list] list containing the function outputs organised as follows:
$CritValue | [numeric] value of the criterion |
$CritName | [character] name of the criterion |
$SubCritValues | [numeric] values of the sub-criteria |
$SubCritNames | [character] names of the components of the criterion |
$CritBestValue | [numeric] theoretical best criterion value |
$Multiplier | [numeric] integer indicating whether the criterion is indeed an error (+1) or an efficiency (-1) |
$Ind_notcomputed | [numeric] indices of the time steps where InputsCrit$BoolCrit = FALSE or no data is available |
Laurent Coron, Olivier Delaigue
Gupta, H. V., Kling, H., Yilmaz, K. K. and Martinez, G. F. (2009). Decomposition of the mean squared error and NSE performance criteria: Implications for improving hydrological modelling. Journal of Hydrology, 377(1-2), 80-91, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.jhydrol.2009.08.003")}.
ErrorCrit
, ErrorCrit_RMSE
, ErrorCrit_NSE
, ErrorCrit_KGE2
library(airGR)
## loading catchment data
data(L0123001)
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR4J, DatesR = BasinObs$DatesR,
Precip = BasinObs$P, PotEvap = BasinObs$E)
## run period selection
Ind_Run <- seq(which(format(BasinObs$DatesR, format = "%Y-%m-%d")=="1990-01-01"),
which(format(BasinObs$DatesR, format = "%Y-%m-%d")=="1999-12-31"))
## preparation of the RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD = RunModel_GR4J,
InputsModel = InputsModel, IndPeriod_Run = Ind_Run)
## simulation
Param <- c(X1 = 734.568, X2 = -0.840, X3 = 109.809, X4 = 1.971)
OutputsModel <- RunModel(InputsModel = InputsModel, RunOptions = RunOptions,
Param = Param, FUN = RunModel_GR4J)
## efficiency criterion: Kling-Gupta Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT = ErrorCrit_KGE, InputsModel = InputsModel,
RunOptions = RunOptions, Obs = BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_KGE(InputsCrit = InputsCrit, OutputsModel = OutputsModel)
## efficiency criterion: Kling-Gupta Efficiency on square-root-transformed flows
transfo <- "sqrt"
InputsCrit <- CreateInputsCrit(FUN_CRIT = ErrorCrit_KGE, InputsModel = InputsModel,
RunOptions = RunOptions, Obs = BasinObs$Qmm[Ind_Run],
transfo = transfo)
OutputsCrit <- ErrorCrit_KGE(InputsCrit = InputsCrit, OutputsModel = OutputsModel)
## efficiency criterion: Kling-Gupta Efficiency above a threshold (quant. 75 %)
BoolCrit <- BasinObs$Qmm[Ind_Run] >= quantile(BasinObs$Qmm[Ind_Run], 0.75, na.rm = TRUE)
InputsCrit <- CreateInputsCrit(FUN_CRIT = ErrorCrit_KGE, InputsModel = InputsModel,
RunOptions = RunOptions, Obs = BasinObs$Qmm[Ind_Run],
BoolCrit = BoolCrit)
OutputsCrit <- ErrorCrit_KGE(InputsCrit = InputsCrit, OutputsModel = OutputsModel)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.