悬赏 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~=.