EViews-蒙特卡洛模型代码

脚本 config.png 代码:


!b1=0
!b2=1
matrix(500,3) f

for !k=1 to 500

series u=nrnd
series y= !b1+!b2*temp+u
equation el.ls y=c(1)+c(2)*temp

series y1=constant-y/10.0
series y2=(y1>0)*y1+(y1<0)*0
series hdd=@sum(y2)

f(!k,1)=@sum(hdd)
f(!k,2)=500
f(!k,3)=exp(-0.15)/500*((f(!k,1)>f(!k,2))*(f(!k,1)-f(!k,2)) + ( f(!k,1)<f(!k,2))*0)

next

 

posted @ 2019-07-30 10:22  老壳藤  阅读(912)  评论(0编辑  收藏  举报