Thursday, August 25, 2016

code utk plot koefisien

clear
input str15 modnm str20 varnm coef se
"Male"    "Poor childhood"    -2.1917    0.2189
"Male"    "Age"    -0.4184    0.0112
"Male"    "Height"    0.1303    0.0188
"Male"    "Southern Europe"    -2.5454    0.2862
"Male"    "Adult illness"    -0.6170    0.1445
"Male"    "Adult elementary occ"    -0.7460    0.0801
"Female"    "Poor childhood"    -1.1932    0.2370
"Female"    "Age"    -0.3028    0.0100
"Female"    "Height"    0.0926    0.0212
"Female"    "Southern Europe"    -2.7182    0.2662
"Female"    "Adult illness"    -0.3664    0.0780
"Female"    "Adult elementary occ"    -0.3857    0.0934
end
gen min95 = coef - 1.96*se
gen max95 = coef + 1.96*se
sencode modnm, gen(modtype)
sencode varnm, gen(predictor)
levelsof predictor, local(ylabs)
label var modtype "Model"
label var predictor "Predictor"
sort modtype predictor
eclplot coef min95 max95 predictor, horiz ///
   estopts(msymbol(circle) msize(small)) ///
   by(modtype, legend(off) r(1)compact  note(" ")  ) /// blank note avoids unnecessary legend
   xline(0, lpattern(shortdash)) ylab(`ylabs') xtitle("")
graph export gripcoeff.pdf, replace
graph export gripcoeff.png, replace
graph export gripcoeff.eps, replace

0 Comments:

Post a Comment

<< Home