conditional_entropy: Conditional Entropy

Description Usage Arguments Value Examples

View source: R/conditionalentropy.R

Description

Compute the average or the local conditional entropy between two time series. This function expects the condition to be the first argument.

Usage

1

Arguments

xs

Vector specifying a time series drawn from the conditional distribution.

ys

Vector specifying a time series drawn from the target distribution.

local

Boolean specifying whether to compute the local conditional entropy.

Value

Numeric giving the average conditional entropy or a vector giving the local conditional entropy.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)

rinform documentation built on April 1, 2018, 12:12 p.m.