cls * Adjusted predictions & Marginal effects * Requires Stata 11+ and spost13 webuse nhanes2f, clear keep if !missing(diabetes, black, female, age) // Note: In later versions of Stata, some of these labels // are already defined. When that is so, the capture // prefix keeps the program from aborting with an error capture label define black 0 "nonBlack" 1 "black" capture label define female 0 "male" 1 "female" capture label values black black capture label values female female logit diabetes i.female i.black c.age c.age#c.age, nolog * AAPs using margins, mtable margins black mtable, at(black = (0 1)) statistics(all) dec(4) * AMEs using margins, mtable margins, dydx(black) mtable, dydx(black) statistics(all) dec(4) * mtable -- generate several sets of adj predictions with just one command mtable, at (black = (0 1) age = 20 ) at (black = (0 1) age = 47 ) at (black = (0 1) age = 74 ) dec(4) statistics(all) * mtable, nicer formatting quietly mtable, at (black = 0 age = 20 ) rown(20 year old white) dec(4) statistics(all) quietly mtable, at (black = 1 age = 20 ) rown(20 year old black) dec(4) statistics(all) below quietly mtable, at (black = 0 age = 47 ) rown(47 year old white) dec(4) statistics(all) below quietly mtable, at (black = 1 age = 47 ) rown(47 year old black) dec(4) statistics(all) below quietly mtable, at (black = 0 age = 74 ) rown(74 year old white) dec(4) statistics(all) below mtable, at (black = 1 age = 74 ) rown(74 year old black) dec(4) below statistics(all) * mchange mchange, dec(6) commands statistics(all) * Appendix webuse nhanes2f, clear quietly logit diabetes i.black i.female age c.age#c.age, nolog est store age mchange age, dec(6) uncentered delta(10) commands gen xage = -age quietly logit diabetes i.black i.female xage c.xage#c.xage, nolog est store xage mchange xage, dec(6) uncentered delta(10) commands est restore age mchange age, dec(6) delta(10) centered commands est restore xage mchange xage, dec(6) delta(10) commands