I apologize if this is a trivial question but I have never performed any bootstrap operation in Stata before and I could not find an answer to my question.
I would like to bootstrap some operation performed over correlation coefficients, such as a mean of two correlation coefficients:
And then loop it over a list of countries (which takes the values of 1,3,8,56,...,99).
This does the job, however I could not find a way to store, for each country, the value of the coefficient, the standard errors and the number of observations.
Many thanks for your help!
I would like to bootstrap some operation performed over correlation coefficients, such as a mean of two correlation coefficients:
Code:
program mean_r1r2, rclass version 14 corr var1 var2 local corr12 = r(rho) corr var2 var3 local corr23 = r(rho) return scalar mean = (`corr12' + `corr23') /2 end
Code:
levelsof country, local(levels) foreach l of local levels { preserve keep if country == `l' bootstrap r(mean), reps(100) seed(1234): mean_r1r2 restore }
Many thanks for your help!
Comment