快deadline還沒研究出来!回国无法问导师!菜鸟求助编程!eviews做monte carlo projec
发布:kobe_de | 分类:Eviews软件培训
关于本站
人大经济论坛-经管之家:分享大学、考研、论文、会计、留学、数据、经济学、金融学、管理学、统计学、博弈论、统计年鉴、行业分析包括等相关资源。
经管之家是国内活跃的在线教育咨询平台!
经管之家新媒体交易平台
提供"微信号、微博、抖音、快手、头条、小红书、百家号、企鹅号、UC号、一点资讯"等虚拟账号交易,真正实现买卖双方的共赢。【请点击这里访问】
TOP热门关键词
题目见附件的图。有没有比较懂eviews编程的教一下我吖?老师给了个example做参考,自己修改command来做某个topic。有偿求助吖!!谁在这方面比较懂加我qq248556335老师原来sample的2个文件command,只有一个解释变量 ...
免费学术公开课,扫码加入 |
题目见附件的图。有没有比较懂eviews编程的教一下我吖?老师给了个example做参考,自己修改command来做某个topic。
有偿求助吖!!谁在这方面比较懂加我qq 248556335
老师原来sample的2个文件command,只有一个解释变量的,现在做2个怎么改
' OLS Monte Carlo Simulation
'generate the explanatory variable and save the data for use later
!n=5'number of observations
cd "H:\mc_exe"
workfile genx u 1 !n
series x=@runif(0,10) 'generate the explanatory variable from uniform distribution U(0,10).
freeze(tabx) x 'create a table oject called tabx and store x into it
'save the explanatory variable as csv file (comma-separated-value pure text file)
'the file name is x5 (5 is the sample size)
tabx.save x5
close genx
============================================
' OLS Monte Carlo Simulation
!n=5'number of observations
'set the number of simulations !s in the MC experiment
'or we can call !s the number of artificial data sets
!s=20
'any scalars starting with "!" will not be saved in the workfile
'they are just used during the program running
'define the workfile range !r
if !n>!s then
!r=!n
else
!r=!s
endif
workfile olssim u 1 !r
smpl 1 !n
'read the explanatory variable from the file generated by mc_genx.prg into a series called x
read(skipcol=1,skiprow=3) x5.csv x
vector(2) b 'create a vector to store the true value of intercept and slope
b(1)=1 'true value of intercept
b(2)=2 'true value of the slope
scalar sigma=10 'true value of sigma
scalar sigmasq=sigma^2 'true value of sigma square
series ey=b(1)+b(2)*x 'the expected mean of y
series intpt=1 'the intercept
group xg intpt x 'create a group called xg with intpt and xs as columns
stom(xg,xm) 'transform xg into the explanatory variable matrix x
matrix varb=sigmasq*@inverse(@transpose(xm)*xm)'the true variance-covariance matrix of beta_hat
scalar sdb1=varb(1,1)^0.5 'the true standard deviation of the intercept estimator
scalar sdb2=varb(2,2)^0.5 'the true standard deviation of the slope estimator
scalar df=!n-2 'degrees of freedom
scalar a=0.05 'set the level of significance
'calculate the critical values for the t-distribution
scalar tlb=@qtdist(a/2,df) 'the t critical value, 2.5% quantile if a=0.05
scalar tub=@qtdist(1-a/2,df) 'the t critical value, 97.5% quantile if a=0.05
'change the range of the work file and initialize the series to store the estimated values
smpl 1 !s
series b1hat=0 'this is to store the estimated values of intercept
series seb1hat=0 'this is to store the estimated standard error of the intercept estimator
series b2hat=0 'this is to store the estimated values of slope
series seb2hat=0 'this is to store the estimated standard error of the slope estimator
series sigmahat=0 'this is to store the estimated values of sigma
series sigmasqhat=0 'this is to store the estimated values of sigma square
scalar t1err=0 'this is to store how many Type I errors committed
vector(2) ebhat 'create a vector called ebhat to calculate the sample average of bhat
vector(2) ebhatt 'create another vector to store temporary values
matrix(2,2) varbhat 'create a matrix called varbhat to estimate the variance matrix of bhat
smpl 1 !n
series y=0 'initialize the dependent variable
'the for loop for simulations, do it !s times
for !i=1 to !s
smpl 1 !n
y=ey+@nrnd*sigma 'generate the dependent variable
equation eq.ls y c x 'create an equation call eq and run the ols
smpl 1 !s
b1hat(!i) = eq.@coefs(1) 'store the intercept estimate
seb1hat(!i)=eq.@stderrs(1) 'store the intercept estimated standard deviation
b2hat(!i) = eq.@coefs(2) 'store the slope estimate
seb2hat(!i)=eq.@stderrs(2) 'store the slope estimated standard deviation
sigmahat(!i)=eq.@se 'store the estimated standard deviation of regression
sigmasqhat(!i)=sigmahat(!i)^2 'store the estimated variance of regression
ebhatt(1)=b1hat(!i)
ebhatt(2)=b2hat(!i)
ebhat=ebhat+ebhatt
varbhat=varbhat+ebhatt*@transpose(ebhatt)
'calculate the lower and upper bound under H0:slope=slope_true given the level of significance
'if the estimated slope is outside the bounds, we reject H0 and make a Type I error
!slb2=b(2)+seb2hat(!i)*tlb 'the lower bound
!sub2=b(2)+seb2hat(!i)*tub 'the upper bound
if (b2hat(!i)<!slb2) or (b2hat(!i)>!sub2) then
t1err=t1err+1'if we reject H0:slope=slope_true, we make a Type I error
endif 'if condition finishes here
next 'for loop finishes here
t1err=t1err/!s 'percentage of Type I errors committed
ebhat=ebhat/!s
varbhat=varbhat/!s-ebhat*@transpose(ebhat)
delete ebhatt
'the following is to calculate the power of the t test based on different (wrong) test values
!mintv=0 'minimum test value
!maxtv=4 'maximum test value
!ntestv=101 'number of test values
!step=(!maxtv-!mintv)/!ntestv 'step size
'create a !ntestv by 2 matrix called ptest
'the first column stores the wrong test values while the second stores the power of tests
matrix(!ntestv,2)ptest
series reject=0 'initialize a series to store the occurrences of rejecting the wrong hypothesis
for !i=1 to !ntestv
ptest(!i,1)=!mintv+(!i-1)*!step 'the test value
reject=@recode(((b2hat-ptest(!i,1))/seb2hat<tlb) or ((b2hat-ptest(!i,1))/seb2hat>tub), 1, 0 )
ptest(!i,2)=@sum(reject)/!s
next
ptest.xy 'plot the power of test curve column 2 (c2) against column 1 (c1)
「经管之家」APP:经管人学习、答疑、交友,就上经管之家!
免流量费下载资料----在经管之家app可以下载论坛上的所有资源,并且不额外收取下载高峰期的论坛币。
涵盖所有经管领域的优秀内容----覆盖经济、管理、金融投资、计量统计、数据分析、国贸、财会等专业的学习宝库,各类资料应有尽有。
来自五湖四海的经管达人----已经有上千万的经管人来到这里,你可以找到任何学科方向、有共同话题的朋友。
经管之家(原人大经济论坛),跨越高校的围墙,带你走进经管知识的新世界。
扫描下方二维码下载并注册APP
免流量费下载资料----在经管之家app可以下载论坛上的所有资源,并且不额外收取下载高峰期的论坛币。
涵盖所有经管领域的优秀内容----覆盖经济、管理、金融投资、计量统计、数据分析、国贸、财会等专业的学习宝库,各类资料应有尽有。
来自五湖四海的经管达人----已经有上千万的经管人来到这里,你可以找到任何学科方向、有共同话题的朋友。
经管之家(原人大经济论坛),跨越高校的围墙,带你走进经管知识的新世界。
扫描下方二维码下载并注册APP
您可能感兴趣的文章
- Eviews软件 ... | [交流讨论]eviews6.0中面板数据处 ...
- Eviews软件 ... | 【45个论坛币(全部家当)求助】 ...
- Eviews软件 ... | [求助]请问该如何用eviews计算股 ...
- Eviews软件 ... | 使用Eviews解多元回归分析方程
- Eviews软件 ... | Eviews新手求助!!!帮忙分析一 ...
- Eviews软件 ... | [求助]用eviews做johansen协整第 ...
- Eviews软件 ... | 高分悬赏做eviews回归的一个错误 ...
- Eviews软件 ... | 求救!!数据是矩阵的怎样用Evie ...
人气文章
本文标题:快deadline還沒研究出来!回国无法问导师!菜鸟求助编程!eviews做monte carlo projec
本文链接网址:https://bbs.pinggu.org/jg/ruanjianpeixun_eviewsruanjianpeixun_1309294_1.html
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。