Hi everyone
I'm interested whether a variable (foreign) modifies the effect of X (trunk) on Y (mpg). Here's an example:
To do so, I test the difference in slopes for domestic and foreign cars with -margins-:
Super easy, yields the following output:
My question, as I have to do this one billion times: What is the best practice to access the contrast (0.2638674) and its p-value (0.453) to write it into the notes of figures? E.g. _b[trunk:1vs0.foreign]] doesn't work 
Thanks so much
Go
I'm interested whether a variable (foreign) modifies the effect of X (trunk) on Y (mpg). Here's an example:
Code:
sysuse auto, clear regress mpg c.trunk##foreign
Code:
margins, dydx(trunk) over(foreign) pwcompare(effects)
Code:
Pairwise comparisons of average marginal effects
Model VCE: OLS Number of obs = 74
Expression: Linear prediction, predict()
dy/dx wrt: trunk
Over: foreign
--------------------------------------------------------------------------------------
| Contrast Delta-method Unadjusted Unadjusted
| dy/dx std. err. t P>|t| [95% conf. interval]
---------------------+----------------------------------------------------------------
trunk |
foreign |
Foreign vs Domestic | .2638674 .3493065 0.76 0.453 -.4328025 .9605373
--------------------------------------------------------------------------------------

Thanks so much
Go

Comment