Hi
In my simulation I am trying to compare output from OLS and 2SLS. I have the following code which saves beta for each in a matrix but I also want to save the standard errors for both OLS and 2SLS. Could you please advise how se's can be added.
set seed 10101

capture program drop mcsimb
program mcsimb, eclass
clear
** change this for Nobs
set obs 500
* z1 & z2 are normally distributed
gen z1=rnormal()
gen z2=rnormal()
* create u and v based on the given correlation, and assume that otherwise the variance is 1
matrix corruv=[1,.8\.8,1]
drawnorm u v , corr(corruv)
* generate X
gen x=1+5*z1+10*z2+v
* generate y
gen y=1+x+u
* estimate models
reg y x
matrix b= _b[x]
ivregress 2sls y (x=z1 z2)
matrix b=b,_b[x]
matrix colname b= ols iv
ereturn post b
end

simulate, reps(1000): mcsimb
summarize

Thank you
Kate