niv(formula, data, subset, na.action = na.pass, B = 10, direction = 1,
nbins = 10, continuous = 4, plotit = TRUE, ...)
trt()
must be used in the model equation to identify the binary treatment variable. For example, if the treatment is represented by a variable named trea
na.action = na.pass
.1
(default), the net weight of evidence is computed as the difference between the weight of evidence of the treatment and control groups, or if 2
, it is computed as the difference between the weight of evidence of the ccontinuous
unique values). The default is 4. Factor variables are always considered to be categorical no matter how many levels they have.barplot
.ct1.y1
), the distribution of the non-responses (y=0) over the treated group (ct1.y0
), the distribution of the responses (y=1) over the control group (ct0.y1
), the distribution of the non-responses (y=0) over the control group (ct0.y0
), the weight-of-evidence over the treated group (ct1.woe
), the weight-of-evidence over the control group ct0.woe
, and the net weigh-of-evidence (nwoe
).$$IV = \sum_{i=1}^{G} \left (P(x=i|y=1) - P(x=i|y=0) \right) \times WOE_i$$
where $G$ is the number of groups created from a numeric predictor or categories from a categorical predictor, and $WOE_i = ln (\frac{P(x=i|y=1)}{P(x=i|y=0)})$.
The net information value is the natural extension of the IV for the case of uplift. It is computed as
$$NIV = 100 \times \sum_{i=1}^{G}(P(x=i|y=1)^{T} \times P(x=i|y=0)^{C} - P(x=i|y=0)^{T} \times P(x=i|y=1)^{C}) \times NWOE_i$$
where $NWOE_i = WOE_i^{T} - WOE_i^{C}$
The adjusted net information value is computed as follows:
1. Take $B$ bootstrap samples and compute the NIV for each variable on each sample
2. Compute the mean of the NIV ($NIV_{mean}$) and sd of the NIV ($NIV_{sd}$) for each variable over all the $B$ bootstraps
3. The adjusted NIV for a given variable is computed by adding a penalty term to the mean NIV: $NIV_{mean} - \frac{NIV_{sd}}{\sqrt{B}}$.
library(uplift)
set.seed(12345)
dd <- sim_pte(n = 1000, p = 20, rho = 0, sigma = sqrt(2), beta.den = 4)
dd$treat <- ifelse(dd$treat == 1, 1, 0)
niv.1 <- niv(y ~ X1 + X2 + X3 + X4 + X5 + X6 + trt(treat), data = dd)
niv.1$niv
niv.1$nwoe
Run the code above in your browser using DataLab