/*compute daily mean and variance*/
bys newgrp: egen m=mean(ret5)
bys newgrp: egen sd=sd(ret5)
/*build 62 bins from -6% to 6% */
forvalues i=0/61{
gen bin`i'=0
}
/*compute daily probs for each bin*/
duplicates drop newgrp,force
replace bin0 = normal((-0.06-m)/sd)
replace bin61 = 1-normal((0.06-m)/sd)
forvalues i=1(1)60{
replace bin`i'=normal((i*0.002-0.06-m)/sd)-normal(((i-1)*0.002-0.06-m)/sd)
}
/*compute every bin's mean and variance*/
forvalues h=0(1)61{
bys month: egen mm`h'=mean(bin`h')
bys month: egen msd`h'=sd(bin`h')
}
第一个forvalues运行正常,运行到第二个forvalues的时候就显示i not found了,错误r(111), 挣扎了2个小时没有解决,求大神指导!



雷达卡




京公网安备 11010802022788号







