explained_variation: Explained Variation

Description Usage Arguments Details See Also Examples

Description

explained_variation computes the percentage of variation in one numeric vector explained by another, also known as the coefficient of determination.

Usage

1
explained_variation(actual, predicted)

Arguments

actual

The ground truth numeric vector.

predicted

The predicted numeric vector, where each element in the vector is a prediction for the corresponding element in actual.

Details

explained_variation subtracts the relative squared error, rse(actual, predicted), from 1, meaning it can return negative values if the predictions are on average further from the actual values than predictions from a naive model that predicts the mean for every data point.

See Also

rse

Examples

1
2
3
actual <- c(1.1, 1.9, 3.0, 4.4, 5.0, 5.6)
predicted <- c(0.9, 1.8, 2.5, 4.5, 5.0, 6.2)
explained_variation(actual, predicted)

mfrasco/Metrics documentation built on May 13, 2019, 12:31 a.m.