The number of non-missing values varies with cases. For example, as shown in the below table, a has two values and d has full five values. I want to know how this (m in the below entropy formula) can be integrated into Stata.
Array
x y z w v
a 2 3 . . .
b 4 5 6 . .
c 2 . . . .
d 4 5 6 7 2
[QUOTE]
gen entropy = 0
foreach v in a b c d e {
replace entropy = entropy + cond(`v' == 0, 0, `v' * ln(1/`v'))
}
sum entropy[
/QUOTE]
Related Posts with entropy and missing values
How to do DID Analysis using stata?Hello everyone, I am a student at a university and i am very new to DID analysis. The purpose of my …
Specify interaction/square terms with xtabond2 & xtdpdgmmDear all, First of all, I would like to confirm that I have searched and read many posts here but n…
Constucting the KZ IndexHello everyone, I have a hard time on how to figure out how to construct the KZ index based on http…
Arithmetic, Geometric and Harmonic totals, and Arithmetic, Geometric and Harmonic weighted meansThe Arithmetic_Mean = (Sum Xi)/n, and therefore n*Arithmetic_Mean= Sum Xi. This fact motivates me to…
Intra-obsever variabilityDear colleagues can I still use kap in stata for intra-observer variability? I have two readings by …
Subscribe to:
Post Comments (Atom)
0 Response to entropy and missing values
Post a Comment