Showing posts with label European Quality of Life Survey. Show all posts
Showing posts with label European Quality of Life Survey. Show all posts

Nov 16, 2017

Random graphs (118): Dot plot

clear
input str5 cntry eqls2003 eqls2007 ewcs2005 ewcs2010 eusilc2014
SE 0.021949 0.030043 0.00213  0.000918 .
FI 0.022075 0.013452 0.02246  0.011247 0.00012
HR .   0.018228 0.017975 0.013302 .
SK 0.011168 0.035384 0.013425 0.019773 0.003893
CZ 0.005486 0.064484 0.008917 0.005968 0.000863
NO .   0.0226  0.021383 0.018745 0.012686
CH .   .   0.028731 .   .
HU 0.018815 0.060927 0.044574 0.013885 0.019517
SI 0.025373 0.030885 0.095199 0.019257 0.001327
NL 0.035021 0.048701 0.021501 0.034217 .
BE 0.039831 0.088688 0.025436 0.006923 0.01386
EE 0.027082 0.048187 0.052969 0.052337 0.006435
FR 0.030219 0.074314 0.040906 0.01435  .
LT 0.049985 0.077502 0.05434  0.032847 0.006778
BG 0.037858 0.063697 0.065784 0.032313 0.039127
PL 0.023636 0.075742 0.06099  0.037228 .
LU 0.106816 0.102864 0.004992 0.006159 0.032854
DE 0.090262 0.040957 0.038157 0.035452 .
RO 0.063563 0.072842 0.070762 0.022769 .
LV 0.09474  0.077167 0.054927 0.034465 0.038258
IT 0.040173 0.128064 0.06421  0.036467 .
AT 0.057465 0.132496 0.095462 0.05458  .
ES 0.112064 0.127856 0.086716 0.076224 0.038867
DK 0.129036 0.103272 0.107504 0.040896 .
UK 0.120762 0.124342 0.150114 0.083238 0.024998
ME .   .   .   0.101533 .
PT 0.173582 0.179532 0.073722 0.113514 0.091105
RS-KM .   .   .   0.160115 .
MK .   0.194579 .   0.128292 .
IE 0.270422 0.359196 0.293468 0.240577 0.03082
AL .   .   .   0.275311 .
GR 0.404795 0.53023  0.286437 0.292037 0.144072
MT 0.302118 0.465496 0.387637 0.277371 .
CY 0.322423 0.54425  0.436497 0.395157 .
TR 0.564689 0.496668 0.689807 0.643683 .
end

scores average = mean(eqls2003 eqls2007 ewcs2005 ewcs2010)

kountry cntry, from(iso2c) marker
rename NAMES_STD country
replace country = "Kosovo" if country == "rskm"

egen order_ = rank(average), unique
labmask order_, value(country)

twoway (dot eqls2003 order_, horizontal) ///
       (dot eqls2007 order_, horizontal) ///
       (dot ewcs2005 order_, horizontal) ///
       (dot ewcs2010 order_, horizontal) ///
       (dot eusilc2014 order_, horizontal) ///
      , ylabel(1/35, val) ysize(9) ///
        ytitle("") xscale(alt) ///
        xtitle("Proportion without job contract") ///
        legend(order(1 "EQLS 2003" ///
                     2 "EQLS 2003" ///
                     3 "EWCS 2005" ///
                     4 "EWCS 2010" ///
                     5 "EU-SILC 2014") title("Data source") pos(5) ring(0))

Aug 2, 2016

Random graphs (90): Regression coefficients

version 14
use 7348_F1.dta, clear

// Prepare variables:
// Country variable
rename Y11_Country ctry
decode ctry, gen(country)
kountryadd "Macedonia (FYROM)" to "Macedonia" add
kountry country, from(other) stuck
rename _ISO3N_ geo
kountry geo, from(iso3n) to(iso2c)
rename _ISO2C_ cntry
replace cntry = "XK" if country == "Kosovo"
drop geo 

label define Y11_Country 30 "Macedonia", modify

// Wave identifier
rename Wave wave

// Gender
generate female = (Y11_HH2a == 2)

// Work-family conflict
*factor Y11_Q12a Y11_Q12b Y11_Q12c, pcf
*tab Y11_Q12a wave, mis
*tab Y11_Q12b wave, mis
*tab Y11_Q12c wave, mis
*alpha Y11_Q12a Y11_Q12b Y11_Q12c, item
scores wfb = mean(Y11_Q12a Y11_Q12b Y11_Q12c)
generate wfc = 5 - wfb
drop wfb

eststo clear

levelsof wave, local(wave)

foreach x of local wave {
eststo: mixed wfc female || ctry: female if wave == `x', cov(uns)

preserve
// Get no. of countries
matrix groups = e(N_g)
local n_g = groups[1,1]

// Predict residuals
predict u1 u0, reffects
predict u1se u0se, reses

// Calculate posterior slope
generate eb_female = u1 + _b[female]

// Plot posterior slope
egen pickone = tag(country)  // Keep one case per countr
keep if pickone
   
egen order_ = rank(-u1), unique
labmask order_, value(ctry) decode

gen high = u1 + _b[female] + (1.96 * u0se)
gen low  = u1 + _b[female] - (1.96 * u0se)
local avg =  _b[female]

twoway (rcap eb_female eb_female order_, horizontal) ///
       (rspike high low order_, horizontal) , ///
        xline(`avg') ylabel(1/`n_g', val ang(h)) ///
        ytitle("") ///
  xscale(alt) ///
        xlabel(-.2 (.1) .4) ///
        xtitle("Female WFC disadvantage") ///
        legend(off) ///
        title(`: label (wave) `x'') ///
        name(emp_bayes_`x', replace) xsize(3) nodraw
restore
}

graph combine emp_bayes_1 emp_bayes_2 emp_bayes_3, col(3) xsize(6) name(variation, replace) altshrink ///
      note("{it:Source:} European Quality of Life Surveys, 2003-11. {it:Notes:} Horizontal line shows average coefficient, country-specific" ///
        "estimates indicate deviation from this average. Error bars are 95% CI's based on random-effects models.")

coefplot est1, bylabel(EQLS 2003) || /// est2, bylabel(EQLS 2007) || /// est3, bylabel(EQLS 2011) || /// , xlabel(0 (.05) .2) drop(_cons) xscale(alt) baselevel coeflabel(female = "Female") /// xtitle("Female WFC disadvantage") xline(0) byopts(row(1)) ciopts(recast(rcap))
coefplot est1 est2 est3, xlabel(0 (.05) .2) drop(_cons) xscale(alt) baselevel coeflabel(female = "Female") /// xtitle("Female WFC disadvantage") xline(0) byopts(row(1)) ciopts(recast(rcap)) /// legend(order(2 "EQLS 2003" 4 "EQLS 2007" 6 "EQLS 2011"))