全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
2139 2
2019-08-29
悬赏 100 个论坛币 未解决
开门见山,需要用到ACF生产函数估计所以去下载了公开的do文件学习,但是不是很理解其中的抽样过程。根据原始代码,ACF抽样100次,然后通过内部的函数估计出100组参数,这100组参数如何使用?(因为我理解的参数估计是通过不断迭代最后估出唯一的一组参数,且ACF原始do文件里面也没有进一步的代码解释)
自学很多东西都在摸索中,如果问题问的不是很明确还请各位老师指出,谢谢!

附上原始代码如下:
global nrep 100
matrix A =J($nrep,4,99)
*****************************
/** Here we start the code to allow us to bootstrap the sample **/
sort plantid year
egen gid=group(plantid)
qui su gid
scalar tt=r(max)
sort gid year
by gid: gen count=_N   
by gid: gen smalln=_n
sort gid smalln
save tempk, replace
local i=1
while `i' < $nrep + 1 {
     use tempk, clear
     /** Here we draw random samples with replacement. We sample each
     set of plant level observations as an independent block.**/
     quietly {
         keep if gid[_n]~=gid[_n-1]  
         sort gid
         keep gid count
         save temp1, replace
         set seed `i'
         gen kk=int(tt*uniform()+1)
         keep kk
         gen test=99
         rename kk gid
         sort gid
         merge n:1 gid using temp1
         drop _merge
         keep if test~=.
         drop test
         egen fill=fill(1 2/3)
         expand count
         sort fill gid
         by fill: gen smalln=_n
         sort gid smalln
         merge n:1 gid smalln using tempk
         drop _merge
         drop if fill==.
         ren plantid oldplantid
         ren fill plantid
         save temp2, replace
         }


*********************************
disp "Bootstrap replication `i'"
do D:\ACF\acf_solution.do

matrix A[`i',1]=`i'
matrix A[`i',2]=vcoef[1,1]
matrix A[`i',3]=vcoef[1,2]
matrix A[`i',4]=vcoef[1,3]
local i=`i'+1

}

matrix coln A = iter_num lcoef kstarcoef delta2coef
svmat A, name(col)

keep iter_num *coef
keep if iter_num~=.


二维码

扫码加我 拉你入群

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

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

全部回复
2019-8-29 12:17:36
二维码

扫码加我 拉你入群

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

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

2019-8-29 12:37:00
/** This code generates 100 block-boostrapped samples of the data, and then calls
the acf_solution.do program to generate corresponding ACF production function coefficient
estimates.  The directory/data file names  need to be modified as necessary ***/

这是code开头附上的注解,我理解没错的话就是估了100组,但是不是很明白后续怎么做
二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群