This function is a simple wrapper for fscores(model, full.scores = TRUE, full.scores.SE = TRUE, ...) that returns scores in a tidy data frame instead of a matrix. More fine-grained control can be achieved by using mirt::fscores directly.

democracy_scores(model, adjust_to_dichotomous = TRUE, as_prob = TRUE)

Arguments

model

a mirt::SingleGroupClass model.

adjust_to_dichotomous

Whether to calculate an adjusted score where the midpoint represents the average cutpoint for dichotomous scores. See the vignette for more details. Default is TRUE.

as_prob

Whether to output scores as 0-1 probability scales. See the vignette for more details. Default is TRUE.

Value

A data frame with latent variable democracy scores (the equivalent of the UDS posterior means) for all country-years in the data, with standard errors and 95% confidence intervals.

Standard descriptive variables (generated by this package)

extended_country_name

The name of the country in the Gleditsch-Ward system of states, or the official name of the entity (for non-sovereign entities and states not in the Gleditsch and Ward system of states) or else a common name for disputed cases that do not have an official name (e.g., Western Sahara, Hyderabad). The Gleditsch and Ward scheme sometimes indicates the common name of the country and (in parentheses) the name of an earlier incarnation of the state: thus, they have Germany (Prussia), Russia (Soviet Union), Madagascar (Malagasy), etc. For details, see Gleditsch, Kristian S. & Michael D. Ward. 1999. "Interstate System Membership: A Revised List of the Independent States since 1816." International Interactions 25: 393-413. The list can be found at http://privatewww.essex.ac.uk/~ksg/statelist.html.

GWn

Gleditsch and Ward's numeric country code, from the Gleditsch and Ward list of independent states.

cown

The Correlates of War numeric country code, 2016 version. This differs from Gleditsch and Ward's numeric country code in a few cases. See http://www.correlatesofwar.org/data-sets/state-system-membership for the full list.

in_GW_system

Whether the state is "in system" (that is, is independent and sovereign), according to Gleditsch and Ward, for this particular date. Matches at the end of the year; so, for example South Vietnam 1975 is FALSE because, according to Gleditsch and Ward, the country ended on April 1975 (being absorbed by North Vietnam). It is also TRUE for dates beyond 2012 for countries that did not end by then, depsite the fact that the Gleditsch and Ward list has not been updated since.

Examples

# \donttest{
# Replicate the official UDS scores (2011 release)
library(dplyr)
library(mirt)
democracy_data <- 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

democracy_data <- prepare_democracy_data(democracy_data)

replication_2011_model <- mirt(democracy_data %>% select(matches("pmm")),
model = 1, itemtype = "graded", SE = TRUE, verbose = FALSE)

democracy_scores(model = replication_2011_model)
#> # A tibble: 9,137 × 13
#>       z1 se_z1 z1_pct975 z1_pct025 z1_adj z1_pct975_adj z1_pct025_adj z1_as_prob
#>    <dbl> <dbl>     <dbl>     <dbl>  <dbl>         <dbl>         <dbl>      <dbl>
#>  1 -1.89 0.486    -0.933     -2.84  -2.03         -1.08         -2.99     0.0297
#>  2 -1.89 0.486    -0.933     -2.84  -2.03         -1.08         -2.99     0.0297
#>  3 -1.57 0.323    -0.940     -2.21  -1.72         -1.09         -2.35     0.0578
#>  4 -1.57 0.323    -0.940     -2.21  -1.72         -1.09         -2.35     0.0578
#>  5 -1.45 0.230    -0.998     -1.90  -1.59         -1.14         -2.04     0.0739
#>  6 -1.57 0.323    -0.940     -2.21  -1.72         -1.09         -2.35     0.0578
#>  7 -1.57 0.323    -0.940     -2.21  -1.72         -1.09         -2.35     0.0578
#>  8 -1.57 0.323    -0.940     -2.21  -1.72         -1.09         -2.35     0.0578
#>  9 -1.57 0.323    -0.940     -2.21  -1.72         -1.09         -2.35     0.0578
#> 10 -1.45 0.230    -0.998     -1.90  -1.59         -1.14         -2.04     0.0739
#> # ℹ 9,127 more rows
#> # ℹ 5 more variables: z1_pct975_as_prob <dbl>, z1_pct025_as_prob <dbl>,
#> #   z1_adj_as_prob <dbl>, z1_pct975_adj_as_prob <dbl>,
#> #   z1_pct025_adj_as_prob <dbl>

# }