diff --git a/docs/user-guide/plotting.qmd b/docs/user-guide/plotting.qmd index 4ded728d7..fa7598206 100644 --- a/docs/user-guide/plotting.qmd +++ b/docs/user-guide/plotting.qmd @@ -135,12 +135,12 @@ The radial distance from the point to the observation point is the standard devi ## Directional data (e.g. wind or currents) -Directional data can be plotted using the [`wind_rose`](`modelskill.plotting.wind_rose`). The function takes an array-like structure with speed and direction as columns (from one or two sources) and plots a wind rose: +Directional data can be plotted using the [`wind_rose`](`modelskill.plotting.wind_rose`). The function takes an array-like structure with speed and direction as columns (from one or two sources) and plots a wind rose. With two sources, the first pair is labelled "Measurement" and the second "Model" (see `labels`): ```{python} import mikeio ds = mikeio.read("../data/wave_dir.dfs0") -df = ds[[0,2,1,3]].to_dataframe() +df = ds[[1,3,0,2]].to_dataframe() # measured speed, direction, then model df.round(2).head() ``` diff --git a/src/modelskill/metrics.py b/src/modelskill/metrics.py index 5d0652666..0a8bcb74d 100644 --- a/src/modelskill/metrics.py +++ b/src/modelskill/metrics.py @@ -311,7 +311,9 @@ def kge(obs: ArrayLike, model: ArrayLike) -> Any: def r2(obs: ArrayLike, model: ArrayLike) -> Any: r"""Coefficient of determination (R2) - Pronounced 'R-squared'; the proportion of the variation in the dependent variable that is predictable from the independent variable(s), i.e. the proportion of explained variance. + Same value as Nash-Sutcliffe efficiency and scikit-learn's `r2_score`. + Not squared Pearson correlation (`cc**2`): r2 penalises bias and amplitude + errors, and is negative when the model is worse than the observed mean. $$ R^2 = 1 - \frac{\sum_{i=1}^n (model_i - obs_i)^2} @@ -320,9 +322,10 @@ def r2(obs: ArrayLike, model: ArrayLike) -> Any: Range: $(-\infty, 1]$; Best: 1 - Notes - ----- - r2 = nash_sutcliffe_efficiency(nse) + See Also + -------- + nash_sutcliffe_efficiency + cc Examples --------