Uplift barplot for categorical variables
Computes the observed uplift per category and creates a barplot.
UpliftPerCat(data, treat, outcome, x, ...)
data
: a data frame containing the treatment, the outcome and the variable of interest.treat
: name of a binary (numeric) vector representing the treatment assignment (coded as 0/1).outcome
: name of a binary response (numeric) vector (coded as 0/1).x
: name of the explanatory variable of interest....
: extra parameters for the barplot.returns a barplot representing the uplift per category.
Mouloud Belbahri
library(tools4uplift) data("SimUplift") binX1 <- BinUplift(data = SimUplift, treat = "treat", outcome = "y", x = "X1", n.split = 100, alpha = 0.01, n.min = 30) SimUplift$quantizedX1 <- predict(binX1, SimUplift$X1) UpliftPerCat(data = SimUplift, treat = "treat", outcome = "y", x = "quantizedX1", xlab='Quantized X1', ylab='Uplift', ylim=c(-1,1))
Useful links