capture log close log using icpsrcda06-count, replace text // program: icpsrcda06-count.do // task: Review 6 - Count Models // project: ICPSR CDA // author: tait medina \ 2009jun20 // #1 // program setup version 10 clear all set linesize 80 // #2 // Load data use icpsr_scireview3, clear // #3 // Examine data, select variables, drop missing, and verify **make sure to look at the distribution of your outcome variable codebook, compact keep pub6 female phd enrol misschk, gen(m) tab mnumber keep if mnumber==0 tab1 pub6 female enrol, mis sum phd dotplot pub6 graph export icpsrcda06-count-fig1.emf , replace // #4 // estimate the poisson regression model poisson pub6 female phd enrol, nolog // #5 // factor change and standardized coefficients listcoef, help // #6 // marginal and discrete change prchange , rest(mean) // #7 // predicted rate and probabilities quietly prvalue, x(female=0) rest(mean) save prvalue, x(female=1) rest(mean) dif // #8 // nbrm nbreg pub6 female phd enrol // #9 // zip zip pub6 female phd enrol, inf(phd) // #10 // zinb zinb pub6 female phd enrol, inf(phd) // #11 // factor change listcoef, help // #12 // predicted probabilities quietly prvalue, x(phd=1) rest(mean) save prvalue, x(phd=4) rest(mean) diff // #13 // compare models using countfit countfit pub6 female phd enrol, inf(phd) /// graph(icpsrcda06-count-fig2.emf , replace) // #14 // close log file and exit do file log close exit