Created
March 9, 2013 22:14
-
-
Save briatte/5125990 to your computer and use it in GitHub Desktop.
Stata code for the religious majority variables by La Porta et al. in the QOG dataset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use data/qog2011, clear | |
// religious populations | |
d lp_*80 | |
local vars = "lp_catho80 lp_muslim80 lp_protmg80 lp_no_cpm80" | |
// kernel densities | |
local plot = "" | |
foreach x of varlist `vars' { | |
local plot = "`plot' kdensity `x', k(biweight) bw(20) || " | |
} | |
tw `plot' | |
// empirical CDFs | |
local plot = "" | |
foreach x of varlist `vars' { | |
xtile qt_`x' = `x', nq(100) | |
bys qt_`x': egen qm_`x' = mean(`x') | |
local plot = "`plot' sc qm_`x' qt_`x' , ms(o) || " | |
} | |
tw `plot', yti("Percent of religion") xti("Percentiles") xsc(rev) /// | |
legend(order(1 "Catholic" 2 "Muslim" 3 "Protestant" 4 "Other") row(1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment