Processing math: 100%

Accuracy indices

{lvmisc} contains a group of useful functions to compute basic indices of accuracy. These functions can be divided in those which compute element-wise values and those which compute average values:

You may notice that the majority of these functions have common prefixes (error_ and mean_error_), intended to facilitate the use, as most text editors have an auto-complete feature. Also all of the accuracy indices functions take actual and predicted as arguments, and the functions that return average values have na.rm = TRUE in addition.

Let’s now see how each function computes its results

Element-wise

Error: error()

It simply subtracts the predicted from the actual values.

Formula: aipi

Absolute error: error_abs()

It returns the absolute values of the error() function.

Formula: |aipi|

Percent error: error_pct()

Divides the error by the actual values.

Formula: aipiai100

Absolute percent error: error_abs_pct()

Returns the absolute values of the error_pct() function.

Formula: |aipi||ai|100

Squared error: error_sqr()

It squares the values of the error() function.

Formula: (aipi)2

Average

Mean error: mean_error()

It is the average of the error.

Formula: 1NNi=1(aipi)

Mean absolute error: mean_error_abs()

Computes the average of the absolute error.

Formula: 1NNi=1|aipi|

Mean percent error: mean_error_pct()

The average of the percent error.

Formula: 1NNi=1aipiai100

Mean absolute percent error: mean_error_abs_pct()

It is the average of the absolute percent error.

Formula: 1NNi=1|aipi||ai|100

Mean squared error: mean_error_sqr()

Averages the mean squared error.

Formula: 1NNi=1(aipi)2

Root mean squared error: mean_error_sqr_root()

It takes the square root of the mean squared error.

Formula: 1NNi=1(aipi)2

Bias: bias()

Alias to mean_error().

Limits of agreement: loa()

Formula: bias±1.96σ

Where σ is the standard deviation.