plot_gini: plot_gini

Description Usage Arguments Value See Also Examples

View source: R/plot_gini.R

Description

Returns a plot showing the gini of one or more models compared to the perfect model and the Null model

Note: Predictions should be annualised (independent of exposure)

Usage

1
2
3
4
5
6
7
plot_gini(
  actual,
  predicted,
  weight = rep(1, length(actual)),
  na.rm = FALSE,
  use_plotly = TRUE
)

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?

use_plotly

Optional: boolean - If TRUE plotly object is returned else ggplot2 object

Value

plotly/ggplot object of showing gini curve for all predictions given

See Also

metric_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)

plot_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))
plot_gini(actual, predicted, weight)

gloverd2/codeBase documentation built on Dec. 20, 2021, 11:48 a.m.