I have a logit model with an interaction term. I want to test this interaction coefficient across two sub-samples (divided based on some value of another variable). Since logistic models, interpretation of coefficients requires marginal analysis (Ai and Norton, 2003), I performed marginal analysis after running the model for each sub-sample. I don't know how I can show the statistical difference of the marginal values across these two sub-samples. I am going to use the "birth-weight data" to clarify further what I mean.
webuse lbw
logit low i.smoke##c.lwt ftv ptl if ui==0
su ptl if e(sample), detail
global ptl_mean = r(mean)
display $ptl_mean
global ptl_sd = r(sd)
display $ptl_sd
global ptl_mean_plus_sigma = $ptl_mean + $ptl_sd
display $ptl_mean_plus_sigma
global ptl_mean_plus_twosigma = $ptl_mean + 2*$ptl_sd
display $ptl_mean_plus_twosigma
margins if e(sample), dydx (smoke) at( (mean) _all ptl=(0 $ptl_mean $ptl_mean_plus_sigmaa $ptl_mean_plus_twosigma )) predict(pr) saving(m1, replace)
logit low i.smoke##c.lwt ftv age ptl if ui==1
su ptl if e(sample), detail
global ptl_mean = r(mean)
display $ptl_mean
global ptl_sd = r(sd)
display $ptl_sd
global ptl_mean_plus_sigma = $ptl_mean + $ptl_sd
display $ptl_mean_plus_sigma
global ptl_mean_plus_twosigma = $ptl_mean + 2*$ptl_sd
display $ptl_mean_plus_twosigma
margins if e(sample), dydx (smoke) at( (mean) _all ptl=(0 $ptl_mean $ptl_mean_plus_sigmaa $ptl_mean_plus_twosigma )) predict(pr) saving(m2, replace)
Now, I use the user-written command --combomarginsplot-- to combine the two marginal plots:
graph set window fontface "Times New Roman"
#delimit ;
combomarginsplot m1 m2,
labels("ui==0" "ui==1" position(3))
title("Marginal Effects of ptl on low brith weight likelihood", size(medium))
xtitle("ptl", size(small))
ytitle("Change in likelihood", size(small))
xlabel(,labsize(small))
ylabel(,labsize(small))
legend(size(small))
noci file1opts(lpattern(shortdash) msymbol(i))
file2opts(lpattern(dash) msymbol(D));
#delimit;
graph save "Graph" "marginal.gph",replace
The graph will be:
One might say that it is easy to say that the marginal values of the second sub-sample (i.e., ui==1) are not different from zero. Hence, we can conclude that the marginal values when ui==0 are greater than the marginal values when ui==1.
What if marginal values across both sub-samples were statistically significant. How can one test their statistical difference?
Thanks, Navid