yardstick (version 0.0.1)

rmse: Calculate Metrics for Numeric Outcomes

Description

These functions are appropriate for cases where the model outcome is a number. The root mean squared error (rmse) and mean absolute error (mae) are error measures that are in the same units as the original data. The two estimates for the coefficient of determination, rsq and rsq_trad, differ by their formula. The former guarantees a value on (0, 1) while the latter can generate inaccurate values when the model is non-informative (see the examples). Both are measures of consistency/correlation and not of accuracy. The concordance correlation coefficient (ccc) is a measure of both.

Usage

rmse(data, ...)

# S3 method for data.frame rmse(data, truth, estimate, na.rm = TRUE, ...)

rsq(data, ...)

# S3 method for data.frame rsq(data, truth, estimate, na.rm = TRUE, ...)

rsq_trad(data, ...)

# S3 method for data.frame rsq_trad(data, truth, estimate, na.rm = TRUE, ...)

mae(data, ...)

# S3 method for data.frame mae(data, truth, estimate, na.rm = TRUE, ...)

ccc(data, ...)

# S3 method for data.frame ccc(data, truth, estimate, bias = FALSE, na.rm = TRUE, ...)

Arguments

data

A data frame

...

Not currently used.

truth

The column identifier for the true results (that is numeric). This should an unquoted column name although this argument is passed by expression and support quasiquotation (you can unquote column names or column positions).

estimate

The column identifier for the predicted results (that is also numeric). As with truth this can be specified different ways but the primary method is to use an unquoted variable name.

na.rm

A logical value indicating whether NA values should be stripped before the computation proceeds.

bias

A logical; should the biased estimate of variance be used for the concordance correlation coefficient (as is Lin (1989))?

Value

A number or NA

References

Kvalseth. Cautionary note about \(R^2\). American Statistician (1985) vol. 39 (4) pp. 279-285.

Lin, L. (1989). A concordance correlation coefficient to evaluate reproducibility. Biometrics, 45 (1), 255<U+2013>268.

Nickerson, C. (1997). A note on" A concordance correlation coefficient to evaluate reproducibility". Biometrics, 53(4), 1503-1507.

Examples

Run this code
# NOT RUN {
rmse(solubility_test, truth = solubility, estimate = prediction)
mae(solubility_test, truth = solubility, estimate = prediction)

rsq(solubility_test, solubility, prediction)

set.seed(2291)
solubility_test$randomized <- sample(solubility_test$prediction)
rsq(solubility_test, solubility, randomized)
rsq_trad(solubility_test, solubility, randomized)

ccc(solubility_test, solubility, prediction)

# }

Run the code above in your browser using DataLab