* StataConfColumbus2015.do esh 09dec2015 * document commands and examples from the 2015 Stata conference in Columbus version 14 window manage maintitle STATA_CONFRENCE_2015 * #1 Dwamena which midas search midasinla search inla * new command not found * #2 Gregory search teffects search treatoprobit search switchoprobit search treatoprobitsim * the -treat- commands not yet there.. * #3 RWilliams search xtbond search xtabond search xtdpdsys search xtdpdml net install xtdpdml, from(http://www3.nd.edu/~rwilliam/stata) which xtdpdml // Example 1: -xtdpdml- vs. -sem- // SEM coding (Adapted from Allison 2014 Appendix B) use http://statisticalhorizons.com/wp-content/uploads/wages.dta, clear keep wks lwage union ed id t des, short summ reshape wide wks lwage union, i(id) j(t) sem (wks2 <- wks1@b1 lwage1@b2 union1@b3 ed@b4 Alpha@1 E2@1 ) /// (wks3 <- wks2@b1 lwage2@b2 union2@b3 ed@b4 Alpha@1 E3@1) /// (wks4 <- wks3@b1 lwage3@b2 union3@b3 ed@b4 Alpha@1 E4@1) /// (wks5 <- wks4@b1 lwage4@b2 union4@b3 ed@b4 Alpha@1 E5@1) /// (wks6 <- wks5@b1 lwage5@b2 union5@b3 ed@b4 Alpha@1 E6@1) /// (wks7 <- wks6@b1 lwage6@b2 union6@b3 ed@b4 Alpha@1), /// var(e.wks2@0 e.wks3@0 e.wks4@0 e.wks5@0 e.wks6@0) var(Alpha) /// cov(Alpha*(ed)@0) cov(Alpha*(E2 E3 E4 E5 E6)@0) /// cov(_OEx*(E2 E3 E4 E5 E6)@0) cov(E2*(E3 E4 E5 E6)@0) /// cov(E3*(E4 E5 E6)@0) cov(E4*(E5 E6)@0) cov(E5*(E6)@0) /// cov(union3*(E2)) cov(union4*(E2 E3)) cov(union5*(E2 E3 E4)) /// cov(union6*(E2 E3 E4 E5)) /// iterate(250) technique(nr 25 bhhh 25) noxconditional use http://statisticalhorizons.com/wp-content/uploads/wages.dta, clear xtset id t xtdpdml wks L1.lwage, inv(ed) pre(L.union) // Example 2: -xtdpdml- vs. -xtabond- webuse abdata, clear keep if year>=1978&year<=1982 xtabond n l(0/1).w l(0/2).(k ys) yr1976-yr1984, lags(2) xtdpdml n l(0/1).w l(0/2).(k ys) , ylags(1 2) tfix /* net from http://www.moralbenito.com search xtmoralb */ * #4 Ender - 15 years a consultant * #5 Cattaneo - Robust estimation in regression-discontinuity designs *net install rdrobust, from(https://sites.google.com/site/rdpackages/) net install rdrobust, from(http://www-personal.umich.edu/~cattaneo/software/rdrobust/stata) replace which rdrobust which rdplot *copy "http://www-personal.umich.edu/~cattaneo/software/rdrobust/stata/rdrobust_illustration.do" rdrobust_illustration.do * #6 Liu - Estimations in panel data with indiv effects and AR(p) remainder disturbunces capture noisily which xtregarp * not found! which xtregar * the above is Stata cmd * #7 Pope : IRT models in Stata * #8 Wells : meta-analysis for the effects of interviewer supportiveness on accuracy of children's reports * #9 Bauldry : Confirmatory tetrad analysis net from https://github.com/sbauldry/tetrad/raw/master // example 1 clear qui set obs 500 qui gen xi = rnormal(0,1) forval i = 1/5 { qui gen x`i' = xi + rnormal(0, sqrt(0.5)) } qui sem (Xi -> x1 x2 x3 x4 x5) qui estat framework, fitted mat sigma1 = r(Sigma) qui sem (Xi -> x3 x4 x5) (x1 x2 -> Xi) qui estat framework, fitted mat sigma2 = r(Sigma) **Stata code invoking tetrad command /* Stata code for simulation and obtaining implied-covariance matrices */ tetrad x1 x2 x3 x4 x5, icm1(sigma1) icm2(sigma2) /// reps(5) tlist(1) // example 2 /* Figure : Multi-trait multi-method model for example 3. x1 - x3 are three readings of systolic blood pressure. y1 - y3 are three reading of diastolic blood pressure. R1 - R3 are latent method factors for each reading occasion. */ /* Stata code for model */ /* qui sem (SBP -> sbp13@1 sbp23@1 sbp33@1) /// (DBP -> dbp13@1 dbp23@1 dbp33@1) /// (R1 -> sbp13@1 dbp13@1) /// (R2 -> sbp23@1 dbp23@1) /// (R3 -> sbp33@1 dbp33@1), /// cov(SBP*R1@0 DBP*R1@0) /// cov(SBP*R2@0 DBP*R2@0) /// cov(SBP*R3@0 DBP*R3@0) /// cov(R1*R2@0 R1*R3@0 R2*R3@0) qui estat framework, fitted mat sigma1 = r(Sigma) */ /* Stata code invoking tetrad bootstrap command */ /* tetrad_bootstrap sbp13 sbp23 sbp33 /// dbp13 dbp23 dbp33, ///icm1(sigma1) reps(1000) */ * #10 Hemken webuse auto, clear regress weight c.displacement##c.displacement predict yhat twoway (scatter weight displacement) (line yhat displacement, sort) scatter weight displacement || line yhat displacement, sort net from http://www.ssc.wisc.edu/~hemken/Stataworkshops/ ** then -net describe- and install -stdParm- search stdParm sysuse auto, clear regress price c.displacement##c.displacement // cannot be done in R! stdParm quietly regress price i.rep78 stdParm quietly regress price c.weight##c.mpg stdParm stdParm, stats(N r2)star quietly logit foreign c.price##c.weight stdParm stdParm, eform quietly glm price rep78##c.weight##c.mpg stdParm * #11 BWilliams : control charts clear input VisitID str12 MonthYear AbxYes 1 2013m5 0 2 2013m11 1 3 2010m8 1 4 2012m8 0 5 2011m2 0 6 2011m5 0 7 2012m5 0 8 2012m9 0 9 2013m2 1 10 2013m5 0 11 2010m7 1 12 2012m3 0 13 2012m2 0 14 2012m11 0 15 2013m2 0 16 2013m5 0 end * #12 Childs : data workflow with Stata and Python * #13 Blevins : dist-free estimation of heteroskedastic binary response models which dfbr search moremata which locreg which ivqte ssc install moremata ssc install moremata, replace net install dfbr, from(http://jblevins.org/) which dfbr help dfbr * #14 Akhtar-Danesh : Markov-switching regression models which rcsgen search rcsgen which rcsgen which rcsgen_example clear rcsgen_example 1 rcsgen_example 2 search partpred rcsgen_example 2 which partpred_examples partpred_examples 1 partpred_examples 2 * #15 Rajbhandari - Estimating Markov-switching regression models which mswitch // StataCorp command search hamilton search gnp use http://www.stata-press.com/data/r14/rgnp.dta, clear mswitch ar rgnp, ar(1/4) nolog * #16 Cox : Betweenc and beyond - irregular series, interpolation, variograms, smoothing search mipolate search variogram which variog which variog2 capture noi which vgram * not yet posted! webuse air2 sum variog air help variog variog air, recast(connected) xlabel(0(12)72) des poisson air time predict yhat scatter air time, sort || line yhat time, sort gen resid = air-yhat label var resid "response residual" variog resid sum air sum resid ret list gen resid_var = r(Var) sum res* scatter air time, sort || line yhat time, sort variog resid * #17 Frazier : Public program sensitivity -- ROC cureves, classification effciency of state Medicaid * #18 Yang : Small sample inference with linear mixed-effects models use http://www.stata-press.com/data/r14/t43.dta, clear tabdisp person drug, cellvar(score) anova score person drug, repeated(drug) mixed score i.drug || person:, reml mixed score i.drug || person:, reml dfmethod(repeated) mixed , dftable(pvalue) estat df use http://www.stata-press.com/data/r14/vptscores.dta sum tabdisp hour subject , cellvar(score) by(signal) concise * bingo! this is example 3 from 18.yang * b s y a * hour subject score signal gen b=hour gen s=subject gen y=score gen a=signal mixed y a##b || s:, reml estat df, method(residual repeated anova satt kroger) estat df, method(kroger) post mixed y a##b || s:, reml dfmethod(kroger) test 2.a, small testparm a#b, small lincom 2.a+2.a#4.b lincom 2.a+2.a#4.b, small contrast a contrast a, small test 2.a, small testparm 2.a a#b, small test 2.a+2.a#2.b+2.a#3.b+2.a#4.b=0, small // why are we using .25 for the interaction terms coefficients? test 2.a + .25*[y]2.a#2.b + .25*[y]2.a#3.b + .25*[y]2.a#4.b = 0, small test 2.a + .25*2.a#2.b + .25*2.a#3.b + .25*2.a#4.b = 0, small * last is ok. [y] not necessary contrast a contrast a , small * so -contrast, small- works!!! mat list r(table) mixed y a##b || s:, reml dfmethod(kroger) scalar m1 = e(ll) mixed y b || s:, reml dfmethod(kroger) scalar m2 = e(ll) di m1 di m2 di m1-m2 * #19 Snyder : Project-based statistics course for applied biostatistics // Acock "A gentle intro to Stata" (4th ed., 2014) // HM Bush (2012) Biostatistics: an applied into to practioners * #20 Buchanan : Color schemes in Stata - search brewscheme which brewscheme * #21 Lopez Pineda : Colombian industrial structure 1974-2005 // panel data analysis exit