Part 2/2 of the Stata code for replicating Bollen & Paxton's (2000) "Subjective measures of liberal democracy" (Comparative Political Studies, 33(58), pp. 58-86).
*** here I replicate Bollen & Paxton's three main regressions (p. 75) *** | |
* get the 1979 and 1980 factor estimates | |
set more off | |
use "/Users/thiagomarzagao/Desktop/SCpaper/data-bollenpaxton.dta" | |
local years "79 80" | |
foreach x of local years { | |
confa (pollib: party`x' broad`x' print`x' civlib`x') (demrul: leg`x' polrt`x' compet`x' effec`x'), vce(sbentler) from(smart) usenames difficult | |
matrix b_t = e(b) | |
preserve | |
predict f1 f2, bartlett | |
foreach v of varlist party`x' broad`x' print`x' civlib`x' { | |
qui replace `v' = `v' - [lambda_`v'_pollib]_cons*f1 | |
} | |
foreach v of varlist leg`x' polrt`x' compet`x' effec`x' { | |
qui replace `v' = `v' - [lambda_`v'_demrul]_cons*f2 | |
} | |
confa (sussman: broad`x' print`x') (gastil: civlib`x' polrt`x') (banks: leg`x' compet`x' effec`x'), from(smart) usenames iter(20) | |
matrix b_res = e(b) | |
restore | |
matrix bb = (b_t[1,1..19], b_res[1,8..27]) | |
constraint define 1 [phi_demrul_sussman]_cons = 0 | |
constraint define 2 [phi_pollib_sussman]_cons = 0 | |
constraint define 3 [phi_demrul_gastil]_cons = 0 | |
constraint define 4 [phi_pollib_gastil]_cons = 0 | |
constraint define 5 [phi_gastil_banks]_cons = 0 | |
constraint define 6 [phi_sussman_banks]_cons = 0 | |
constraint define 7 [phi_demrul_banks]_cons = 0 | |
constraint define 8 [phi_pollib_banks]_cons = 0 | |
constraint define 9 [theta_polrt`x']_cons = 0 | |
constraint define 10 [theta_compet`x']_cons = 0 | |
confa (pollib: party`x' broad`x' print`x' civlib`x') (demrul: leg`x' polrt`x' compet`x' effec`x') (sussman: broad`x' print`x') (gastil: civlib`x' polrt`x') (banks: leg`x' compet`x' effec`x'), constr(1 2 3 4 5 6 7 8 9 10) vce(sbentler) from(bb) usenames difficult iter(75) | |
matrix sigmall19`x' = e(Phi) | |
matrix lambda19`x' = e(Lambda) | |
matrix sigmaxx19`x' = e(Sigma) | |
} | |
* average the 1979 and 1980 estimates | |
matrix sigmall = .5 * (sigmall1979 + sigmall1980) | |
matrix lambda = .5 * (lambda1979 + lambda1980) | |
matrix sigmaxx = .5 * (sigmaxx1979 + sigmaxx1980) | |
* produce deviation form of indicators | |
local myvars "party80 broad80 print80 civlib80 leg80 polrt80 compet80 effec80" | |
* preserve | |
foreach v of local myvars { | |
summarize `v' | |
gen m`v' = `v' - r(mean) | |
} | |
mkmat mparty80 mbroad80 mprint80 mcivlib80 mleg80 mpolrt80 mcompet80 meffec80, matrix(devx) | |
* produce the factor scores | |
matrix lambdat = lambda' | |
matrix sigmaxxi = inv(sigmaxx) | |
matrix devxt = devx' | |
matrix e = sigmall * lambdat * sigmaxxi * devxt | |
matrix et = e' | |
svmat double et, names(col) | |
local myfactors "pollib demrul sussman gastil banks" | |
foreach x of local myfactors { | |
sum `x' | |
replace `x' = `x' - r(mean) | |
} | |
* reproduce p. 75 of Bollen & Paxton (sort of) | |
preserve | |
gen coverage = nyt + vanderbilt + facts | |
gen age = 1980 - independence | |
egen coups = rowtotal(coups76-coups80) | |
gen radiostvs = radios + tvs | |
summarize coverage age radiostvs area population energy | |
recode coverage (0=.001) | |
replace age = . if age < 1 | |
gen lcoverage = ln(coverage) | |
gen lage = ln(age) | |
gen lradiostvs = ln(radiostvs) | |
gen lpopulation = ln(population) | |
gen larea = ln(area) | |
gen lenergy = ln(energy) | |
gen lprotests = ln(protests) | |
gen lstrikes = ln(strikes) | |
gen lriots = ln(riots) | |
reg gastil marxist lenergy protestant catholic lage monarchy coups war lprotests lstrikes lriots lcoverage lpopulation larea lradiostvs | |
reg sussman marxist lenergy protestant catholic lage monarchy coups war lprotests lstrikes lriots lcoverage lpopulation larea lradiostvs | |
reg banks marxist lenergy protestant catholic lage monarchy coups war lprotests lstrikes lriots lcoverage lpopulation larea lradiostvs | |
restore |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment