Guest User

Untitled

a guest
Jul 16th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. * generate SEM data
  2. clear
  3. set obs 1000
  4. gen x1 = rnormal(0,1)
  5. gen e1 = rnormal(0,1)
  6. gen e2 = rnormal(0,1)
  7.  
  8. local a0 = 1
  9. local a1 = 2
  10. local a2 = 3
  11. local g0 = 4
  12. local g1 = 5
  13.  
  14. local y1c = (1-`a1'*`g1')
  15. local y2c = (1-`g1'*`a1')
  16.  
  17. gen y1 = (`a0' + `a1'*`g0' + `a1'*e2 + `a2'*x1 + e1)/`y1c'
  18. gen y2 = (`g0' + `g1'*`a0' + `g1'*`a2'*x1 + `g1'*e1 + e2)/`y2c'
  19.  
  20. ivregress 2sls y2 (y1 = x1)
Add Comment
Please, Sign In to add comment