shannonEntropy: Calculator of Shannon entropy for a vector of observations.

Description Usage Arguments Value

Description

shannonEntropy calculates the Shannon entropy for a vector of observations, using empirical probability of each unique value as its probability. The input vector is assumed to contain observations from a discrete distribution. If working with continuous data, the observations should be discretized prior to using this function. The base two logarithm is used, so the unit for the result is bits.

Usage

1
2
shannonEntropy(observations, isCounts = FALSE, pseudocount = 1,
  normalized = FALSE)

Arguments

observations

The observed values for which to calculate entropy.

isCounts

Does observations consist of observation counts rather than actual observations?

pseudocount

Value of pseudocount to substitute for zeros; this has meaning if and only if counts=TRUE.

normalized

Whether to normalize the entropy (into [0, 1]).

Value

The Shannon entropy of the empirical distribution defined by the given observations.


vreuter/SwissR documentation built on May 14, 2019, 11:29 a.m.