implication.index.gain: Compute the gain of a split by the implication index of Gras

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/implication.index.R

Description

The implication.index.gain function computes the implication index statistics of Gras (YEAR).

Usage

1
2
3
4
5
6
7
8
9
implication.index.gain(
  y,
  kidsids,
  decision.rule = decision.rule.majority,
  h0 = y,
  aggregation.rule = aggregation.rule.weighted.mean,
  quiet = T,
  rquiet = T
)

Arguments

y

a WeithedVariable.categorical, a factor or a character.

kidsids

a integer specifying how to split the variable.

decision.rule

a function specifying how to choose the class of interest. See for example decision.rule.majority.

h0

a WeithedVariable.categorical, a factor, a character or a a Distribution.

aggregation.rule

a function specifying how to aggregate utility between parent and children. See for example aggregation.rule.weighted.mean.

quiet

a logical.

rquiet

a logical, if TRUE the quiet order is passed in each sub-call.

Value

A numeric, the value of the gain.

Author(s)

Emmanuel Rousseaux

References

FIXME

See Also

implication.index

Examples

 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
62
63
ritschard.array <- array(
  data = c(50,5,5,40,5,8,6,12,10,0,50,6,14,30,2,10,18,2),
  dim = c(3,3,2),
  dimnames = list(
    'civil status' = c('married', "single", 'divorced/widowed'),
    'working sector' = c('primary', 'secondary', 'tertiary'), 
    'sex' = c('man', 'woman')
  )
)
ritschard.data <- expand.array(ritschard.array)
ritschard.data
names(ritschard.data)

implication.index.gain(
  y = ritschard.data$civil.status,
  kidsids = c(rep(1, 141), rep(2, 132)),
  h0 = ritschard.data$civil.status
)
implication.index.gain(
  y = ritschard.data$civil.status,
  kidsids = c(rep(1, 141), rep(2, 132))
)

implication.index.gain(
  y = ritschard.data$civil.status,
  kidsids = c(rep(1, 141), rep(2, 132)),
  aggregation.rule = aggregation.rule.maximum
)
implication.index.gain(
  y = ritschard.data$civil.status,
  kidsids = c(rep(1, 141), rep(2, 132)),
  aggregation.rule = aggregation.rule.minimum
)
implication.index.gain(
  y = ritschard.data$civil.status,
  kidsids = c(rep(1, 141), rep(2, 132))
)
kidsids.sector <- rep(0, nrow(ritschard.data))
kidsids.sector[ritschard.data$working.sector == 'primary'] <- 1
kidsids.sector[ritschard.data$working.sector == 'secondary'] <- 2
kidsids.sector[ritschard.data$working.sector == 'tertiary'] <- 3
implication.index.gain(
  y = ritschard.data$civil.status,
  kidsids = kidsids.sector,
  h0 = distribution(ritschard.data$civil.status)
)
implication.index.gain(
  y = ritschard.data$civil.status,
  kidsids = c(rep(1, 141), rep(2, 132)),
  h0 = distribution(ritschard.data$civil.status),
  decision.rule = decision.rule.married
)
implication.index(
  y = ritschard.data$civil.status,
  h0 = distribution(ritschard.data$civil.status),
  quiet = FALSE
)
implication.index.gain(
  y = ritschard.data$civil.status,
  kidsids = c(rep(1, 141), rep(2, 132)),
  h0 = distribution(ritschard.data$civil.status),
  aggregation.rule = aggregation.rule.information.gain
)

trim documentation built on May 2, 2019, 5:36 p.m.