I want to save the mean value as well as the confidence interval in every iteration and plot it in a graph with x-axis in order of iteration. My code is attached below. Any suggestion is welcome.
Code:
capture program drop myboot program define myboot, rclass args i preserve use SmallOpenEconomy1.dta, clear bsample, cluster(id) idcluster(idnew) xtset, clear xtset idnew qdate xtreg F`i'.y exp0bp rec0bp $bpnlxlist , fe robust scalar byexph`i' = _b[exp0bp] scalar byrech`i' = _b[rec0bp] xtreg F`i'.g exp0bp rec0bp $bplinxlist, fe robust scalar bgexph`i' = _b[exp0bp] scalar bgrech`i' = _b[rec0bp] replace sumexpy = byexph`i' + sumexpy replace sumexpg = bgexph`i' + sumexpg replace sumrecy = byrech`i' + sumrecy replace sumrecg = bgrech`i' + sumrecg return scalar multexph`i' = sumexpy/sumexpg return scalar multrech`i' = sumrecy/sumrecg return scalar diffmult`i' = sumrecy/sumrecg - sumexpy/sumexpg restore end forvalues i = 1/20 { drop _all set obs 100 simulate multexph`i'=r(multexph`i') multrech`i'=r(multrech`i') diffmult`i'=r(diffmult`i'), saving(Multipliererd_`i',replace) reps(100): myboot `i' sum }
0 Response to How do I save the mean as well as the confidence interval results from bootstrap in every interation and plot it in a graph?
Post a Comment