Dear Stata users,
I am estimating the OLS model below and then use it to compute the linear prediction using values of covariates (i.e. xa2, xa3, etc.) from an external dataset (as shown in table below)
reg outcome xa2 xa3 xb2 xb3 xc2 xc3 xd2 xd3 xe2 xe3 z3
I would like to repeat this process N times to reflect the uncertainty in the regression coefficients via simulation and store the results of each simulation as a new column in the external dataset.
As I am not an experienced Stata programmer, I'd need a few hints about where to start.
Thanks!
I am estimating the OLS model below and then use it to compute the linear prediction using values of covariates (i.e. xa2, xa3, etc.) from an external dataset (as shown in table below)
reg outcome xa2 xa3 xb2 xb3 xc2 xc3 xd2 xd3 xe2 xe3 z3
I would like to repeat this process N times to reflect the uncertainty in the regression coefficients via simulation and store the results of each simulation as a new column in the external dataset.
xa2 | xa3 | xb2 | xb3 | ... | xe3 | z3 | prediction1 | prediction2 | prediction3 | ... | predictionN |
1 | 0 | 0 | 1 | 1 | 1 | ||||||
0 | 1 | 0 | 1 | 0 | 1 | ||||||
0 | 0 | 1 | 0 | 1 | 1 |
Thanks!