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
Related Posts with Monte Carlo simulation comparing output for OLS and 2SLS by saving beta and se's in matrix
Understanding and interpreting the large coefficients of control variables in my results tableHi, I am running a panel regression with a DiD setup and fixed-effects. I have obtained significant…
Choosing the Correct Panel Data ModelHi there, I am estimating a fiscal reaction function in dynamic form (lagged dependent variable) and…
Standard errors with new -xthdidregress- command in Stata 18I am trying to understand how -xthdidregress- estimates standard errors for difference-in-difference…
Help with stcrreg / competing regressionDear All, I am trying to perform a competing regression analysis but receiving the following error.…
Baseline Balance - T-Test - Missing ValuesI want to create a balance table on STATA. It is a baseline dataset conducted as a part of an RCT. H…
Subscribe to:
Post Comments (Atom)
0 Response to Monte Carlo simulation comparing output for OLS and 2SLS by saving beta and se's in matrix
Post a Comment