Coefficient of determination (R2).Source:
It estimates the R2 for a continuous predicted-observed dataset.
(Optional) argument to call an existing data frame containing the data.
Vector with observed values (numeric).
Vector with predicted values (numeric).
Logical operator (TRUE/FALSE) to decide the type of return. TRUE returns a data.frame, FALSE returns a list; Default : FALSE.
Logic argument to remove rows with missing values (NA). Default is na.rm = TRUE.
an object of class
numeric within a
list (if tidy = FALSE) or within a
data frame (if tidy = TRUE).
The R2 is one of the most widely used metrics evaluating models performance. R2 is appropriate to estimate the strength of linear association between two variables. It is positively bounded to 1, but it may produce negative values. The closer to 1 the better linear association between predictions and observations. However, R2 presents a major flaw for prediction performance evaluation: it is not sensitive to lack of accuracy (additive or proportional bias). Thus, R2 only measures precision, but it does not account for accuracy of the predictions. For the formula and more details, see online-documentation
Yang et al. (2014). An evaluation of the statistical methods for testing the performance of crop models with observed data. Agric. Syst. 127, 81-89. doi:10.1016/j.agsy.2014.01.008