楼主: 沉默的烽火
2138 2

[编程问题求助] stata中ACF生产率估计的抽样与迭代 [推广有奖]

  • 5关注
  • 16粉丝

讲师

31%

还不是VIP/贵宾

-

威望
0
论坛币
637 个
通用积分
42.3361
学术水平
0 点
热心指数
2 点
信用等级
0 点
经验
625 点
帖子
149
精华
0
在线时间
526 小时
注册时间
2017-10-17
最后登录
2024-7-16

楼主
沉默的烽火 学生认证  发表于 2019-8-29 10:43:19 |AI写论文
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~=.


关键词:Stata tata 生产率 ACF observations

沙发
xujingjun 发表于 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组,但是不是很明白后续怎么做

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-1 16:05