The function nse computes the Nash-Sutcliffe efficiency when \(\textbf{\textit{y}}\) materialises and \(\textbf{\textit{x}}\) is the prediction.
Nash-Sutcliffe efficiency is a skill score corresponding to the squared error scoring function serr_sf. It is defined in eq. (3) in Nash and Sutcliffe (1970).
nse(x, y)Value of the Nash-Sutcliffe efficiency.
Prediction. It can be a vector of length \(n\) (must have the same length as \(\textbf{\textit{y}}\)).
Realisation (true value) of process. It can be a vector of length \(n\) (must have the same length as \(\textbf{\textit{x}}\)).
The Nash-Sutcliffe efficiency is defined by:
$$S_{\textnormal{skill}}(\textbf{\textit{x}}, \textbf{\textit{y}}) := 1 - S_{\textnormal{meth}}(\textbf{\textit{x}}, \textbf{\textit{y}}) / S_{\textnormal{ref}}(\textbf{\textit{y}})$$
where
$$\textbf{\textit{x}} = (x_1, ..., x_n)^\mathsf{T}$$
$$\textbf{\textit{y}} = (y_1, ..., y_n)^\mathsf{T}$$
$$\textbf{\textit{1}} = (1, ..., 1)^\mathsf{T}$$
$$\overline{\textbf{\textit{y}}} := (1/n) \textbf{\textit{1}}^\mathsf{T} \textbf{\textit{y}} = (1/n) \sum_{i = 1}^{n} y_i$$
$$L(x, y) := (x - y)^2$$
and the predictions of the method of interest as well as the reference method are evaluated respectively by:
$$S_{\textnormal{meth}}(\textbf{\textit{x}}, \textbf{\textit{y}}) := (1/n) \sum_{i = 1}^{n} L(x_i, y_i)$$
$$S_{\textnormal{ref}}(\textbf{\textit{y}}) := (1/n) \sum_{i = 1}^{n} L(\overline{\textbf{\textit{y}}}, y_i)$$
The reference score \(S_{\textnormal{ref}}\) is the score of the constant prediction \(\overline{\textbf{\textit{y}}}\) and therefore depends on \(\textbf{\textit{y}}\) only.
\(\textbf{\textit{1}}\) is the vector of ones.
Domain of function:
$$\textbf{\textit{x}} \in \mathbb{R}^n$$
$$\textbf{\textit{y}} \in \mathbb{R}^n$$
$$S_{\textnormal{ref}}(\textbf{\textit{y}}) > 0$$
Range of function:
$$S_{\textnormal{skill}}(\textbf{\textit{x}}, \textbf{\textit{y}}) \leq 1, \forall \textbf{\textit{x}}, \textbf{\textit{y}} \in \mathbb{R}^n \textnormal{ with } S_{\textnormal{ref}}(\textbf{\textit{y}}) > 0$$
Gneiting T (2011) Making and evaluating point forecasts. Journal of the American Statistical Association 106(494):746--762. tools:::Rd_expr_doi("10.1198/jasa.2011.r10138").
Nash JE, Sutcliffe JV (1970) River flow forecasting through conceptual models Part I - A discussion of principles. Journal of Hydrology 10(3):282--290. tools:::Rd_expr_doi("10.1016/0022-1694(70)90255-6").
mse, serr_sf, mean_if
# Compute the Nash-Sutcliffe efficiency.
set.seed(12345)
x <- 0
y <- rnorm(n = 100, mean = 0, sd = 1)
print(nse(x = x, y = y))
print(nse(x = rep(x = x, times = 100), y = y))
print(nse(x = mean(y), y = y))
print(nse(x = y, y = y))
Run the code above in your browser using DataLab