Skip to content

Instantly share code, notes, and snippets.

@briatte
Created March 9, 2013 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briatte/5125990 to your computer and use it in GitHub Desktop.
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
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