metric_gini: metric_gini

Description Usage Arguments Value See Also Examples

View source: R/metric_gini.R

Description

Returns gini coeffient of one or more models

Note: Predictions should be annualised (independent of exposure)

Usage

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

Arguments

actual

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

predicted

Array[Numeric] / DataFrame[Numeric] - Values that we have predicted.

weight

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

na.rm

logical. Should missing values be removed?

Value

gini coeffient. Single value if predicted is vector. Named list if predicted is dataframe.

See Also

plot_gini

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Input as vector
actual <- rnorm(100, mean=100, sd=10)
weight <- rep(1,100)
predicted <- actual + rnorm(100, mean=0, sd=1)

metric_gini(actual, predicted, weight)

# Input as dataframe

predicted <- data.frame(pred1 = actual + rnorm(100, mean=0, sd=1), pred2 = rnorm(100, mean=0, sd=1))
metric_gini(actual, predicted, weight)

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