R: Plug-In Entropy Estimator

entropy.plugin {entropy} | R Documentation

## Plug-In Entropy Estimator

### Description

`entropy.plugin` computes the Shannon entropy H of a discrete random variable from the specified bin frequencies.

### Usage

    entropy.plugin(freqs, unit=c("log", "log2", "log10"))

### Arguments

`freqs` | bin frequencies.
`unit` | the unit in which entropy is measured. The default is "nats" (natural units). For computing entropy in "bits" set `unit="log2"`.

### Details

The Shannon entropy of a discrete random variable is defined as H = -∑ p(x_i) \log( p(x_i) ), where p(x_i) are the bin probabilities.

### Value

`entropy.plugin` returns the Shannon entropy.

### Author(s)

Korbinian Strimmer (http://strimmerlab.org).

### See Also

`entropy`, `entropy.empirical`, `entropy.shrink`, `mi.plugin`, `KL.plugin`, `discretize`.

### Examples

    # load entropy library
    library("entropy")

    # some frequencies
    freqs = c(0.2, 0.1, 0.15, 0.05, 0, 0.3, 0.2)

    # and corresponding entropy
    entropy.plugin(freqs)

[Package entropy version 1.2.1 Index]