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
WTP pack with categorical variable in choice experimentHello, running a mixed logit model and have one categorical variable with three levels/categories. W…
Bootstrapping? - Comparing the within-subject treatment effect with the between-subject treatment effect (based on two other groups)Dear fellow Stata users, thank you very much for reading my post. I am currently working on an inte…
Generating Date IssueHello Statalist, I am having trouble converting dates. I have three date variables (daily_case_date…
coefplot using "meta-data"Hi all, (Relatively new STATA user here) I'm trying some interesting ways of visualizing my data and…
Collecting Confidence Intervals from regress using statsbyHi. I want to use statsby to collect the lower and upper limits of the 95% confidence interval of a …
Subscribe to:
Post Comments (Atom)
0 Response to entropy and missing values
Post a Comment