Hi all! I am interested in compare if two marginal effects are statistically different. For this I estimate the model (see below) interacting x1 (dummy variable) with the squared effect of z2) and then I ask for the margins at different levels of the variable (see also below) which I want to plot using the marginsplot. However, I would like to know if the dots in the graph are statistically different, but do not know how to do it. For instance, are the points (blue and red) different when z2 = 2? And when z2 = 4 … So, it would be to compare the difference between the points 1 and 10, 2 and 11, 3 and 12 ... that comes from the margins command.
Any hint of how to compare only these two point at each level of the horizontal values?

Any hint of how to compare only these two point at each level of the horizontal values?
Code:
. xi: reghdfe y L.c.x0 x1##(L.c.z1 L.c.z2##L.c.z2 L.c.z3##L.c.z3 L.c.z4##L.c.z4 L.c.z5 L.c.z6) L.z7 > L.z8, absorb(year sic , resid) cluster(id) (MWFE estimator converged in 4 iterations) HDFE Linear regression Number of obs = 37,658 Absorbing 2 HDFE groups F( 22, 3919) = 2.72 Statistics robust to heteroskedasticity Prob > F = 0.0000 R-squared = 0.0494 Adj R-squared = 0.0475 Within R-sq. = 0.0028 Number of clusters (id) = 3,920 Root MSE = 23.1123 (Std. Err. adjusted for 3,920 clusters in id) -------------------------------------------------------------------------------- | Robust y | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------------+---------------------------------------------------------------- x0 | L1. | 2.49e-06 2.37e-06 1.05 0.294 -2.16e-06 7.13e-06 | 1.x1 | 1.883213 1.235881 1.52 0.128 -.5398174 4.306244 | z1 | L1. | -.2964713 12.13272 -0.02 0.981 -24.08351 23.49057 | z2 | L1. | -4.026786 1.893019 -2.13 0.033 -7.738181 -.3153913 | cL.z2#cL.z2 | .4009453 .19074 2.10 0.036 .0269863 .7749043 | z3 | L1. | 2.747229 1.249137 2.20 0.028 .2982093 5.19625 | cL.z3#cL.z3 | -.1124632 .0625297 -1.80 0.072 -.2350571 .0101307 | z4 | L1. | .0726518 .0541094 1.34 0.179 -.0334334 .1787369 | cL.z4#cL.z4 | -.0003602 .0003384 -1.06 0.287 -.0010237 .0003034 | z5 | L1. | -3.043936 1.390834 -2.19 0.029 -5.770762 -.317109 | z6 | L1. | -.1185258 1.488848 -0.08 0.937 -3.037516 2.800464 | x1#cL.z1 | 1 | 11.87853 31.12594 0.38 0.703 -49.14603 72.90309 | x1#cL.z2 | 1 | .0286455 2.927208 0.01 0.992 -5.710349 5.76764 | x1#cL.z2#cL.z2 | 1 | .3472693 .3311889 1.05 0.294 -.3020496 .9965882 | x1#cL.z3 | 1 | .1076445 1.333236 0.08 0.936 -2.506257 2.721546 | x1#cL.z3#cL.z3 | 1 | -.0340614 .0781688 -0.44 0.663 -.1873169 .119194 | x1#cL.z4 | 1 | .0377201 .0763688 0.49 0.621 -.1120064 .1874465 | x1#cL.z4#cL.z4 | 1 | -.0002813 .0006353 -0.44 0.658 -.0015268 .0009643 | x1#cL.z5 | 1 | 10.37873 5.157279 2.01 0.044 .2675252 20.48993 | x1#cL.z6 | 1 | -8.44048 5.524799 -1.53 0.127 -19.27223 2.391272 | z7 | L1. | 5.277954 6.287417 0.84 0.401 -7.048964 17.60487 | z8 | L1. | -7.52538 5.73605 -1.31 0.190 -18.7713 3.720544 | _cons | 9.368137 1.864782 5.02 0.000 5.712101 13.02417 -------------------------------------------------------------------------------- Absorbed degrees of freedom: -----------------------------------------------------+ Absorbed FE | Categories - Redundant = Num. Coefs | -------------+---------------------------------------| year | 11 0 11 | sic | 43 1 42 | -----------------------------------------------------+ . . margins, dydx(L.z2) at(L.z2=(0(2)16) x1=(0 1)) noestimcheck post vsquish Average marginal effects Number of obs = 37,658 Model VCE : Robust Expression : Linear prediction, predict() dy/dx w.r.t. : L.z2 1._at : x1 = 0 L.z2 = 0 2._at : x1 = 0 L.z2 = 2 3._at : x1 = 0 L.z2 = 4 4._at : x1 = 0 L.z2 = 6 5._at : x1 = 0 L.z2 = 8 6._at : x1 = 0 L.z2 = 10 7._at : x1 = 0 L.z2 = 12 8._at : x1 = 0 L.z2 = 14 9._at : x1 = 0 L.z2 = 16 10._at : x1 = 1 L.z2 = 0 11._at : x1 = 1 L.z2 = 2 12._at : x1 = 1 L.z2 = 4 13._at : x1 = 1 L.z2 = 6 14._at : x1 = 1 L.z2 = 8 15._at : x1 = 1 L.z2 = 10 16._at : x1 = 1 L.z2 = 12 17._at : x1 = 1 L.z2 = 14 18._at : x1 = 1 L.z2 = 16 ------------------------------------------------------------------------------ | Delta-method | dy/dx Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- L.z2 | _at | 1 | -4.026786 1.893019 -2.13 0.033 -7.737034 -.3165376 2 | -2.423005 1.14849 -2.11 0.035 -4.674003 -.1720065 3 | -.8192236 .4677103 -1.75 0.080 -1.735919 .0974718 4 | .7845576 .5316891 1.48 0.140 -.2575339 1.826649 5 | 2.388339 1.229166 1.94 0.052 -.0207827 4.79746 6 | 3.99212 1.975657 2.02 0.043 .1199029 7.864337 7 | 5.595901 2.731265 2.05 0.040 .2427198 10.94908 8 | 7.199682 3.490074 2.06 0.039 .359264 14.0401 9 | 8.803464 4.250369 2.07 0.038 .4728943 17.13403 10 | -3.99814 3.19066 -1.25 0.210 -10.25172 2.255438 11 | -1.005282 2.034104 -0.49 0.621 -4.992052 2.981488 12 | 1.987577 1.478142 1.34 0.179 -.9095277 4.884681 13 | 4.980435 2.07901 2.40 0.017 .9056501 9.05522 14 | 7.973294 3.248033 2.45 0.014 1.607265 14.33932 15 | 10.96615 4.568065 2.40 0.016 2.01291 19.91939 16 | 13.95901 5.939256 2.35 0.019 2.318282 25.59974 17 | 16.95187 7.332965 2.31 0.021 2.579522 31.32422 18 | 19.94473 8.738423 2.28 0.022 2.817733 37.07172 ------------------------------------------------------------------------------ . marginsplot,
Comment