十八讲里面 随机模拟部分 掷一枚硬币10 次,结果中会出现至少3 个连续正面或者至少3 个连续反面的概率是多少?
capture prog drop seq3
prog seq3
drop _all
rndbin 10 0.5 1
gen z=0
forvalues i=3/10{replace z=1 if xb==xb[_n-1]&xb==xb[_n-2] in `i'}
sum z
end
simulate max=r(max),reps(10000) nodots:seq3
sum
结果系统提示:
unrecognized command: rndbin
an error occurred when simulate executed seq3
亲,你好 请问你的stata里面有(取整函数)trunc函数么? 我这里显示trunc not found[大哭] 怎么弄到trunc函数呢?
输入ssc install trunc后显示ssc install: "trunc" not found at SSC, type -findit trunc-