drop *_02 *_03 *_04 *_05 *_06 *_07 *_08 *_09 *_10 *_11 *_12 *_13 *_14 *_15 *_16 *_17 *_18 *_19 *_20
------------------------
tabout IV1-IV5 DV using ta.xls, c( col ci) svy stats(chi2) percent layout(row) npos(lab) f(2) mi append
----------------------
foreach v of var * {
drop if missing(`v')
}
--------------------------------------------------
drop if mi (v1, v2)
------------------------------------------------
labvalch3 * , strfcn(proper(`"@"'))
--------------------------------------------------------
capture rm "tables.xls"
toxl(tmp.xls, Table 1, replace)
--------------------------------------------------------
egen both = group( Age Residency ), label
-----------------------------------------------------------------
egen x=group( Age Residency )
grouplabs Age Residency, groupvar(x) val
15-19 Urban | 1,939 3.28 3.28
15-19 Rural | 4,978 8.42 11.70
20-24 Urban | 3,798 6.42 18.12
20-24 Rural | 7,878 13.33 31.45
25-29 Urban | 3,882 6.57 38.02
25-29 Rural | 7,650 12.94 50.96
30-34 Urban | 3,232 5.47 56.42
30-34 Rural | 6,209 10.50 66.92
35-39 Urban | 2,699 4.57 71.49
35-39 Rural | 4,983 8.43 79.92
40-44 Urban | 2,317 3.92 83.84
40-44 Rural | 4,150 7.02 90.86
45-49 Urban | 1,927 3.26 94.12
45-49 Rural | 3,478 5.88 100.00
egen float zbmi = std (bmi), mean (0) std (1)
----------------------------------------------------------------------------
blabel(bar, position(center) format(%3.1f))
--------------------------------------------------------------------
by id_firm id_molecule (Year), sort: gen byte wanted = (_n == 1)
------------------------------------------------------------------
graph bar (percent) yvar, by(byvar) over(groupvar, sort(order))
graph hbar (asis) v102 , over( v774b ) over( v774a ) asyvars scheme(mrc) aspect(1) blabel(bar) yla(, nogrid)
--------------------------------------------------------------------------------------------------
catplot ChildAge if Fever ==1 , by (y) percent( y ) blabel(bar, position(center) format(%3.1f) color(white) ) yla(, nogrid) scheme (mrc)
catplot we y, by (pod) percent(y ) asyvars blabel(bar, position(center) format(%3.1f) color(white) ) yla(, nogrid) scheme (burd4) name (anct)
-----------------------------------------------
capture drop A*
-------------------------------------------------------------------------------------------------------------
http://repec.sowi.unibe.ch/stata/coefplot/markers.html
coefplot (fvm, label(Male)) (fvf, label(Femle)), drop(_cons) xline(1) eform mlabposition(1) mlabel(cond(@pval>.05, "+", cond(@pval<.001, "***", cond(@pval<.01, "**", cond(@pval<.05, "*", cond(@pval<.1, "+", "")))))) note("+ p > .05, * p < .05, ** p < .01, *** p < .001") name (f)
. marginsplot, horizontal xline(0) yscale(reverse) recast(scatter)
catplot fever y, by (cs) blabel(bar, format(%4.1f) pos(top)) name (d, replace)
catplot fever, by (y) blabel(bar, format(%4.1f) pos(top)) name (d1) vertical
gr combine d d1
catplot cough y, by (cs) blabel(bar, format(%4.1f) pos(top)) name (dd, replace)
catplot cough, by (y) blabel(bar, format(%4.1f) pos(top)) name (dd1) vertical
gr combine dd dd1
catplot rb y, by (cs) blabel(bar, format(%4.1f) pos(top)) name (ddd, replace)
catplot rb, by (y) blabel(bar, format(%4.1f) pos(top)) name (ddd1) vertical
gr combine ddd ddd1
. ta fever y if cs==1, col nofreq
. ta fever y if cs==2, col nofreq
. ta fever y, col nofreq
. ta rb y if cs==1, col nofreq
. ta rb y if cs==2, col nofreq
. ta rb y, col nofreq
logistic fever i.y i.chage i.bo i.bfeed i.mage i.edu i.occ i.bmi i.lcwanted i.parity if cs==1
eststo fvm
logistic cough i.y if cs==1
eststo cm
coefplot, xline(0) drop(_cons) omitted baselevels graphregion(margin(l=65)) yscale(alt noline)
coeflabels(, labgap(-125) notick) headings(1995.y= "Year" 2.chage= "Age of Child" 0.bfeed= "Being Breastfed"
2.mage= "Mother's age" 0.edu= "Mother's education" 1.occ= "Mother's occupation" 0.bmi= "Maternal BMI"
1.lcwanted= "Child was wanted" 2.parity= "Parity" 0.bmi = "bf:Body mass Index" , labcolor(orange) labgap(-130)) name (fvm)
logistic fever i.y i.chage i.bo i.bfeed i.mage i.edu i.occ i.bmi i.lcwanted i.parity if cs==2
eststo fvm
coefplot, xline(0) drop(_cons) omitted baselevels graphregion(margin(l=65)) yscale(alt noline)
coeflabels(, labgap(-125) notick) headings(1995.y= "Year" 2.chage= "Age of Child" 0.bfeed= "Being Breastfed"
2.mage= "Mother's age" 0.edu= "Mother's education" 1.occ= "Mother's occupation" 0.bmi= "Maternal BMI"
1.lcwanted= "Child was wanted" 2.parity= "Parity" 0.bmi = "bf:Body mass Index" , labcolor(orange) labgap(-130)) name (fvf)
coefplot, xline(0) drop(_cons) omitted baselevels graphregion(margin(l=65)) yscale(alt noline) coeflabels(, labgap(-125) notick)
headings(1995.y= "Year" 2.chage= "Age of Child" 0.bfeed= "Being Breastfed" 2.mage="Mother's age"
0.edu= "Mother's education" 1.occ= "Mother's occupation" 0.bmi= "Maternal BMI" 1.lcwanted="Child was wanted"
2.parity= "Parity" 0.bmi = "bf:Body mass Index", labsize(vsmall) labcolor(orange) labgap(-130)) ylab(, labs(vsmall))
coefplot (fvm, label(Male)) (fvf, label(Femle)), drop(_cons) xline(1) eform name(fv)
coefplot (fvm, label(Male)) (fvf, label(Femle)), drop(_cons) xline(1) eform name(fv)
coefplot (fvm, label(Male)) (fvf, label(Femle)), drop(_cons) xline(1) eform name(fv)
coefplot, xline(0) drop(headroom _cons) omitted baselevels graphregion(margin(l=65)) yscale(alt noline)
coeflabels(, labgap(-125) notick) headings(1.age = "{bf:MATERNAL age}"
2.parity = "{bf:Total births}" 3.edu = "{bf:MEDU}" 0.bmi = "{bf:BODY mass}" , labcolor(orange) labgap(-130))
coefplot, xline(0) drop(_cons) omitted baselevels graphregion(margin(l=65)) yscale(alt noline)
coeflabels(, labgap(-125) notick) headings(1995.y= "Year" 2.chage= "Age of Child" 0.bfeed= "Being Breastfed"
2.mage= "Mother's age" 0.edu= "Mother's education" 1.occ= "Mother's occupation" 0.bmi= "Maternal BMI"
1.lcwanted= "Child was wanted" 2.parity= "Parity" 0.bmi = "bf:Body mass Index" , labcolor(orange) labgap(-130))
coefplot, xline(0) mlabposition(1) mlabgap(*2) mlabel("{it:p} = " + string(@pval,"%9.3f"))
Avec p-value as *
coefplot, xline(1) eform mlabposition(1) mlabel(cond(@pval>.05, "+", cond(@pval<.001, "***", cond(@pval<.01, "**", cond(@pval<.05, "*", cond(@pval<.1, "+", "")))))) note("+ p > .05, * p < .05, ** p < .01, *** p < .001")
Avec p-value as +/-/No association
weight:
coefplot, weight(1/@se) ms(oh) drop(_cons) xline(0)