metric_pove: metric_pove

Description Usage Arguments Value See Also Examples

View source: R/metric_pove.R

Description

Returns the proportion of variance explained by the predictions. Note: Predictions should be annualized (independent of exposure) Note: high is good. 1 is perfect model, 0 is null model, negative is worse than null model

Usage

1
metric_pove(actual, predicted, weight = NULL, na.rm = FALSE, rebase = FALSE)

Arguments

actual

Array[Numeric] - Values we are aiming to predict.

predicted

Array[Numeric] - Values that we have predicted.

weight

Optional: Array[Numeric] - Weighting of predictions. If NULL even weighting is used

na.rm

Optional: boolean - If FALSE function will return NA is any value in NA

rebase

Optional: boolean - If TRUE predictions weighted mean will be rebased to match actual mean

Value

Numeric: value of proportion of variance explained

See Also

Other Metrics: metric_deviance(), metric_mae(), metric_nloglik(), metric_pode(), metric_rmse()

Examples

1
2
3
4
5
6
7
set.seed(666)
actual <- rnorm(n = 10, mean = 10, sd = 3)
predicted <- actual + rnorm(n = 10, mean = 0, sd = 1)
weight <- pmax(rnorm(n = 10, mean = 10, sd = 1) , 0)

metric_pove(actual, predicted)
metric_pove(actual, predicted, weight)

gloverd2/admr documentation built on Dec. 2, 2020, 11:16 p.m.