搜索
人大经济论坛 附件下载

附件下载

所在主题:
文件名:  Monte Carlo Simulations using Stata.pdf
资料下载链接地址: https://bbs.pinggu.org/a-2415937.html
附件大小:
263.83 KB   举报本内容
Monte Carlo Simulations using Stata
Oklahoma State University州立大学的Lee C. Adkins教授的课件,
主要内容包括:
Introduction
Software Choices
two methods used for simulation in Stata.
some examples from the paper.
compare speed of simulate, postfile, and gretl.
Paper Examples

pdf文件里面有书签,

为减轻网站流量负担,请各位战友根据论坛币下载。
祝各位战友学习愉快!!!



附件里的code如下:
replace x = theta*L.x + rnormal() in 2
replace u = rho*L.u + rnormal(0,sigma) in 2

replace y = beta*x+delta*L.y + u in 2

reg y x /* b1 */
reg L(0/1).y x /* b2 */
prais L(0/1).y x /* b3 */
reg L(0/2).y L(0/1).x /* b4 */
program regIV, rclass
tempname sim
postfile `sim' gam r2 b biv using results, replace
quietly {
foreach gam of numlist 0.025 0.0375 0.05 0.1 0.15 {
forvalues i = 1/$nmc {
replace u = rnormal()
replace x = `gam'*z+rho*u+rnormal(0,sige)
replace y = slope*x + u
....
}

regIV
use results, clear
by gam, sort: summarize r2 F biv b
by gam, sort: summarize p_ls p_iv
by gam: egen Fbar = mean(F) /* Avg F by gamma */
by gam: egen tslsbar = mean(biv) /* Avg biv by gamma */
by gam: egen olsbar = mean(b) /* Avg b by gamma */
by gam: egen r2bar = mean(r2) /* Avg r2 by gamma */
gen tsls_bias = tslsbar-1 /* IV bias */
gen ols_bias = olsbar-1 /* OLS bias */
gen relb = tsls_bias/ols_bias /* relative bias */
gen rot = 1/(Fbar-1) /* rule of thumb */
gen t = _n /* observation numbers */
keep if mod(t,1000) == 0 /* keep 1 obs per design */
reg relb c.rot##c.rot, noconst /* rel. bias onto rot */
reg relb rot, noconst
test (rot=-1) /* directly proportional? */
}
}
postclose `sim'
end

# Set the sample size and save it in n
nulldata 100
scalar n = $nobs
set seed 3213799
# Set the values of the parameters
scalar slope = 10
scalar sigma = 20
scalar delta = .7
scalar rho = .9
# initialize variables
series u = normal()
series y = normal()
series x = uniform()

loop 400 --progressive --quiet
series e = normal(0,sigma)
series u=rho*u(-1)+e
series y = slope*x + delta*y(-1) + u
ols y const x y(-1)
ols y const x
ar 1; y const x y(-1)
ols y const x y(-1) x(-1) y(-2)
endloop



    熟悉论坛请点击新手指南
下载说明
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。
2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。
3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。
(如有侵权,欢迎举报)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

GMT+8, 2026-1-8 00:02