I am running Linear Probability Models with interactions and would like to calculate relative effects.
Here is an example. I use the nlsw88-data and regress the probability of being married against an interaction between college attainment (binary) and income (continuous). What I want to calculate: the relative effect of college attainment, at different income levels, e.g. at values 5, 10 and 15.
Here is my code:
Code:
sysuse nlsw88,clear reg married i.collgrad##c.wage margins collgrad, at(wage== (5 10 15)) post
Code:
. margins collgrad, at(wage== (5 10 15)) post Adjusted predictions Number of obs = 2,246 Model VCE : OLS Expression : Linear prediction, predict() 1._at : wage = 5 2._at : wage = 10 3._at : wage = 15 ------------------------------------------------------------------------------------- | Delta-method | Margin Std. Err. t P>|t| [95% Conf. Interval] --------------------+---------------------------------------------------------------- _at#collgrad | 1#not college grad | .6452051 .0123095 52.42 0.000 .6210659 .6693443 1#college grad | .6846007 .0275997 24.80 0.000 .630477 .7387244 2#not college grad | .6331711 .0134103 47.22 0.000 .6068732 .6594691 2#college grad | .6502325 .020849 31.19 0.000 .6093471 .6911179 3#not college grad | .6211372 .0211735 29.34 0.000 .5796154 .6626589 3#college grad | .6158643 .0254564 24.19 0.000 .5659437 .6657849 -------------------------------------------------------------------------------------
What I want now is calculate the relative effect of college education. This should be similar to the Relative Risk Ratio (RRR).
I could do this by hand: divide the predicted probability of being married for those with college attainment by the value for those without college attainment; separately for all levels of income. For the low income group, I would calculate: .6846007 / .6452051.
Here is how I could do this in Stata:
Code:
. display e(b)[1,2] / e(b)[1,1] 1.0610591 . display e(b)[1,4] / e(b)[1,3] 1.0269459 . display e(b)[1,6] / e(b)[1,5] .99151097
How can I calculate these ratios including standard errors / confidence intervals?
In the third step, I would like to plot these ratios.
I'm using Stata 16.1.
Best
Michael
0 Response to Linear probability models with interactions: how can I calculate relative effects / relative risk ratios?
Post a Comment