Cody

# Problem 44933. Vogel-Dobbener entropy

Vogel-Dobbener entropy is a measure of dispersion for ordinal variables.

Given an ordered list of distinct observations u_(1), ..., u_(k) with observed relative frequencies f_1, ..., f_k, the Vogel-Dobbener entropy is defined as

` VD = -(sum_{i=1}^{k-1} (F_i log2(F_i) + (1 - F_i) log2(1 - F_i))`

where F_1, ... F_k are the cumulative relative frequences, i.e.

` F_i = sum_{j=1}^i f_i`

The Vogel-Dobbener entropy of a sample satisfies 0 <= VD <= (k - 1); the normalized Vogel-Dobbener entropy is thus defined as

` VD* = VD / (k - 1)`

For example, suppose that your sample is [2.7 3.3 2.0 3.3 1.7 3.7]. Then:

• k = 5 (there are five distinct observations);
• u_(1), ..., u_(k) = [1.7 2.0 2.7 3.3 3.7]; (note that 3.3 only appears once);
• f_1, ..., f_k = [1/6 1/6 1/6 2/6 1/6];
• F_1, ..., F_k = [1/6 2/6 3/6 5/6 6/6];
• VD = 3.2183; (approx.)
• VD* = 0.8046. (approx.)

Your task is to write a function that, given a list of observations (unordered and possibly containing duplicates) computes the normalized Vogel-Dobbener entropy VD* of the sample. Round to four decimal digits.

Hint: if all observations in the sample are the same, then k = 1, the sum in the definition of VD is empty, and VD equals zero.

### Solution Stats

62.5% Correct | 37.5% Incorrect
Last Solution submitted on Aug 02, 2019