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_iThe 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
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers14
Suggested Problems
-
Find state names that end with the letter A
1198 Solvers
-
Remove the two elements next to NaN value
712 Solvers
-
Make a run-length companion vector
662 Solvers
-
Determine if input is a perfect number
267 Solvers
-
Number of odd and even elements within matrix
161 Solvers
More from this Author20
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!