stata十八讲中第10章随机模拟中10.2简单模拟中有个do文件看不懂,尤其是forvalues循环那个地方,它是怎么循环的?请大家帮忙解释下
capt prog drop seq3
prog seq3,rclass
version 9
drop _all
set obs 10
tempvar x y z
gen `x'=int(10*uniform())
gen `y'=(mod(`x',2)==0)
gen `z'=0
forvalues i=3/10{
replace `z'=1 if `y'==`y'[_n-1]&`y'=`y'[_n-2] in `i'
}
sum `z'
return scalar max=r(max)
end
simulate max=r(max),reps(10000) nodots:seqe3
sum
先在此谢过!