Description Usage Arguments Value Author(s) Examples
computes Gini index
1 | gini_process(classes, splitvar = NULL)
|
classes |
vector of factors/categorical vars |
splitvar |
split variable |
Gini index
Markus Loecher <Markus.Loecher@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #Test binary case:
#50/50split
gini_process(c(rep(0,10),rep(1,10)))#0.5 CORRECT !
#10/90split
gini_process(c(rep(0,1),rep(1,9)))#0.18= CORRECT !
#0/100split
gini_process(factor(c(rep(0,0),rep(1,10)), levels=c(0,1)))#0
#Test binary case:
#25/25/25/25 split
gini_process(factor(c(rep(0,5),rep(1,5),rep(2,5),
rep(3,5)), levels=c(0:3)))#0.75 = 4*0.25*0.75 CORRECT !
#10/10/10/70 split
gini_process(factor(c(rep(0,1),rep(1,1),rep(2,1),
rep(3,7)), levels=c(0:3)))#0.48 = 3*0.1*0.9+0.7*0.3 CORRECT !
#0/0/0/100 split
gini_process(factor(c(rep(0,0),rep(1,0),rep(2,0),
rep(3,20)), levels=c(0:3)))#0. CORRECT !
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.