Hello,

I have a research project involving country-level panel data where I want to model for uncertainty of the outcome variable and the independent variable of interest, each of which is a latent variable. These latent variables (constructed by other researchers) contain composite values derived from multiple other variables, not all of which were available for any given country and/or year. Each country-year observation of the latent variables is accompanied in an adjacent column by the standard deviation of the posterior distribution of the latent variable for each country-year observation.

I wish to follow the technique for modeling for uncertainty of the latent variables suggested by Charles D. Crabtree and Christopher J. Fariss in a 2015 article in Research and Politics (July-September, pp.1-9) titled “Uncovering Patterns Among Latent Variables: Human Rights and De Facto Judicial Independence.” As described by the authors, they: (1) duplicate their dataset 1,000 times; (2) assign a random draw from the posterior distribution of each latent variable to each country-year observation; (3) use each value thus obtained as new values for each country-year value of the latent outcome variable and independent variable of interest and estimate a set of 1,000 regression models; and then (4) combine the results across the multiple sets of data to create one set of coefficient and standard error estimates.

Crabtree and Fariss did their work using R, not Stata. For various reasons, I want to do my work in Stata, but have been unable to come up with a method to do so, despite my own efforts and consultation with experienced users of Stata (including one of the authors of the above-referenced article). To start things, I want to do this with xtreg with fixed effects, but also plan to use xtabond2 for additional models.

Below is a short sample of my data.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input int(i_code year) float(dep_var dep_var_post_sd ind_var ind_var_post_sd control_var1 control_var2)
1 2005  1.33 .27 .9403 .0377  .03395293 10.098463
1 2006  1.09 .27 .9403 .0369  .02516864 10.103597
1 2007  1.25 .26  .943 .0366  .01446522  10.09891
1 2008  1.19 .25 .9433 .0371 -.02323937 10.057076
1 2009   .78 .19 .9417 .0386 -.04175259  9.996817
2 2005 -1.69 .22 .1994 .0522  .01805011  6.534809
2 2006 -1.47 .18 .2093 .0571  .02249222  6.541407
2 2007  -1.4 .17 .2155 .0612  .03343279  6.558741
2 2008 -1.32 .17 .2183 .0636  .00843944   6.55176
2 2009 -1.35 .16 .2199 .0673  .03083248   6.56701
3 2005  -.68 .16 .4752 .0442   .0926275  8.366809
3 2006  -.58 .15 .4738 .0426  .10671155  8.453825
3 2007  -.62 .15 .4716 .0432  .08710414   8.52325
3 2008  -.67 .15 .4692 .0441  .03209504  8.541031
3 2009  -.76 .14 .4736 .0468  .00946155  8.536921
4 2005   .68 .32 .9646 .0285  .06083228  9.514385
4 2006     1 .34 .9617 .0318    .133764  9.629064
4 2007   .98 .33 .9589 .0339  .09498945  9.708728
4 2008   .97 .32 .9552 .0365  .00071111   9.69821
4 2009     1 .34 .9507 .0403 -.12036015  9.558898
end