R/extend_UDS.R
prepare_democracy_data.Rd
This function is designed to take the democracy data included in this package and put it in a form suitable for use with the mirt package to replicate the UDS model. It takes a data frame and tries to determine, from the column names, which variables contain democracy scores.
prepare_democracy_data(data, .funs)
A dataset of democracy scores. For the function to do anything,
the column names must contain at least one of the following strings:
anckar, anrr, arat, blm, bmr, bti, bollen,
doorenspleet, wgi, gwf, hadenius, kailitz, lied,
munck, pacl, peps, polyarchy, polity, prc, PIPE,
svmdi, svolik, ulfelder, utip, v2x
,
vanhanen_democratization
(from vanhanen), vanhanen_pmm, or
wth. For details of these variables, see
the documentation for generate_democracy_scores_dataset or the
documentation for the individual datasets.
A names list of functions to modify the columns. It defaults to the following:
funs(arat = cut(., breaks = c(0, 50, 60, 70, 80, 90, 100, 109), labels
= 1:7, include.lowest = TRUE, right = FALSE), hadenius = cut(., breaks = c(0, 1, 2, 3, 4, 7, 8, 9, 10), labels = 1:8,
include.lowest = TRUE, right = FALSE), bollen = cut(., breaks = c(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100),
labels = 1:10, include.lowest = TRUE, right = FALSE), bti = ~cut(.x, breaks = 20, include.lowest = TRUE, right = FALSE,
ordered_result = TRUE), vanhanen = cut(., breaks = c(0, 5, 10, 15, 20, 25, 30, 35, 50), labels =
1:8, include.lowest = TRUE, right = FALSE), munck = cut(., breaks = c(0, 0.5, 0.75, 0.99, 1), labels = 1:4,
include.lowest = TRUE, right = FALSE), polyarchy_dimensions = cut(., breaks = 20, include.lowest = TRUE, right =
FALSE, ordered_result = TRUE), polity = ifelse(. < -10, NA, .), v2x = cut(., breaks = 20, include.lowest =
TRUE, right = FALSE, ordered_result = TRUE), v2x_* = cut(., breaks = 20, include.lowest = TRUE, right = FALSE,
ordered_result = TRUE), svmdi = cut(., breaks = 20, include.lowest = TRUE, right = FALSE,
ordered_result = TRUE), eiu = cut(., breaks = 20, include.lowest = TRUE, right = FALSE,
ordered_result = TRUE), wgi = cut(., breaks = 20, include.lowest = TRUE, right = FALSE,
ordered_result = TRUE), peps = round(.), other = as.numeric(unclass(factor(.))))
A data frame with the transformed scores, if any.
If the column names contain the strings arat
, blm
, bollen
,wgi
,
hadenius
, munck
, pacl
, peps
, polyarchy_inclusion_dimension
,
polyarchy_contestation_dimension
, polity
, prc
, v2x
, vanhanen_pmm
, or
vanhanen_democratization
, the function performs the following
transformations by default:
arat
: Following Pemstein, Meserve, and Melton's replication code (Pemstein,
Meserve, and Melton 2013), the function cuts Arat (1991)'s 0-109 democracy
score (arat_pmm) into 7 intervals with the following cutoffs: 50, 60, 70,
80, 90, and 100. The resulting score is ordinal from 1 to 8.
bollen
: Following Pemstein, Meserve, and Melton's replication code
(Pemstein, Meserve, and Melton 2013), the function cuts Bollen's (2001)'s
0-100 democracy score (bollen_pmm) into 10 intervals with the following
cutoffs: 10,20,30,40,50,60,70,80, and 90. The resulting score is ordinal from
1 to 10.
bti
: the function assumes this is the Bertelsmann Transformation Index
(bti), and it will cut it into 20 categories. The resulting score is ordinal
from 1 to 20.
wgi
: If the World Governance Indicator's index of voice and accountability
(wgi) is included in the file, the function cuts it into 20 categories. The
resulting score is ordinal from 1 to 20.
hadenius_pmm
: Following Pemstein, Meserve, and Melton's replication code
(Pemstein, Meserve, and Melton 2013), the function cuts Hadenius (1992)'s 0-10
democracy score (hadenius_pmm) into 8 intervals with the following cutoffs:
1, 2, 3, 4, 7, 8, and 9. The resulting score is ordinal from 1 to 8.
munck
: Following Pemstein, Meserve, and Melton's replication code (Pemstein,
Meserve, and Melton 2013), the function cuts Munck's (2009)'s 0-1 democracy
score (munck_pmm) into 4 intervals with the following cutoffs: 0.5,0.5,0.75,
and 0.99. The resulting score is ordinal from 1 to 4.
peps
: If any of the variants of the Participation-Enhanced Polity Score
(Moon et al 2006, peps) is included in the file, the function rounds its
value (eliminates the decimal) and then transforms it into an ordinal measure
from 1 to 21.
polity
: Following Pemstein, Meserve, and Melton's replication code
(Pemstein, Meserve, and Melton 2013), the function takes the polity scores
(polity or polityIV)and puts NA for any values below -10, and then
transforms it into an ordinal measure from 1 to 21.
polyarchy_inclusion_dimension
, polyarchy_contestation_dimension
: If any of
the polyarchy inclusion or contestation dimensions from Coppedge, Alvarez and
Maldonado (2008, polyarchy) are included, it cuts them into into 20
categories. The resulting score is ordinal from 1 to 20.
csvdmi
or svdmi_2016
: the function assumes this is one of the continuous
indexes of democracy from the SVMDI dataset (Grundler and Krieger 2018,
svmdi), and it will cut it into 20 categories. The resulting score is
ordinal from 1 to 20.
v2x
: If any of the v2x_
continuous indexes of democracy from the V-Dem
dataset (Coppedge et al 2021) are included in the file, the function cuts them
into 20 categories. The resulting score is ordinal from 1 to 20.
vanhanen_democratization
or vanhanen_pmm
: Following Pemstein, Meserve, and
Melton's replication code (Pemstein, Meserve, and Melton 2013), the function
cuts Vanhanen's (2012)'s index of democratization (vanhanen) into 8
intervals with the following cutoffs: 5,10,15,20,25,30, and 35. The resulting
score is ordinal from 1 to 8.
The function also recognizes the following column names (or partial column
names - it also recognizes, e.g., pmm_blm
) as measures of democracy: anrr
(from Acemoglu, Naidu, Restrepo, and Robinson 2019, anrr), anckar
(from
Anckar and Fredriksson 2018 anckar), blm
(from Bowman, Lehoucq, and
Mahoney 2005, blm), bmr
(from Boix, Miller, and Rosato 2012, bmr),
doorenspleet
(from Doorenspleet 2000, doorenspleet), e_v2x
(the
"ordinal" indexes from the V-dem project, Coppedge et al 2021), freedomhouse
or fh
(from Freedom House, fh - freedom scale must be reversed so that
"more freedom" is higher), gwf
(from Geddes, Wright, and Frantz 2014, gwf
, the dichotomous democracy indicator only), kailitz
(from Kailitz 2013 -
democracy/non-democracy indicator, kailitz), lied
or lexical_index
(from
Skaaning, Gerring, and Bartusevicius 2015, LIED), mainwaring
(from
Mainwaring and Perez Linan 2008, mainwaring), magaloni
(from Magaloni,
Min, Chu 2013 - democracy/non-democracy indicator, magaloni), pacl
(from
Cheibub, Gandhi, and Vreeland 2010, pacl or pacl_update), pitf
(from
Goldstone et al 2010 or Taylor and Ulfelder 2015, pitf), polyarchy
(from
Coppedge and Reinicke 1991, polyarchy), prc
(from Gasiorowski 1996 or
Reich 2002, prc), PIPE
(from Przeworski 2010, PIPE), reign
(from Bell
2016, reign), svmdi
(from Grundler and Krieger 2018, 2016, svmdi),
svolik
(from Svolik 2012, democracy/dictatorship indicator only, svolik),
ulfelder
(from Ulfelder 2012, ulfelder), utip
(from Hsu 2008, utip),
and wth
or wahman_teorell_hadenius
(from Wahman, Teorell, and Hadenius
2013, wahman_teorell_hadenius). In each of these cases the function
transforms the values of these scores by running
as.numeric(unclass(factor(x)))
, which transforms them into ordinal variables
from 1 to the number of categories.
For details of these scores, see the documentation for generate_democracy_scores_dataset or the documentation for the individual datasets.
It is also possible to change these defaults.
Warning! The function does not perform any sanity checks. It will try to transform anything that has the right name. You should always check that the results make sense.
D. Acemoglu, S. Naidu, P. Restrepo, et al. "Democracy Does CauseGrowth". In: Journal of Political Economy 127.1 (2019), pp. 47-100.DOI: 10.1086/700936.https://www.journals.uchicago.edu/doi/10.1086/700936.
C. Anckar and C. Fredriksson. "Classifying political regimes1800-2016: a typology and a new dataset". In: European PoliticalScience (2018). DOI: 10.1057/s41304-018-0149-8.https://doi.org/10.1057/s41304-018-0149-8.
Z. F. Arat. Democracy and human rights in developing countries.Boulder: Lynne Rienner Publishers, 1991.
C. Bell. The Rulers, Elections, and Irregular Governance Dataset(REIGN). 2016. http://oefresearch.org/datasets/reign.
M. Bernhard, T. Nordstrom, and C. Reenock. "Economic Performance,Institutional Intermediation, and Democratic Survival". In: Journal ofPolitics 63.3 (2001), pp. 775-803. DOI: 10.1111/0022-3816.00087.
Bertelsmann Stiftung. Transformation Index of the BertelsmannStiftung 2022. Tech. rep. Bertelsmann Stiftung, 2022.
C. Bjørnskov and M. Rode. "Regime types and regime change: A newdataset on democracy, coups, and political institutions". In: TheReview of International Organizations 15.2 (2020), pp. 531-551. DOI:10.1007/s11558-019-09345-1.
C. Boix, M. Miller, and S. Rosato. "A Complete Dataset of PoliticalRegimes, 1800-2007". In: Comparative Political Studies 46.12 (2012),pp. 1523-1554. DOI: 10.1177/0010414012463905.
K. A. Bollen. Cross-National Indicators of Liberal Democracy,1950-1990. Data set. 2001.
K. Bollen and P. Paxton. "Subjective Measures of LiberalDemocracy". In: Comparative Political Studies 33.1 (2000), pp. 58-86.DOI: 10.1177/0010414000033001003.
K. Bowman, F. Lehoucq, and J. Mahoney. "Measuring PoliticalDemocracy: Case Expertise, Data Adequacy, and Central America". In:Comparative Political Studies 38.8 (2005), pp. 939-970. DOI:10.1177/0010414005277083.
J. Cheibub, J. Gandhi, and J. Vreeland. "Democracy anddictatorship revisited". In: Public Choice 143.1 (2010), pp. 67-101.DOI: 10.1007/s11127-009-9491-2.
M. Coppedge, A. Alvarez, and C. Maldonado. "Two PersistentDimensions of Democracy: Contestation and Inclusiveness". In: Thejournal of politics 70.03 (2008), pp. 632-647. DOI:10.1017/S0022381608080663.
M. Coppedge, J. Gerring, C. H. Knutsen, et al. V-Dem Codebookv13.
M. Coppedge and W. H. Reinicke. "Measuring Polyarchy". In:Studies in Comparative International Development 25.1 (1990), pp.51-72. DOI: 10.1007/Bf02716905.
R. Doorenspleet. "Reassessing the Three Waves of Democratization".In: World Politics 52.03 (2000), pp. 384-406. DOI:10.1017/S0043887100016580.
Freedom House. Freedom in the World 2023: Marking 50 Years in theStruggle for Democracy. Tech. rep. Freedom House, 2023.https://freedomhouse.org/report/freedom-world/2023/marking-50-years.
M. Gasiorowski. "An Overview of the Political Regime ChangeDataset". In: Comparative Political Studies 29.4 (1996), pp. 469-483.DOI: 10.1177/0010414096029004004.
B. Geddes, J. Wright, and E. Frantz. "Autocratic Breakdown andRegime Transitions: A New Data Set". In: _Perspectives on Politics_12.1 (2014), pp. 313-331. DOI: 10.1017/S1537592714000851.
K. Gleditsch and M. D. Ward. "Interstate system membership: Arevised list of independent states since the congress of Vienna". In:International Interactions 25.4 (1999), pp. 393-413. DOI:10.1080/03050629908434958.
J. Goldstone, R. Bates, D. Epstein, et al. "A Global Model forForecasting Political Instability". In: American Journal of PoliticalScience 54.1 (2010), pp. 190-208. DOI:10.1111/j.1540-5907.2009.00426.x.
K. Gründler and T. Krieger. "Democracy and growth: Evidence from amachine learning indicator". In: European Journal of PoliticalEconomy 45 (2016), pp. 85-107. DOI:https://doi.org/10.1016/j.ejpoleco.2016.05.005.http://www.sciencedirect.com/science/article/pii/S0176268016300222.
K. Gründler and T. Krieger. Machine Learning Indices, PoliticalInstitutions, and Economic Development. Report. CESifo Group Munich,2018. https://www.cesifo-group.de/DocDL/cesifo1_wp6930.pdf.
K. Gründler and T. Krieger. "Using Machine Learning for measuringdemocracy: A practitioners guide and a new updated dataset for 186countries from 1919 to 2019". In: European Journal of PoliticalEconomy (2021), pp. 102-47. DOI:https://doi.org/10.1016/j.ejpoleco.2021.102047.
A. Hadenius. Democracy and development. New York: CambridgeUniversity Press, 1992.
A. Hadenius and J. Teorell. "Pathways from Authoritarianism". In:Journal of Democracy 18.1 (2007), pp. 143-157.
S. Hsu. "The Effect of Political Regimes on Inequality,1963-2002". In: UTIP Working Paper (2008).
S. Kailitz. "Classifying political regimes revisited: legitimationand durability". In: Democratization 20.1 (2013), pp. 39-60. DOI:10.1080/13510347.2013.738861.
D. Kaufmann and A. Kraay. Worldwide Governance Indicators. 2020.http://www.govindicators.org.
B. Magaloni, J. Chu, and E. Min. Autocracies of the World,1950-2012 (Version 1.0). Dataset. 2013.http://cddrl.fsi.stanford.edu/research/autocracies_of_the_world_dataset.
S. Mainwaring, D. Brinks, and A. Pérez-Liñán. "ClassifyingPolitical Regimes in Latin America". In: Studies in ComparativeInternational Development 36.1 (2001), pp. 37-65. DOI:10.1007/bf02687584.
S. Mainwaring, A. Pérez-Liñán, and D. Brinks. "Political Regimesin Latin America, 1900-2007 (with Daniel Brinks)". In: Democracies andDictatorships in Latin America: Emergence, Survival, and Fall. NewYork: Cambridge University Press, 2014. Chap. Political Regimes inLatin America, 1900-2007 (with Daniel Brinks).
X. Marquez. "A Quick Method for Extending the Unified DemocracyScores". In: Available at SSRN 2753830 (2016).https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2753830.
M. G. Marshall and T. R. Gurr. _Polity 5: Political RegimeCharacteristics and Transitions, 1800-2018. Dataset Users' Manual._Center for Systemic Peace, 2020.
M. G. Marshall, T. R. Gurr, and K. Jaggers. Polity IV Project:Political Regime Characteristics and Transitions, 1800-2018. DatasetUsers' Manual. Center for Systemic Peace, 2019.
B. E. Moon, J. H. Birdsall, S. Ciesluk, et al. "Voting Counts:Participation in the Measurement of Democracy". In: Studies inComparative International Development 41.2 (2006), pp. 3-32. DOI:10.1007/BF02686309.
G. Munck. Measuring Democracy: A Bridge between Scholarship andPolitics. Baltimore: The Johns Hopkins University Press, 2009.
X. Márquez. democracyData: A package for accessing andmanipulating existing measures of democracy. 2020.http://github.com/xmarquez/democracyData.
D. Pemstein, K. L. Marquardt, E. Tzelgov, et al. The V-DemMeasurement Model: Latent Variable Analysis for Cross-National andCross-Temporal Expert-Coded Data. Tech. rep. 21. Varieties ofDemocracy Institute, University of Gothenburg, 2022.https://www.v-dem.net/media/filer_public/25/cb/25cb3f3f-290d-46e1-8eaf-ff2d2c13f4a9/v-dem_working_paper_21.pdf.
D. Pemstein, S. A. Meserve, and J. Melton. Replication data for:Democratic Compromise: A Latent Variable Analysis of Ten Measures ofRegime Type. 2013. http://hdl.handle.net/1902.1/PMM.
D. Pemstein, S. Meserve, and J. Melton. "Democratic Compromise: ALatent Variable Analysis of Ten Measures of Regime Type". In:Political Analysis 18.4 (2010), pp. 426-449. DOI: 10.1093/pan/mpq020.
A. Przeworski. Political Institutions and Political Events (PIPE)Data Set. Data set. 2013.https://sites.google.com/a/nyu.edu/adam-przeworski/home/data.
G. Reich. "Categorizing Political Regimes: New Data for OldProblems". In: Democratization 9.4 (2002), pp. 1-24. DOI:10.1080/714000289.
S. Skaaning, J. Gerring, and H. Bartusevičius. "A Lexical Index ofElectoral Democracy". In: Comparative Political Studies 48.12 (2015),pp. 1491-1525. DOI: 10.1177/0010414015581050.
M. Svolik. The Politics of Authoritarian Rule. Cambridge:Cambridge University Press, 2012.
S. J. Taylor and J. Ulfelder. "A Measurement Error Model ofDichotomous Democracy Status". In: Available at SSRN (2015). DOI:10.2139/ssrn.2726962.
The Economist Intelligence Unit. Democracy Index 2022: Frontlinedemocracy and the battle for Ukraine. Tech. rep. The EconomistIntelligence Unit, 2023.
J. Ulfelder. Democracy/Autocracy Data Set. 2012.http://hdl.handle.net/1902.1/18836.
J. Ulfelder and M. Lustik. "Modelling Transitions To and FromDemocracy". In: Democratization 14.3 (2007), pp. 351-387. DOI:10.1080/13510340701303196.
T. Vanhanen. Measures of Democracy 1810-2018 (dataset). Version8.0 (2019-06-17). Tampere, 2019.http://urn.fi/urn:nbn:fi:fsd:T-FSD1289.
M. Wahman, J. Teorell, and A. Hadenius. "Authoritarian RegimeTypes Revisited: Updated Data in Comparative Perspective". In:Contemporary Politics 19.1 (2013), pp. 19-34.https://sites.google.com/site/authoritarianregimedataset/data.
democracy <- generate_democracy_scores_dataset(selection = "pmm", output_format = "wide")
#> Adding fh_pmm data
#> Adding polity_pmm data
#> Adding Arat data
#> Adding blm_pmm data
#> Adding Bollen data
#> Adding Hadenius data
#> Adding mainwaring_pmm data
#> Adding Munck data
#> Adding pacl_pmm data
#> Adding polyarchy_pmm data
#> Adding prc_pmm data
#> Adding Vanhanen_pmm data
#> Finalizing
summary(democracy)
#> extended_country_name GWn cown in_GW_system
#> Length:9137 Min. : 2.0 Min. : 2.0 Mode :logical
#> Class :character 1st Qu.:225.0 1st Qu.:225.0 FALSE:12
#> Mode :character Median :450.0 Median :450.0 TRUE :9125
#> Mean :458.8 Mean :458.5
#> 3rd Qu.:678.0 3rd Qu.:678.0
#> Max. :990.0 Max. :990.0
#>
#> year pmm_arat pmm_blm pmm_bollen pmm_fh
#> Min. :1946 Min. : 29.0 Min. :0.00 Min. : 0.00 Min. :1.00
#> 1st Qu.:1969 1st Qu.: 58.0 1st Qu.:0.00 1st Qu.: 22.84 1st Qu.:2.50
#> Median :1984 Median : 69.0 Median :0.00 Median : 53.59 Median :4.00
#> Mean :1982 Mean : 73.2 Mean :0.36 Mean : 55.46 Mean :4.15
#> 3rd Qu.:1997 3rd Qu.: 92.0 3rd Qu.:0.50 3rd Qu.: 90.95 3rd Qu.:6.00
#> Max. :2008 Max. :109.0 Max. :1.00 Max. :100.00 Max. :7.00
#> NA's :5264 NA's :8862 NA's :8627 NA's :2699
#> pmm_hadenius pmm_mainwaring pmm_munck pmm_pacl
#> Min. : 0.000 Min. :-1.000 Min. :0.000 Min. :0.0000
#> 1st Qu.: 1.500 1st Qu.:-1.000 1st Qu.:0.750 1st Qu.:0.0000
#> Median : 3.100 Median : 0.000 Median :1.000 Median :0.0000
#> Mean : 4.509 Mean : 0.122 Mean :0.838 Mean :0.4355
#> 3rd Qu.: 8.300 3rd Qu.: 1.000 3rd Qu.:1.000 3rd Qu.:1.0000
#> Max. :10.000 Max. : 1.000 Max. :1.000 Max. :1.0000
#> NA's :9008 NA's :8302 NA's :8795 NA's :70
#> pmm_polity pmm_polyarchy pmm_prc pmm_vanhanen
#> Min. :-10.0000 Min. : 0.000 Min. :1.000 Min. : 0.00
#> 1st Qu.: -7.0000 1st Qu.: 3.000 1st Qu.:1.000 1st Qu.: 0.00
#> Median : -1.0000 Median : 7.000 Median :1.000 Median : 5.90
#> Mean : 0.1286 Mean : 6.329 Mean :2.147 Mean :11.31
#> 3rd Qu.: 8.0000 3rd Qu.:10.000 3rd Qu.:4.000 3rd Qu.:20.70
#> Max. : 10.0000 Max. :10.000 Max. :4.000 Max. :49.00
#> NA's :1087 NA's :8784 NA's :3135 NA's :172
summary(prepare_democracy_data(democracy))
#> extended_country_name GWn cown in_GW_system
#> Length:9137 Min. : 2.0 Min. : 2.0 Mode :logical
#> Class :character 1st Qu.:225.0 1st Qu.:225.0 FALSE:12
#> Mode :character Median :450.0 Median :450.0 TRUE :9125
#> Mean :458.8 Mean :458.5
#> 3rd Qu.:678.0 3rd Qu.:678.0
#> Max. :990.0 Max. :990.0
#>
#> year pmm_arat pmm_blm pmm_bollen
#> Min. :1946 Min. :1.000 Min. :1.00 Min. : 1.000
#> 1st Qu.:1969 1st Qu.:2.000 1st Qu.:1.00 1st Qu.: 3.000
#> Median :1984 Median :3.000 Median :1.00 Median : 6.000
#> Mean :1982 Mean :3.878 Mean :1.72 Mean : 6.006
#> 3rd Qu.:1997 3rd Qu.:6.000 3rd Qu.:2.00 3rd Qu.:10.000
#> Max. :2008 Max. :7.000 Max. :3.00 Max. :10.000
#> NA's :5264 NA's :8862 NA's :8627
#> pmm_fh pmm_hadenius pmm_mainwaring pmm_munck
#> Min. : 1.000 Min. : 0.000 Min. :1.000 Min. :1.000
#> 1st Qu.: 4.000 1st Qu.: 1.500 1st Qu.:1.000 1st Qu.:3.000
#> Median : 7.000 Median : 3.100 Median :2.000 Median :4.000
#> Mean : 7.301 Mean : 4.509 Mean :2.122 Mean :3.333
#> 3rd Qu.:11.000 3rd Qu.: 8.300 3rd Qu.:3.000 3rd Qu.:4.000
#> Max. :13.000 Max. :10.000 Max. :3.000 Max. :4.000
#> NA's :2699 NA's :9008 NA's :8302 NA's :8795
#> pmm_pacl pmm_polity pmm_polyarchy pmm_prc
#> Min. :1.000 Min. : 1.00 Min. : 1.000 Min. :1.000
#> 1st Qu.:1.000 1st Qu.: 4.00 1st Qu.: 4.000 1st Qu.:1.000
#> Median :1.000 Median :10.00 Median : 8.000 Median :1.000
#> Mean :1.436 Mean :11.13 Mean : 7.329 Mean :2.147
#> 3rd Qu.:2.000 3rd Qu.:19.00 3rd Qu.:11.000 3rd Qu.:4.000
#> Max. :2.000 Max. :21.00 Max. :11.000 Max. :4.000
#> NA's :70 NA's :1087 NA's :8784 NA's :3135
#> pmm_vanhanen
#> Min. :1.000
#> 1st Qu.:1.000
#> Median :2.000
#> Mean :2.939
#> 3rd Qu.:5.000
#> Max. :8.000
#> NA's :172