inst/examples/ex_conditionalentropy.R

xs <- c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1)
ys <- c(0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1)
conditional_entropy(xs, ys)      # 0.5971072
conditional_entropy(ys, xs)      # 0.5077571

# [1] 3.0, 3.0, 0.1926451, 0.1926451, 0.1926451, 0.1926451, 0.1926451, 0.1926451,
#     0.1926451, 0.1926451, 0.1926451, 0.1926451, 0.1926451, 0.1926451, 0.1926451,
#     0.1926451, 0.4150375, 0.4150375, 0.4150375, 2.0
conditional_entropy(xs, ys, local = TRUE)

# [1] 1.32192809, 1.32192809, 0.09953567, 0.09953567, 0.09953567, 0.09953567,
#     0.09953567, 0.09953567, 0.09953567, 0.09953567, 0.09953567, 0.09953567,
#     0.09953567, 0.09953567, 0.09953567, 0.09953567, 0.73696559, 0.73696559,
#     0.73696559,  3.9068906
conditional_entropy(ys, xs, local = TRUE)
ELIFE-ASU/rinform documentation built on May 26, 2019, 7:25 a.m.