here is the example, please run it in Stata, and ignore the issue of significance.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(gini pcgdp pcgdp2 state trans) 59 6.34 40.2 6 1.9 48.9 6.51 42.3 3.1 3.2 35 6.55 42.9 4.2 1.1 57 6.77 45.8 13.2 6.9 40 6.77 45.8 6 1.8 36.7 6.9 47.6 12.4 4.7 57.3 6.92 47.9 7.5 5.6 49 6.94 48.1 1.3 1.8 60 6.94 48.2 3.3 1 51.3 7.13 50.8 3.4 6.1 50.1 7.22 52.2 15.2 12.2 54 7.27 52.8 11.3 7.3 52.5 7.3 53.4 18.3 6.8 59.1 7.31 53.4 9.6 1.1 38.3 7.49 56.1 2.8 1.6 51 7.51 56.4 5.1 2.4 43 7.57 57.3 19.3 7.7 57 7.66 58.6 7.5 5.9 43 7.66 58.7 23.3 4.6 45.5 7.68 59 11.8 2.8 53.3 7.77 60.4 5 6.3 59.5 7.8 60.8 5.8 3.3 38.2 7.81 61 20.4 12 44.5 7.87 62 11 5.5 39.9 7.89 62.2 50.8 8.6 39.7 7.9 62.3 22.2 5.4 44.5 7.94 63.1 23.7 6.8 57 8.03 64.5 14.8 3.4 47.8 8.1 65.5 6.2 4.3 42.9 8.18 66.9 26.9 7.9 56.5 8.24 67.9 17.3 13.2 51.6 8.24 68 10.7 2 43.8 8.27 68.4 13.6 7.3 26 8.34 69.6 70.4 17.5 63 8.35 69.6 8.4 2.3 46 8.37 70.1 16.9 12.2 47.6 8.38 70.2 15.2 7.6 25.7 8.43 71.1 95.2 11.7 63.3 8.44 71.2 11.7 5.5 48.2 8.46 71.6 9.2 19.1 37.9 8.49 72 78.9 13.1 57 8.5 72.3 13.2 8.9 48.4 8.53 72.8 8.4 8 50.6 8.58 73.6 21.4 5.6 44.1 8.64 74.6 19.3 5.6 35.7 8.65 74.7 9.3 2.9 42.4 8.66 75.1 21.4 10.5 23.1 8.69 75.5 93.9 19.9 38.1 8.7 75.6 14.2 17.1 39.9 8.77 76.9 10.7 16.7 34.6 8.86 78.4 19.6 25.1 19.5 8.91 79.4 98.8 21.3 31.5 9.02 81.3 13.7 18.1 35.7 9.04 81.7 12.2 8.8 41 9.25 85.6 10.4 18.3 33.3 9.29 86.4 27.1 22.1 42.8 9.31 86.6 18.6 1.2 30 9.33 87.1 24.7 19.6 24.9 9.42 88.8 37.9 27.9 32.1 9.45 89.3 15 31.1 31.3 9.47 89.7 20.9 24.4 27.4 9.47 89.7 22.5 30.3 28.1 9.48 89.8 22.8 19.8 30.7 9.52 90.6 21.2 31 28 9.52 90.6 29.4 33.3 35 9.52 90.7 9.5 17.5 26.9 9.53 90.9 24.8 27.1 20.2 9.55 91.1 28.7 22 48.5 9.55 91.2 7.9 2.9 31.6 9.58 91.9 29.3 17.1 27.8 9.59 92 22.3 25.7 22.9 9.61 92.4 36.2 32.2 32 9.78 95.7 24.1 21.5 35.5 9.78 95.7 10.4 14.9 34.4 9.9 97.9 15.8 17.7 end reg gini c.pcgdp##c.pcgdp state trans, robust display -(_b[pcgdp]/(2*_b[c.pcgdp#c.pcgdp])) reg gini c.pcgdp##c.pcgdp##c.state , robust sum pcgdp state margins, at(pcgdp=(7(0.05)10) state=(5 34 64 )) marginsplot, ytitle("gini") xtitle("pcgdp") /// title("") /// legend(order(1 "-1SD" 2 "MEAN" 3 "+1SD" )) noci
Code:
display -(_b[pcgdp]/(2*_b[c.pcgdp#c.pcgdp]))
However, I would like to calculate the turning points in Stata when the moderator `state` equals different values, for example `state=5` and `state=34`.
Any documentation (not only limited to code) that can enlighten me please let me know, thank you for your help.
0 Response to How can I calculate the turning point of a moderator at given values in Stata?
Post a Comment