一、正向反向指标均存在
global xlist "x1 x2 x3 x4 x5 x6 x7 x8 x9"
global plist "x2 x4 x6 x7 x8 x9"
global nlist "x1 x3 x5"
*Step1:标准化
foreach x of global xlist{
egen min`x' = min(`x')
egen max`x' = max(`x')
}
*Step1.1:正向指标标准化
foreach p of global plist{
gen standard`p' = (`p' -min`p')/ (max`p' - min`p')
}
*Step1.2:反向指标标准化
foreach n of global nlist{
gen standard`n' = (max`n'-`n' )/ (max`n' - min`n')
}
*Step2:计算第i年变量j的权重 总体
foreach x of global xlist {
egen sum`x' = total(standard`x')
gen w1`x' = standard`x' / sum`x'
}
*Step3:信息熵与冗余度
by id,sort: egen m = count(year)
foreach x