*! version 1.0.0 01Sep2024
help enwei

Entropy Method

Title

enwei -- Calculation of Weights and Comprehensive Scores Using the Entropy Method

description

enwei uses the entropy method to calculate index weights and Comprehensive scores. The output results include entropy, Divergence, weights, composite scores, and individual variable scores.

Syntax

enwei varlist ,
order(numlist)
[generate(varname)
dimension(varname)
replace
biase(numlist)]

* order(numlist) numlist is a set of values that indicate the positive or negative direction of the variable, non-zero indicates that the corresponding variable is positive, and 0 indicates that the corresponding indicator is negative. The variables that need to be weighted are v1, v2, v3, v4,numlist are 1, 0, 0, 1, then v1 and v4 are positive variables, v2 and v3 are negative variables.

generate(varname) varname is the variable name of the Comprehensive score using the entropy method, and the default variable name is entropy.

dimension(varname) varname is the variable name prefix of the score of each variable calculated by entropy method. If this parameter is not set, the score of each variable is not generated separately.

replace replace indicates that variables with the same name that already exist in the data will be overwritten.

biase(numlist) Since one of the observed values must be 0 when using normalization, the amount of translation needs to be set. numlist is a custom translation; If not set, the translation is the reciprocal of the number of samples multiplied by 1000.

Examples

Setup

sysuse citytemp4.dta , clear

drop if missing(heatdd)

enwei heatdd cooldd tempjan tempjuly , order(1 0 0 1) gen(I) dim(d) replace

Output the Weights to word

collect:enwei heatdd cooldd tempjan tempjuly , order(1 0 0 1) gen(I) dim(d) replace

collect layout (rowname[W]) (colname) (result[W]), name(default)

collect export "Weights", as(docx) replace

enwei results

enwei stores the following in r():

Matrices

r(OrderM) direction

r(E) Entropy

r(D) Divergence Coefficient

r(W) Weights

r(Index) Comprehensive Score

r(DIM) the score of each variable

Authors

Jiang Qi

微信公众号:Zscholar Data Scientist

deeptravonearth@gmail.com