Description Usage Arguments Details Value Examples
Calculate coefficient of determination (R2), root-mean square error (RMSE) and bias between predictions and observations of continuous variables.
1 |
obs |
A vector of observed values |
preds |
A vector of predicted values |
vars |
Optional vector indicating different variables |
folds |
Optional vector indicating the folds |
R2 is calculated with the following formula:
R^{2} = 1 - \frac{∑ (y_{i} - \hat{y}_{i})^{2}}{∑ (y_{i} - \bar{y}_{i})^{2}}
RMSE is calculated with the following formula:
RMSE = √{\frac{1}{n} ∑ (\hat{y}_{i} - y_{i})^{2}}
Bias is calculated with the following formula:
Bias = \frac{∑ (\hat{y}_{i} - y_{i})}{n}
Relative RMSE and bias are also calculated by dividing their value by the mean of observations.
If accuracy assessment was performed using k-fold cross-validation the accuracy metrics are calculated for each fold separately. The mean value of the accuracy metrics across all folds is also returned.
Data frame with following columns:
vars
Response variable
R2
R2
RMSE
RMSE
RMSE_rel
Relative RMSE
bias
bias
bias_rel
Relative bias
count
Number of observations
1 2 3 4 5 6 7 8 | # kNN_preds is a data frame obtained from foster::trainNN
# It contains predictions and observations of the trained kNN model
load(system.file("extdata/examples/kNN_preds.RData",package="foster"))
accuracy(obs = kNN_preds$obs,
preds = kNN_preds$preds,
vars = kNN_preds$variable,
folds = kNN_preds$Fold)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.