metric_pode: metric_pode

Description Usage Arguments Value See Also Examples

View source: R/metric_pode.R

Description

Returns the proportion of deviance 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
2
3
4
5
6
7
8
9
metric_pode(
  actual,
  predicted,
  weight = NULL,
  family = "gaussian",
  na.rm = FALSE,
  rebase = FALSE,
  tweedie_power = NULL
)

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

family

String - family of distribution. Must be in c("gaussian", "poisson", "gamma", "tweedie", "binomial")

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

tweedie_power

Numeric - power of tweedie distribution if chosen in family

Value

Numeric: value of proportion of deviance

See Also

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

Examples

1
2
3
4
5
6
7
8
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_pode(actual, predicted)
metric_pode(actual, predicted, weight)
metric_pode(actual, predicted, weight, family="gamma")

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