wsNSE | R Documentation |
Weighted seasonal Nash-Sutcliffe Efficiency between sim
and obs
, with treatment of missing values.
This function is designed to identify differences in high or low values, depending on the user-defined value given to the lambda
argument. See Usage and Details.
wsNSE(sim, obs, ...)
## Default S3 method:
wsNSE(sim, obs, na.rm=TRUE,
j=2, lambda=0.95, lQ.thr=0.6, hQ.thr=0.1, fun=NULL, ...,
epsilon.type=c("none", "Pushpalatha2012", "otherFactor", "otherValue"),
epsilon.value=NA)
## S3 method for class 'data.frame'
wsNSE(sim, obs, na.rm=TRUE,
j=2, lambda=0.95, lQ.thr=0.6, hQ.thr=0.1, fun=NULL, ...,
epsilon.type=c("none", "Pushpalatha2012", "otherFactor", "otherValue"),
epsilon.value=NA)
## S3 method for class 'matrix'
wsNSE(sim, obs, na.rm=TRUE,
j=2, lambda=0.95, lQ.thr=0.6, hQ.thr=0.1, fun=NULL, ...,
epsilon.type=c("none", "Pushpalatha2012", "otherFactor", "otherValue"),
epsilon.value=NA)
## S3 method for class 'zoo'
wsNSE(sim, obs, na.rm=TRUE,
j=2, lambda=0.95, lQ.thr=0.6, hQ.thr=0.1, fun=NULL, ...,
epsilon.type=c("none", "Pushpalatha2012", "otherFactor", "otherValue"),
epsilon.value=NA)
sim |
numeric, zoo, matrix or data.frame with simulated values |
obs |
numeric, zoo, matrix or data.frame with observed values |
na.rm |
a logical value indicating whether 'NA' should be stripped before the computation proceeds. |
j |
numeric, representing an arbitrary value used to power the differences between observations and simulations. By default |
lambda |
numeric in [0, 1] representing the weight given to the high observed values. The closer the Low values get a weight equal to Suggested values for lambda are |
lQ.thr |
numeric, representing the non-exceedence probabiliy used to identify low flows in On the other hand, the low values in |
hQ.thr |
numeric, representing the non-exceedence probabiliy used to identify high flows in On the other hand, the high values in |
fun |
function to be applied to The first argument MUST BE a numeric vector with any name (e.g., |
... |
arguments passed to |
epsilon.type |
argument used to define a numeric value to be added to both It is was designed to allow the use of logarithm and other similar functions that do not work with zero values. Valid values of 1) "none": 2) "Pushpalatha2012": one hundredth (1/100) of the mean observed values is added to both 3) "otherFactor": the numeric value defined in the 4) "otherValue": the numeric value defined in the |
epsilon.value |
-) when |
The weighted seasonal Nash-Sutcliffe Efficiency was proposed by Zambrano-Bigiarini and Bellin (2012), inspired by the well-known Nash-Sutcliffe efficiency (NSE, Nash and Sutcliffe, 1970), and the commentaries made by Schaefli and Gupta (2007) and Criss and Winston (2008).
This function gives different weights to the high/low values in the (obs_i - sim_i) terms used in the Nash-Sutcliffe formula, using high weights for high or low flows, depending on how close the user-defined 'lambda' value is to 1 or zero, respectively. Between high and low values there is a linear transition from lambda
to 1-lambda
, respectively.
Following the traditional Nash-Sutcliffe efficiency, the weighted seasonal Nash-Sutcliffe Efficiency (wsNSE) ranges from -Inf to 1, with an optimal value of 1. Higher values of wsNSE indicate lower differences between sim
and obs
. Essentially, the closer to 1, the more similarsim
and obs
are.
numeric with the the weighted seasonal Nash-Sutcliffe Efficiency (wsNSE) between sim
and obs
. If sim
and obs
are matrices, the output value is a vector, with the the weighted seasonal Nash-Sutcliffe Efficiency (wsNSE) between each column of sim
and obs
.
obs
and sim
has to have the same length/dimension
The missing values in obs
and sim
are removed before the computation proceeds, and only those positions with non-missing values in obs
and sim
are considered in the computation
Mauricio Zambrano-Bigiarini <mzb.devel@gmail.com>
Zambrano-Bigiarini, M.; Bellin, A. (2012). Comparing goodness-of-fit measures for calibration of models focused on extreme events. EGU General Assembly 2012, Vienna, Austria, 22-27 Apr 2012, EGU2012-11549-1.
Nash, J.E.; J.V. Sutcliffe. (1970). River flow forecasting through conceptual models. Part 1: a discussion of principles, Journal of Hydrology 10, pp. 282-290. doi:10.1016/0022-1694(70)90255-6.
Schaefli, B.; Gupta, H. (2007). Do Nash values have value?. Hydrological Processes 21, 2075-2080. doi:10.1002/hyp.6825.
Criss, R. E.; Winston, W. E. (2008), Do Nash values have value?. Discussion and alternate proposals. Hydrological Processes, 22: 2723-2725. doi:10.1002/hyp.7072.
Yilmaz, K. K.; Gupta, H. V.; Wagener, T. (2008), A process-based diagnostic approach to model evaluation: Application to the NWS distributed hydrologic model, Water Resources Research, 44, W09417, doi:10.1029/2007WR006716.
Krause, P.; Boyle, D.P.; Base, F. (2005). Comparison of different efficiency criteria for hydrological model assessment, Advances in Geosciences, 5, 89-97. doi:10.5194/adgeo-5-89-2005.
Legates, D.R.; McCabe, G. J. Jr. (1999), Evaluating the Use of "Goodness-of-Fit" Measures in Hydrologic and Hydroclimatic Model Validation, Water Resour. Res., 35(1), 233-241. doi:10.1029/1998WR900018.
NSE
, wNSE
, wsNSE
, APFB
, KGElf
, gof
, ggof
##################
# Example 1: Looking at the difference between 'KGE', 'NSE', 'wNSE', 'wsNSE',
# 'APFB' and 'KGElf' for detecting differences in high flows
# Loading daily streamflows of the Ega River (Spain), from 1961 to 1970
data(EgaEnEstellaQts)
obs <- EgaEnEstellaQts
# Simulated daily time series, created equal to the observed values and then
# random noise is added only to high flows, i.e., those equal or higher than
# the quantile 0.9 of the observed values.
sim <- obs
hQ.thr <- quantile(obs, probs=0.9, na.rm=TRUE)
hQ.index <- which(obs >= hQ.thr)
hQ.n <- length(hQ.index)
sim[hQ.index] <- sim[hQ.index] + rnorm(hQ.n, mean=mean(sim[hQ.index], na.rm=TRUE))
# Traditional Kling-Gupta eficiency (Gupta and Kling, 2009)
KGE(sim=sim, obs=obs)
# Traditional Nash-Sutcliffe eficiency (Nash and Sutcliffe, 1970)
NSE(sim=sim, obs=obs)
# Weighted Nash-Sutcliffe efficiency (Hundecha and Bardossy, 2004)
wNSE(sim=sim, obs=obs)
# wsNSE (Zambrano-Bigiarini and Bellin, 2012):
wsNSE(sim=sim, obs=obs)
# APFB (Mizukami et al., 2019):
APFB(sim=sim, obs=obs)
##################
# Example 2: Looking at the difference between 'KGE', 'NSE', 'wsNSE',
# 'dr', 'rd', 'md', 'APFB' and 'KGElf' for detecting differences in low flows
# Loading daily streamflows of the Ega River (Spain), from 1961 to 1970
data(EgaEnEstellaQts)
obs <- EgaEnEstellaQts
# Simulated daily time series, created equal to the observed values and then
# random noise is added only to low flows, i.e., those equal or lower than
# the quantile 0.4 of the observed values.
sim <- obs
lQ.thr <- quantile(obs, probs=0.4, na.rm=TRUE)
lQ.index <- which(obs <= lQ.thr)
lQ.n <- length(lQ.index)
sim[lQ.index] <- sim[lQ.index] + rnorm(lQ.n, mean=mean(sim[lQ.index], na.rm=TRUE))
# Traditional Kling-Gupta eficiency (Gupta and Kling, 2009)
KGE(sim=sim, obs=obs)
# Traditional Nash-Sutcliffe eficiency (Nash and Sutcliffe, 1970)
NSE(sim=sim, obs=obs)
# Weighted seasonal Nash-Sutcliffe efficiency (Zambrano-Bigiarini and Bellin, 2012):
wsNSE(sim=sim, obs=obs, lambda=0.05, j=1/2)
# Refined Index of Agreement (Willmott et al., 2012):
dr(sim=sim, obs=obs)
# Relative Index of Agreement (Krause et al., 2005):
rd(sim=sim, obs=obs)
# Modified Index of Agreement (Krause et al., 2005):
md(sim=sim, obs=obs)
# KGElf (Garcia et al., 2017):
KGElf(sim=sim, obs=obs)
##################
# Example 3:
# Loading daily streamflows of the Ega River (Spain), from 1961 to 1970
data(EgaEnEstellaQts)
obs <- EgaEnEstellaQts
# Generating a simulated daily time series, initially equal to the observed series
sim <- obs
# Computing the 'wsNSE' for the "best" (unattainable) case
wsNSE(sim=sim, obs=obs)
##################
# Example 4: wsNSE for simulated values created equal to the observed values and then
# random noise is added only to high flows, i.e., those equal or higher than
# the quantile 0.9 of the observed values and applying (natural)
# logarithm to 'sim' and 'obs' during computations.
wsNSE(sim=sim, obs=obs, fun=log)
# Verifying the previous value:
lsim <- log(sim)
lobs <- log(obs)
wsNSE(sim=lsim, obs=lobs)
##################
# Example 5: wsNSE for simulated values created equal to the observed values and then
# random noise is added only to high flows, i.e., those equal or higher than
# the quantile 0.9 of the observed values and applying a
# user-defined function to 'sim' and 'obs' during computations
fun1 <- function(x) {sqrt(x+1)}
wsNSE(sim=sim, obs=obs, fun=fun1)
# Verifying the previous value, with the epsilon value following Pushpalatha2012
sim1 <- sqrt(sim+1)
obs1 <- sqrt(obs+1)
wsNSE(sim=sim1, obs=obs1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.