estimates use m2 // Open estimates saved via -estimates save-
xtcloglog // Show results
// Set esample() as explained in the help-file to -estimates save-:
mark miss_mod1
markout miss_mod1 fail2 female age1519 age2529 age3034 ///
hatlev1d loggdp hatfield_main
estimates esample: if miss_mod1
// Calculate predicted probabilities:
margins female#hatlev1d, pred(pu0)
// Simple default marginsplot:
marginsplot, xtitle("Gender") ytitle("Predicted probability") ///
caption("{it:Source:} EU-LFS 2009 AHM", span) ///
title("") name(sexXeduc1, replace)
// As a bar graph:
marginsplot, xtitle("") ytitle("Predicted probability") title("") ///
recast(bar) /// // Draw bar graph instead of default
xdimension(female hatlev1d) ///
/* Get both interacting variables onto x-axis */ ///
caption("{it:Source:} EU-LFS 2009 AHM", span) ///
name(sexXeduc2, replace)
// As a bar graph that better separates the different variable combinations:
marginsplot, xtitle("") ytitle("Predicted probability") ///
recast(bar) ///
xdimension(female) ///
bydimension(hatlev1d, ///
elabels(1 "Low education" ///
2 "Medium education" ///
3 "High education")) ///
/* Use -bydimension- to better structure the x-axis */ ///
name(sexXeduc3, replace)

// As a proper-looking graph:
marginsplot, xtitle("") ytitle("Predicted probability") ///
recast(bar) ///
xdimension(female) ///
bydimension(hatlev1d, elabels(1 "Low education" ///
2 "Medium education" ///
3 "High education")) ///
byopts(row(1) /// All plots in one row
noiyaxes /// // Don't display individual y-axes
imargin(zero) /// // No margin between by() dimensions
title("") /// // Suppress title
caption("{it:Note:} Error bars are 95 % CI's" ///
"{it:Source:} EU-LFS 2009 AHM", span)) ///
/* Caption here to suppress displaying it three times */ ///
plotregion(lwidth(none)) ///
/* Removes lines around separate by dimension plots */
subtitle(, pos(6)) /// // Place label of by dimensions below plot
plotopts(fcolor(gs14) lcolor(b)) ///
/* Options of the recast() type can go here as well */ ///
name(sexXeduc4, replace)