capture log close set more off estimates clear local job cda_notes_ch6_nom local date "18Apr2006" log using cda_notes_ch6_nom, replace version 9.1 set scheme s2manual // cda_notes_ch6_nom: ICPSR CDA Chapter 6 - multinomial logit // 18Apr2006 jsl // binary logit as mnlm use nomocc2,clear * 1: create variables for binary logits /* - need to create these variables * 2: quietly logit labrskil ed listcoef * 3: quietly logit profskil ed listcoef * 4: quietly logit labrprof ed listcoef * 5: multinomial logit of three category outcome mlogit occlsp ed listcoef */ // effects of base category * 6: base of 1 mlogit occ white ed exper,basecategory(1) nolog listcoef white, pval(.05) * 7: base of 2 mlogit occ white ed exper,basecategory(2) nolog listcoef white, pval(.05) // tests of variables * 8: wald test mlogit occ white ed exper,basecategory(1) test white test ed test exper * 9: LR test *a: full model quietly mlogit occ white ed exper,basecategory(1) estimates store base *b: drop white quietly mlogit occ ed exper,basecategory(1) estimates store nowhite lrtest base nowhite *c: drop ed quietly mlogit occ white exper,basecategory(1) estimates store noed lrtest base noed * 10: using mlogtest quietly mlogit occ white ed exper,basecategory(1) mlogtest, lr wald // tests of combining categories * 11: wald test; the [ ]'s are necessary! test [WhiteCol] * 12: lr test using binary regression gen occ45 = occ - 4 * occ45 ranges from -3 to 1; negative's are dropped from logit logit occ45 white ed exper if occ45>=0 * 13: lr test using mlogtest quietly mlogit occ white ed exper,basecategory(5) mlogtest, lrcomb // predicted values * 14: prvalue, rest(mean) prvalue, x(white=0) rest(mean) // discrete change * 15: prchange, rest(mean) * 16: qui prvalue, x(white=0) save prvalue, x(white=1) dif // odds ratios * 17: all possible odds ratios listcoef * 18: various subsets listcoef, gt pvalue(.05) // 1st gt 2nd; sig at .05 listcoef, adj lt pvalue(.05) // 1st lt 2nd, adjacent, sig at .05 // plotting discrete change and odds ratios // -- this is using xprchange, xmlogview, xmlogplot which are // beta versions of the corresponding spost commands. 18Apr2006 * 19: compute discrete change xprchange * 20: dc plot xmlogplot white ed exper, std(0ss) p(.1) min(-.3) max(.5) dc ntics(9) graph export `job'_dcplot.emf, replace * 21: or plot without dc xmlogplot white ed exper, std(0ss) p(.1) min(-3) max(0) or ntics(7) graph export `job'_orplot.emf, replace * 22: changing the base xmlogplot white ed exper, std(0ss) b(1) p(.1) min(-.5) /// max(2.5) or ntics(7) graph export `job'_dcplotb1.emf, replace * 23: adding the dc and sign xmlogplot white ed exper, std(0ss) b(1) p(.1) min(-.5) max(2.5) /// or dc sign ntics(7) graph export `job'_dcorplot.emf, replace // working mothers example use ordwarm2, clear * 24: estimate mnlm mlogit warm-prst, nolog * 25: discrete change xprchange * dc and or plot xmlogplot yr89 male white age ed prst, /// std(000sss) b(1) p(.05) min(-1.5) max(1.5) or dc sign ntics(7) graph export `job'_dcorwarm.emf, replace // testing iia * iia tests mlogtest ,iia log close