knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
{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:
Element-wise:
error()error_abs()error_pct()error_abs_pct()error_sqr()Average:
mean_error()mean_error_abs()mean_error_pct()mean_error_abs_pct()mean_error_sqr()mean_error_sqr_root()bias()loa()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
error()It simply subtracts the predicted from the actual values.
Formula: $$a_i - p_i$$
error_abs()It returns the absolute values of the error() function.
Formula: $$|a_i - p_i|$$
error_pct()Divides the error by the actual values.
Formula: $$\frac{a_i - p_i}{a_i}\cdot100$$
error_abs_pct()Returns the absolute values of the error_pct() function.
Formula: $$\frac{|a_i - p_i|}{|a_i|}\cdot100$$
error_sqr()It squares the values of the error() function.
Formula: $$(a_i - p_i)^2$$
mean_error()It is the average of the error.
Formula: $$\frac{1}{N}\sum_{i = 1}^{N}(a_i - p_i)$$
mean_error_abs()Computes the average of the absolute error.
Formula: $$\frac{1}{N}\sum_{i = 1}^{N}|a_i - p_i|$$
mean_error_pct()The average of the percent error.
Formula: $$\frac{1}{N}\sum_{i = 1}^{N}\frac{a_i - p_i}{a_i}\cdot100$$
mean_error_abs_pct()It is the average of the absolute percent error.
Formula: $$\frac{1}{N}\sum_{i = 1}^{N}\frac{|a_i - p_i|}{|a_i|}\cdot100$$
mean_error_sqr()Averages the mean squared error.
Formula: $$\frac{1}{N}\sum_{i = 1}^{N}(a_i - p_i)^2$$
mean_error_sqr_root()It takes the square root of the mean squared error.
Formula: $$\sqrt{\frac{1}{N}\sum_{i = 1}^{N}(a_i - p_i)^2}$$
bias()Alias to mean_error().
loa()Formula: $$bias \pm 1.96\sigma$$
Where $\sigma$ is the standard deviation.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.