- Online documentation and vignettes at mc-stan.org/loo
- As of v2.0.0 loo defaults to 1 core but we recommend using as many as possible. Use the 'cores' argument or set options(mc.cores = NUM_CORES) for an entire session.
options(cmdstanr_warn_inits =FALSE)# settings shared by every model in this vignette: 2 chains, with the cores# divided between them for within-chain parallelization, and the default number# of iterations. Lower n_iter and n_warmup for a quicker (rougher) run.n_chains <-2n_cores <-8n_iter <-1000n_warmup <-1000
In this vignette, we explore two topics that go beyond the standard ideal point model. In the first, multidimensional ideal points, we look at how to fit an ideal point model that has multiple compensatory dimensions, meaning the dimensions are linear and additive. This is a somewhat restrictive view of what multiple dimensions are as it assumes they are a priori independent and do not interact, but it is the standard model in most analyses and thus is also included as the standard specification in idealstan. In the second part of the vignette, we allow for observed and missingness discrimination parameters to be correlated with each other explicitly (i.e., by fitting a correlation matrix to the discriminations). This feature allows for more flexibility in the missing-data model and also provides an estimate of how informative the missingness patterns are for the person ideal points.
NB: While I wrote the text for this vignette, code was generated with the help of Claude Opus 5.5.
Data
We will first use the rollcall vote data from the 114th Senate as in other vignettes to look at multiple dimensions. The advantage in using this data is that we can explicitly compare idealstan estimates to other extant estimates (i.e., DW-NOMINATE) (Poole and Rosenthal 1985, 1997; Boche et al. 2018).
# The 114th Senate roll-call votes that come with the package, in long form: one# row per senator per roll call.data('senate114')# Absences become missing values, and the outcome becomes 0 (No) / 1 (Yes).senate114$cast_code <-ifelse(senate114$cast_code =="Absent", NA,as.integer(senate114$cast_code) -1L)table(senate114$cast_code, useNA ="ifany")
0 1 <NA>
11233 12119 648
# An idealdata object with senators as persons, roll calls as items and party as# the group.senate_data <-id_make(senate114,outcome_disc ='cast_code',person_id ='bioname',item_id ='rollnumber',group_id ='party_code')
Choosing the senators to pin
One challenge with multi-dimensional estimation is that we generally need D + 1 pinned persons or items given the number of dimensions D(Rivers 2003). Furthermore, to assist with identification, idealstan sets the person ideal point or discrimination to 0 for all other dimensions, meaning the pinned parameter can only contribute to the dimension it is pinned on. This is part of what is meant by non-compensatory, independent dimensions: they have to represent distinct concepts such that different persons/items could load on them independently.
Below we use the same senators to dimensions 1 and 2 for those that load highest on DW-NOMINATE’s two-dimensional estimates. A relatively large value of +/- 6 is used to pin the persons given that the scaling becomes more difficult in multiple dimensions (the ideal points need to be more widely spaced).
# One row per senator, with their DW-NOMINATE scores (included in the data from# voteview.com). These only guide the choice of the senators to pin; the models# don't use them.senators <-distinct(senate114, bioname, party_code, nominate_dim1, nominate_dim2)# A model with D dimensions pins D + 1 persons. Two of them identify dimension 1:# they are pinned at fix_high and fix_low on dimension 1 and at 0 on dimension 2.# The third identifies dimension 2: it is pinned at fix_high on dimension 2 and at# 0 on dimension 1. So pick senators who are extreme on their own dimension and# close to 0 on the other one.pin_high <- senators$bioname[which.max(senators$nominate_dim1 -abs(senators$nominate_dim2))]pin_low <- senators$bioname[which.min(senators$nominate_dim1 +abs(senators$nominate_dim2))]pin_dim2 <- senators$bioname[which.max(senators$nominate_dim2 -abs(senators$nominate_dim1))]# The value to pin them at. idealstan bounds the discriminations to (-1, 1), so# for votes that split the parties almost perfectly the ideal points have to# spread out widely, to about +/-7 on dimension 1 in these data. Pins near the# centre of that space barely constrain how it rotates, and with pins at +/-1 the# chains don't agree on dimension 2. Pins at +/-6 put the pinned senators near# the edges of the space, where they identify the rotation. The dimension-2# senator is pinned at the same value (fix_high) on dimension 2.pin_value <-6filter(senators, bioname %in%c(pin_high, pin_low, pin_dim2)) |>mutate(role =case_when(bioname == pin_high ~"dimension 1, high", bioname == pin_low ~"dimension 1, low",TRUE~"dimension 2")) |>tt()
bioname
party_code
nominate_dim1
nominate_dim2
role
WARREN, Elizabeth
D
-0.764
-0.254
dimension 1, low
SCOTT, Tim
R
0.653
-0.010
dimension 1, high
MANCHIN, Joe, III
D
-0.057
0.470
dimension 2
A one-dimensional model
We first fit a one-dimensional, standard left vs. right ideal point model below with the Senate data for comparison.
# The standard binary 2-PL (model 1), with absences dropped, as a baseline. Only# the two dimension-1 senators are pinned, at +pin_value and -pin_value.sen_1d <-id_estimate(senate_data,model_type =1,fixtype ='prefix',restrict_ind_high = pin_high,restrict_ind_low = pin_low,fix_high = pin_value,fix_low =-pin_value,nchains = n_chains, ncores = n_cores,niters = n_iter, warmup = n_warmup,seed =84520)
Finished in 2.8 seconds.
Running MCMC with 2 parallel chains, with 4 thread(s) per chain...
Chain 2 finished in 125.1 seconds.
Chain 1 finished in 126.2 seconds.
Both chains finished successfully.
Mean chain execution time: 125.7 seconds.
Total execution time: 126.3 seconds.
id_plot_rhats(sen_1d)
A two-dimensional model
We now fit a multi-dimensional model by specifying that num_dim = 2 and adding Joe Manchin as our additional constraint to restrict_num_dim for the second dimension. We would need at least 1 person for each additional dimension if we had more than 2.
It’s important to note that these models, even when they are static, add a lot of computational complexity. On my recent Macbook, I could fit the one-dimensional model in only 2 minutes with two MCMC chains, while the two-dimensional model took almost 5 minutes even with multiple cores per chain. However, both models are identified (all Rhats are below 1.1).
# The same model with two dimensions (num_dim = 2). restrict_ind_dim names the# senator who identifies dimension 2; with const_type = "persons" (the default) the# pinned persons fix the location, scale and rotation of the space.sen_2d <-id_estimate(senate_data,model_type =1,num_dim =2,fixtype ='prefix',restrict_ind_high = pin_high,restrict_ind_low = pin_low,restrict_ind_dim = pin_dim2,fix_high = pin_value,fix_low =-pin_value,nchains = n_chains, ncores = n_cores,niters = n_iter, warmup = n_warmup,seed =84520)
Finished in 8.3 seconds.
Running MCMC with 2 parallel chains, with 4 thread(s) per chain...
Chain 2 finished in 277.3 seconds.
Chain 1 finished in 282.4 seconds.
Both chains finished successfully.
Mean chain execution time: 279.9 seconds.
Total execution time: 282.5 seconds.
# convergence of all the parameters, both dimensions includedid_plot_rhats(sen_2d)
We can then plot the ideal points in multiple dimensions in the plot below. Note that there is a lot more variation (wider spread) of the ideal points on the first versus second dimension. This is almost always going to be true for social science datasets–the first dimension will capture the bulk of the variation in the data.
# The ideal points on each dimension, with the plotting function used for# one-dimensional models: dim picks the dimension.id_plot_persons(sen_2d, dim =1, person_ci_alpha =0.2) +ggtitle('Dimension 1')
id_plot_persons(sen_2d, dim =2, person_ci_alpha =0.2) +ggtitle('Dimension 2')
We can combine the dimensions into a two-d plot by first extracting the ideal points with the summary command on the fitted model:
# The summary of a multidimensional model has one row per person and dimension,# with a Dimension column. Spread it out to one row per senator to plot the# two-dimensional space, labelling the pinned senators.ideal_2d <-summary(sen_2d) |>select(Person, Group, Dimension, `Posterior Median`) |>pivot_wider(names_from = Dimension, values_from =`Posterior Median`,names_prefix ="dim_")ggplot(ideal_2d, aes(x = dim_1, y = dim_2, colour = Group)) +geom_point() +geom_text(data =filter(ideal_2d, Person %in%c(pin_high, pin_low, pin_dim2)),aes(label = Person), vjust =-0.8, size =3, show.legend =FALSE) +scale_colour_manual(values =c(D ='blue', R ='red', I ='darkgreen')) +theme_minimal() +labs(x ="Dimension 1", y ="Dimension 2", colour ="Party")
We can also compare our estimates to those of DW-NOMINATE:
# How the two dimensions line up with DW-NOMINATE's, and how the one-dimensional# model's ideal points line up with both.ideal_1d <-summary(sen_1d) |>select(Person, one_dim =`Posterior Median`)comparison <- ideal_2d |>left_join(ideal_1d, by ="Person") |>left_join(senators, by =c("Person"="bioname"))tibble(Estimate =c("2-D model, dimension 1", "2-D model, dimension 2", "1-D model"),`Cor. with NOMINATE dimension 1`=c(cor(comparison$dim_1, comparison$nominate_dim1),cor(comparison$dim_2, comparison$nominate_dim1),cor(comparison$one_dim, comparison$nominate_dim1)),`Cor. with NOMINATE dimension 2`=c(cor(comparison$dim_1, comparison$nominate_dim2),cor(comparison$dim_2, comparison$nominate_dim2),cor(comparison$one_dim, comparison$nominate_dim2))) |>tt(digits =2)
Estimate
Cor. with NOMINATE dimension 1
Cor. with NOMINATE dimension 2
2-D model, dimension 1
0.93
0.3
2-D model, dimension 2
-0.59
0.04
1-D model
0.94
0.3
We can see that our first dimension correlates very highly, about 0.95, but we get different results for dimension 2. Specifically, our results are anti-correlated with DW-NOMINATE, which is particularly interesting as we used their 2-D estimates to find people to pin. These are very different estimation techniques, though, so the divergence isn’t necessarily very surprising.
We can also use the summary command with the pars='items' option to get the discriminations for all of the items (votes) in the data. The Dimension column in the exported tibble records the dimension for each vote/item’s discrimination:
# The item summary also has a Dimension column. The roll calls that load most# strongly on dimension 2, with the bill and the result of the vote from the data# (in a non-inflated model, only the "Non-Inflated" item parameters are used).votes <-distinct(senate114, rollnumber, date, bill_number, vote_result) |>mutate(`Item Name`=as.character(rollnumber))summary(sen_2d, pars ='items') |>filter(`Item Type`=="Non-Inflated Discrimination", Dimension ==2) |>arrange(desc(abs(`Posterior Median`))) |>slice(1:10) |>left_join(votes, by ="Item Name") |>select(`Item Name`, `Posterior Median`, date, bill_number, vote_result) |>tt(digits =2)
Item Name
Posterior Median
date
bill_number
vote_result
289
-0.83
2015-10-27
S754
Amendment Rejected
285
-0.82
2015-10-27
S754
Amendment Rejected
447
0.78
2016-06-22
HR2578
Cloture Motion Rejected
226
-0.72
2015-07-09
S1177
Amendment Rejected
195
0.69
2015-05-23
S1357
Cloture on the Motion to Proceed Rejected
200
0.68
2015-06-02
HR2048
Amendment Rejected
134
0.67
2015-03-27
SCONRES11
Amendment Agreed to
43
0.66
2015-01-29
S1
Amendment Rejected
207
0.62
2015-06-11
HR1735
Cloture Motion Rejected
453
-0.62
2016-06-29
S2328
Motion to Table Failed
Posterior predictions and other functions work the same as 1-dimensional models:
# Posterior predictive check of the two-dimensional model: id_post_pred draws# votes from the posterior predictive distribution, and id_plot_ppc compares their# distribution with the observed votes.pred_2d <-id_post_pred(sen_2d)
[1] "Processing posterior replications for 23352 scores using 100 posterior samples out of a total of 2000 samples."
[1] "Now on model 1"
id_plot_ppc(sen_2d, ppc_pred = pred_2d)
and also leave-one-out (LOO-IC) evaluation:
# Does the second dimension improve the fit? Compare the models' expected# predictive accuracy with approximate leave-one-out cross-validation. id_post_pred# with type = 'log_lik' returns the pointwise log-likelihood, and derive_chain()# gives the chain of each draw for the relative efficiencies.ll_1d <-id_post_pred(sen_1d, type ='log_lik')
[1] "Processing posterior replications for 23352 scores using 2000 posterior samples out of a total of 2000 samples."
[1] "Now on model 1"
ll_2d <-id_post_pred(sen_2d, type ='log_lik')
[1] "Processing posterior replications for 23352 scores using 2000 posterior samples out of a total of 2000 samples."
[1] "Now on model 1"
The LOO results show that the 2-D model is preferred, although the fit has some issues (i.e. outliers with k_psis > 0.7).
Identifying the dimensions with items
It is often better in social science research to identify models by pinning item discrimination parameters rather than persons because person ideal points are the desired measures.
While ordinarily we would want to use substantive knowledge to pick items for different dimensions, in this case we will use our previous 2-D fit to select item discriminations for each dimension based on how strongly items load:
# The rotation can instead be identified with items (const_type = "items"). The# discriminations are then lower triangular: the item in restrict_ind_high gets a# discrimination of 0 on dimension 2, and the item in restrict_ind_dim gets a# strongly positive discrimination on dimension 2. Pick, from the person-identified# fit, the roll calls that best fit that pattern.discrim_2d <-summary(sen_2d, pars ='items') |>filter(`Item Type`=="Non-Inflated Discrimination") |>select(`Item Name`, Dimension, `Posterior Median`) |>pivot_wider(names_from = Dimension, values_from =`Posterior Median`,names_prefix ="dim_")item_high <- discrim_2d$`Item Name`[which.max(discrim_2d$dim_1 -abs(discrim_2d$dim_2))]item_low <- discrim_2d$`Item Name`[which.min(discrim_2d$dim_1)]item_dim2 <-setdiff(discrim_2d$`Item Name`[order(-discrim_2d$dim_2)],c(item_high, item_low))[1]filter(votes, `Item Name`%in%c(item_high, item_low, item_dim2)) |>select(`Item Name`, date, bill_number, vote_result) |>tt()
Item Name
date
bill_number
vote_result
100
2015-03-26
SCONRES11
Amendment Rejected
126
2015-03-26
SCONRES11
Amendment Agreed to
447
2016-06-22
HR2578
Cloture Motion Rejected
And in the code below we fit the model given these pinned item discrimination parameters:
# The same two-dimensional model, identified with the three roll calls. With# const_type = "items", the pins are set with restrict_N_high/restrict_sd_high (and# the _low versions) rather than fix_high/fix_low; the defaults are used here.sen_2d_items <-id_estimate(senate_data,model_type =1,num_dim =2,fixtype ='prefix',const_type ='items',restrict_ind_high = item_high,restrict_ind_low = item_low,restrict_ind_dim = item_dim2,nchains = n_chains, ncores = n_cores,niters = n_iter, warmup = n_warmup,seed =84520)
Finished in 7.4 seconds.
Running MCMC with 2 parallel chains, with 4 thread(s) per chain...
Chain 1 finished in 281.5 seconds.
Chain 2 finished in 283.6 seconds.
Both chains finished successfully.
Mean chain execution time: 282.6 seconds.
Total execution time: 283.9 seconds.
id_plot_rhats(sen_2d_items)
To see how the two types of identification compare (persons vs. items), we can compare the estimates by joining the summary tibbles from the two models:
# The two identifications give the same space up to a rotation, rescaling and# shift, so regress each dimension of the person-identified fit on both dimensions# of the item-identified one. An R^2 near 1 means the spaces agree.ideal_2d_items <-summary(sen_2d_items) |>select(Person, Dimension, `Posterior Median`) |>pivot_wider(names_from = Dimension, values_from =`Posterior Median`,names_prefix ="item_dim_") |>left_join(ideal_2d, by ="Person")tibble(`Person-identified dimension`=1:2,`R^2 on the item-identified dimensions`=c(summary(lm(dim_1 ~ item_dim_1 + item_dim_2, data = ideal_2d_items))$r.squared,summary(lm(dim_2 ~ item_dim_1 + item_dim_2, data = ideal_2d_items))$r.squared)) |>tt(digits =3)
Person-identified dimension
R^2 on the item-identified dimensions
1
0.996
2
0.892
As can be seen, the two methods can produce near-identical results. The advantage of pinning items is that the person ideal points can then freely float. Also, pinning items is useful in datasets where the number of items is large relative to the number of persons, which is especially true in legislative and judicial datasets.
Correlated discriminations
In this section, we look at another advanced feature in idealstan, albeit one that is widely applicable: allowing for correlation between missingness discrimination parameters and the observed discrimination parameters. As is described in the package introduction, idealstan can handle non-ignorable missingness (Rosas et al. 2015) by estimating a separate missingness space in which each item has a missngness discrimination parameter (Kubinec 2019). In the baseline model, these parameters are independent, but we can directly model correlation between items’ missingness and observed discrimination parameters to see if the two spaces are strongly related.
This method allows for more flexibility in adjusting for missingness patterns and also provides a useful summary statistic for how “suspicious” the missingness patterns are in the data given the model.
In the code below, we first fit a regular 1-D model for missingness with the Senate data (type = 2 for an inflated Bernoulli specification for binary data), and then a correlated missingness model where we explicitly allow missingness-observed discrimination correlation with the discrim_corr = TRUE argument:
# A one-dimensional model with absences as a missing-data (hurdle) process# (model 2). Each roll call then has two discriminations: one for the vote, and one# for whether the senator shows up. First without, then with a correlation between# them (discrim_corr = TRUE): a Gaussian copula with one correlation, discrim_rho,# shared by all roll calls. Each discrimination keeps its usual prior as its# marginal distribution.sen_abs <-id_estimate(senate_data,model_type =2,fixtype ='prefix',restrict_ind_high = pin_high,restrict_ind_low = pin_low,fix_high = pin_value,fix_low =-pin_value,nchains = n_chains, ncores = n_cores,niters = n_iter, warmup = n_warmup,seed =84520)
Finished in 4.0 seconds.
Running MCMC with 2 parallel chains, with 4 thread(s) per chain...
Chain 2 finished in 138.8 seconds.
Chain 1 finished in 141.1 seconds.
Both chains finished successfully.
Mean chain execution time: 140.0 seconds.
Total execution time: 141.3 seconds.
Running MCMC with 2 parallel chains, with 4 thread(s) per chain...
Chain 2 finished in 150.4 seconds.
Chain 1 finished in 154.1 seconds.
Both chains finished successfully.
Mean chain execution time: 152.3 seconds.
Total execution time: 154.3 seconds.
id_plot_rhats(sen_corr)
Running the correlated model takes a bit longer, but the output is largely similar & both models are statistically identified (Rhat < 1.1). We can expect the rho parameter to see how correlated the missingness and observed discrimination parameters actually are:
# The posterior of the correlation, and how many roll calls inform it (only items# with a missing-data model do).summary(sen_corr, pars ='discrim_corr') |>tt(digits =2)
Posterior Median
High Posterior Interval
Low Posterior Interval
Number of Items
Parameter
-0.026
0.054
-0.11
240
discrim_rho
A value of -0.029 for the posterior median is quite a small estimate, and the uncertainty interval includes a wide range of values. For this dataset, we don’t see a lot of correlation suggesting that missingness and observed spaces are influencing each other very strongly.
To get a sense of how much this estimate was informed by the data, we can compare it to the weakly informative prior that idealstan puts on the correlation coefficient:
# The posterior draws of the correlation against its prior. By default# (rho + 1)/2 ~ Beta(discrim_corr_eta, discrim_corr_eta) with discrim_corr_eta = 2,# so the density of rho is dbeta((rho + 1)/2, 2, 2) / 2. Absences are rare in# these data (about 3% of the votes), so check how far the data move the# correlation away from its prior.rho_draws <-tibble(rho =as.numeric(summary(sen_corr, pars ='discrim_corr',aggregated =FALSE)))ggplot(rho_draws, aes(x = rho)) +geom_density(aes(colour ="Posterior")) +stat_function(aes(colour ="Prior"),fun =function(r) dbeta((r +1) /2, 2, 2) /2) +xlim(-1, 1) +theme_minimal() +labs(x ="Correlation of vote and absence discriminations", y ="Density",colour =NULL)
This plot shows that after observing the data, we can in fact conclude that the missingness and observed parameters are mostly uncorrelated.
We can also plot the observed and missingness discrimination parameters to see if we can visually identify any correlation:
# Each roll call's vote discrimination against its absence discrimination, from# the models without and with the correlation.discrims <-bind_rows(`Without correlation`=summary(sen_abs, pars ='items'),`With correlation`=summary(sen_corr, pars ='items'),.id ="Model") |>filter(`Item Type`%in%c("Non-Inflated Discrimination", "Inflated Discrimination")) |>select(Model, `Item Name`, `Item Type`, `Posterior Median`) |>pivot_wider(names_from =`Item Type`, values_from =`Posterior Median`)ggplot(discrims, aes(x =`Non-Inflated Discrimination`, y =`Inflated Discrimination`)) +geom_point(alpha =0.5) +facet_wrap(~ Model) +theme_minimal() +labs(x ="Vote discrimination", y ="Absence discrimination")
Again, not a whole lot of differences across the two plots.
We can also use LOO to evaluate whether the correlated model has a better predictive fit:
# How much the correlation changes the ideal points, and whether it improves the# expected predictive accuracy.ideal_abs <-summary(sen_abs) |>select(Person, without =`Posterior Median`)ideal_corr <-summary(sen_corr) |>select(Person, with =`Posterior Median`)ideal_both <-left_join(ideal_abs, ideal_corr, by ="Person")cor(ideal_both$without, ideal_both$with)
[1] 0.9999942
ll_abs <-id_post_pred(sen_abs, type ='log_lik')
[1] "Processing posterior replications for 24000 scores using 2000 posterior samples out of a total of 2000 samples."
[1] "Now on model 2"
ll_corr <-id_post_pred(sen_corr, type ='log_lik')
[1] "Processing posterior replications for 24000 scores using 2000 posterior samples out of a total of 2000 samples."
[1] "Now on model 2"
model elpd_diff se_diff p_worse diag_diff diag_elpd
Without correlation 0.0 0.0 NA 93 k_psis > 0.7
With correlation -2.1 3.5 0.73 |elpd_diff| < 4 83 k_psis > 0.7
Here the LOO statistic suggests the two models are almost identical in terms of predictive accuracy. For this instance, not a whole lot of reason to prefer the correlated model over the simpler un-correlated one. However, in the next section we can look at a context where correlation has a bigger impact.
Correlated missing data: the UN General Assembly
Given these quite low correlations between missingness and observed discrimination parameters in the Senate data, in this section I also look at voting data from the UN General Assembly (Voeten 2013; Robinson 2021) where absences and abstentions are much more common than in the Senate:
# Roll-call votes in the UN General Assembly from the unvotes package (Erik# Voeten's data), for the 72nd to 74th sessions (2017 to 2019), the most recent# in the package. un_votes has one row per country per roll call, but only for# votes that were cast (yes, abstain or no): absences are left out.# the votes are available in the package unvoteslibrary(unvotes)# we also use countrycode in this sectionlibrary(countrycode)un_rc <-filter(un_roll_calls, session %in%72:74)un_cast <-inner_join(un_votes, select(un_rc, rcid, session), by ="rcid") |># the data still call Serbia by the name of the state it succeededmutate(country =if_else(country =="Yugoslavia", "Serbia", country))# Put the absences back. A country counts as a member in a session if it cast at# least one vote in it (all 193 members did in each of these sessions), and as# absent from the roll calls of that session it has no vote on.un_long <-distinct(un_cast, country, session) |>inner_join(select(un_rc, rcid, session), by ="session",relationship ="many-to-many") |>left_join(select(un_cast, rcid, country, vote), by =c("rcid", "country")) |>mutate(# an ordinal outcome, No < Abstain < Yes, with absences as missing valuesoutcome =case_when(vote =="no"~0L, vote =="abstain"~1L, vote =="yes"~2L),# World Bank region, used as the group in the plotsregion =countrycode(country, "country.name", "region"))table(un_long$vote, useNA ="ifany")
yes abstain no <NA>
44375 6385 4085 4792
We can look at these absence patterns among countries in the data:
# How often each country is absent. Absences are more common than in the Senate# (8% of the votes), and a few countries miss most roll calls.un_absent <- un_long |>group_by(country) |>summarise(absent =mean(is.na(outcome)))ggplot(un_absent, aes(x = absent)) +geom_histogram(binwidth =0.02) +theme_minimal() +labs(x ="Share of roll calls the country was absent from",y ="Number of countries")
slice_max(un_absent, absent, n =10) |>tt(digits =2)
country
absent
Dominica
0.73
South Sudan
0.64
São Tomé & Príncipe
0.55
Somalia
0.51
Congo - Kinshasa
0.44
Niger
0.41
Kiribati
0.4
Tonga
0.4
Nauru
0.39
Grenada
0.38
It’s important to note that absences can be quite high for some countries, as Panke (2014) and Morse and Coggins (2024) have analyzed. That suggests missingness may be an important phenomenon to model in the data, which we do in the next section using a similar model as before except that now we include abstention as an ordinal category in between yes and no (the same strategy as Bailey et al. (2017)), requiring us to use the ratingscale model (model types 3 and 4).
First we prepare the data:
# In the missing-data model, whether a country votes depends only on its ideal# point and the roll call's parameters: there is no country-level propensity to# be absent. So a country that misses most votes for reasons that have nothing# to do with the resolutions (a small mission, for example: see Panke 2014) can# only be fit by moving its ideal point, and the countries that rarely attend end# up at one end of the scale. Keep the countries absent from at most 20% of the# roll calls.max_absent <-0.2un_keep <-filter(un_absent, absent <= max_absent)$country# the number of countries kept, of 193length(un_keep)
[1] 167
# Many resolutions pass almost unanimously, and they say little about where the# countries stand. Drop the lopsided roll calls, where fewer than 2.5% of the# votes cast by these countries differ from the most common vote (the cut-off# commonly used in roll-call scaling).un_lopsided <- un_long |>filter(country %in% un_keep, !is.na(vote)) |>group_by(rcid) |>summarise(minority =1-max(table(vote)) /n())un_rcids <-filter(un_lopsided, minority >=0.025)$rcid# the number of roll calls kept, of 309length(un_rcids)
We will use voting with the United States to identify our first dimension, i.e., we assume that the US is a polarizing force that will predict voting patterns fairly well (Voeten 2000; Bailey et al. 2017):
# Pin the United States at the high end and, at the low end, the country that# votes with it least often among those absent from fewer than 5% of the roll# calls (a pinned country's position comes from its own votes, so pin countries# that vote nearly every time).us_votes <-filter(un_long, country =="United States") |>select(rcid, us_vote = vote)un_agree <- un_long |>filter(!is.na(vote), country %in% un_keep) |>left_join(us_votes, by ="rcid") |>group_by(country) |>summarise(agree_us =mean(vote == us_vote)) |>left_join(un_absent, by ="country")un_pin_high <-"United States"un_pin_low <- un_agree |>filter(absent <0.05) |>slice_min(agree_us, n =1) |>pull(country)slice_min(un_agree, agree_us, n =8) |>tt(digits =2)
country
agree_us
absent
North Korea
0.073
0.152
Syria
0.105
0.071
Venezuela
0.115
0.013
Angola
0.115
0.074
Zimbabwe
0.118
0.042
Iran
0.119
0.049
Burundi
0.125
0.123
Uganda
0.132
0.091
# The countries spread out from about -15 to +20 in these data, and with pins at +/-3# the fit can fold (the United States stays at its pin while Israel goes to the# other end of the scale). Pin the two countries near where they fall in the# space.un_pin_value <-10
North Korea rarely votes with the US, and interestingly, also has a high absence rate.
Given the US and North Korea as pins, we can fit the model:
# An ordinal (rating-scale) model of the votes with the missing-data model# (model 4): each roll call has a discrimination for the vote and one for whether# a country is absent, and discrim_corr = TRUE correlates the two across roll# calls with discrim_rho. The rating-scale model shares its cutpoints across roll# calls; the graded response model (models 5 and 6) gives each roll call its own,# but some roll calls have no abstentions or no No votes, which leaves their# cutpoints with no data.un_corr <-id_estimate(un_data,model_type =4,discrim_corr =TRUE,fixtype ='prefix',restrict_ind_high = un_pin_high,restrict_ind_low = un_pin_low,fix_high = un_pin_value,fix_low =-un_pin_value,nchains = n_chains, ncores = n_cores,niters = n_iter, warmup = n_warmup,seed =84520)
Finished in 16.7 seconds.
Running MCMC with 2 parallel chains, with 4 thread(s) per chain...
Chain 1 finished in 1009.4 seconds.
Chain 2 finished in 1032.2 seconds.
Both chains finished successfully.
Mean chain execution time: 1020.8 seconds.
Total execution time: 1032.6 seconds.
id_plot_rhats(un_corr)
The model converges reasonably well (Rhats under 1.1). We could run it for longer to get shorter Rhats, but for the purposes of the vignette we can show that the parameters are identified (i.e., they are converging to the same mode).
This plot shows the one-dimensional country-level ideal points colored by the region in which that country lies.
# The countries' ideal points, with their 5% to 95% posterior intervals,# coloured by region.summary(un_corr) |>left_join(distinct(un_long, Person = country, region), by ="Person") |>ggplot(aes(x =`Posterior Median`, y =reorder(Person, `Posterior Median`))) +geom_pointrange(aes(xmin =`Low Posterior Interval`, xmax =`High Posterior Interval`,colour = region), size =0.1) +theme_minimal() +theme(axis.text.y =element_text(size =5), legend.position ="bottom") +guides(colour =guide_legend(ncol =2)) +labs(x ="Ideal point", y =NULL, colour =NULL)
We can again examine our correlation parameter rho to see if there is substantial correlation between missing and observed UNGA votes:
# The posterior of the correlation against its prior (see rho_prior_posterior# above).summary(un_corr, pars ='discrim_corr') |>tt(digits =2)
Posterior Median
High Posterior Interval
Low Posterior Interval
Number of Items
Parameter
0.16
0.27
0.047
250
discrim_rho
un_rho_draws <-tibble(rho =as.numeric(summary(un_corr, pars ='discrim_corr',aggregated =FALSE)))ggplot(un_rho_draws, aes(x = rho)) +geom_density(aes(colour ="Posterior")) +stat_function(aes(colour ="Prior"),fun =function(r) dbeta((r +1) /2, 2, 2) /2) +xlim(-1, 1) +theme_minimal() +labs(x ="Correlation of vote and absence discriminations", y ="Density",colour =NULL)
The plot shows that the data is informative relative to the prior and the posterior is centered on positive correlation, i.e., in this dataset, positive observed discriminations tend to occur with positive absence/missing discriminations. This is an interesting pattern because it suggests that countries who vote for a positive discrimination UNGA resolution are also more likely to be absent on that bill (conditional on their unobserved true ideal point).
We can visually examine this distribution using a scatterplot of the item discrimination parameters:
# Each roll call's vote discrimination against its absence discrimination. The# roll calls coded as being about the Palestinian conflict, where the United# States and Israel are usually in a small minority, are coloured separately.palestine <-filter(un_roll_call_issues, issue =="Palestinian conflict")$rcidun_discrims <-summary(un_corr, pars ='items') |>filter(`Item Type`%in%c("Non-Inflated Discrimination", "Inflated Discrimination")) |>select(roll_call = Parameter, `Item Type`, `Posterior Median`) |>pivot_wider(names_from =`Item Type`, values_from =`Posterior Median`) |>mutate(Issue =ifelse(roll_call %in% palestine, "Palestinian conflict", "Other"))ggplot(un_discrims, aes(x =`Non-Inflated Discrimination`, y =`Inflated Discrimination`)) +geom_point(aes(colour = Issue), alpha =0.6) +theme_minimal() +labs(x ="Vote discrimination", y ="Absence discrimination", colour =NULL)
The points that are marked as relating to Palestine show very low discrimination (i.e., they are close to 0), which suggests that these votes relate to a political cleavage that isn’t well-captured by our one-dimensional. Alternatively, they could be votes that are unanimous/a-political, but given the topic, that isn’t very likely.
The table shows the votes/items with the highest missingness discrimination (whether positive or negative). As can be seen, there are a good number of votes with relatively high politically-colored absence rates, though not all of these bills have very high total absence rates.
# The roll calls whose absences are most strongly related to the countries' ideal# points (the largest absence discriminations in absolute value), with the# resolution and how many of the countries in the model were absent.un_items_abs <-summary(un_corr, pars ='items') |>filter(`Item Type`=="Inflated Discrimination") |>mutate(rcid =as.numeric(Parameter)) |>slice_max(abs(`Posterior Median`), n =10)un_long |>filter(country %in% un_keep) |>group_by(rcid) |>summarise(absent =mean(is.na(outcome))) |>inner_join(select(un_items_abs, rcid, absence_discrim =`Posterior Median`), by ="rcid") |>left_join(un_rc, by ="rcid") |># some roll calls have no short title, so use the start of the descriptionmutate(resolution =coalesce(short, paste0(substr(descr, 1, 100), "..."))) |>select(rcid, date, unres, resolution, absent, absence_discrim) |>arrange(desc(abs(absence_discrim))) |>tt(digits =2)
rcid
date
unres
resolution
absent
absence_discrim
5585
2017-12-20
A/RES/72/215
Agricultural technology for sustainable development : resolution / adopted by the General Assembly
0.024
-0.43
6158
2018-12-22
R/73/264
Situation of human rights in Myanmar : resolution / adopted by the General Assembly
0.09
-0.43
5996
2017-12-04
R/72/50
The Acting President: I shall now put to the vote operative paragraph 28. A...
0.036
-0.41
5985
2017-12-04
R/72/39
The Acting President: Draft resolution XI is entitled_Towards a nuclear-weapon-free world: accelerat...
0.036
-0.41
9144
2019-12-27
A/RES/74/251
Programme planning
0.138
-0.39
6004
2017-12-19
R/72/163
The President: Let us first clarify the procedural proposal presented by the delegation of the Sudan...
0.12
-0.38
5982
2017-12-04
R/72/37
The Acting President: Draft resolution VIII is entitled _Countering the threat posed by improvised e...
0.03
-0.38
6058
2017-12-04
R/72/50
The Acting President: I shall now put to the vote operative paragraph 2....
0.036
-0.36
5995
2017-12-04
R/72/50
The Acting President: I shall now put to the vote operative paragraph 21. A...
0.03
-0.35
6003
2017-12-11
R/72/131
The President: We have heard the last speaker in explanation of vote before the voting. The meeting ...
0.305
-0.35
To validate the model, we can compare our results of politically-motivated absences to Morse and Coggins (2024) analysis of votes they consider to be “strategic absences”: days when a country was present (they voted for at least 1 UNGA resolution) but skipped the vote nonetheless. In the plot below, we show the average missingness discrimination for the votes they consider to be strategic absences vs. non-strategic absences.
# Morse and Coggins (2024) code a country's absence from a roll call as strategic# when it voted on another roll call on the same day, and as non-strategic when it# cast no vote that day. Their coded data aren't public, so I apply their rule to the# dates in un_roll_calls. Every roll call of the day counts, including the lopsided# ones left out of the model. un_abs_type <- un_long |>left_join(select(un_rc, rcid, date), by ="rcid") |>group_by(country, date) |>mutate(voted_that_day =any(!is.na(outcome))) |>ungroup() |>filter(is.na(outcome), country %in% un_keep, rcid %in% un_rcids) |>mutate(Absence =if_else(voted_that_day, "Strategic", "Non-strategic"))count(un_abs_type, Absence)
# A tibble: 2 × 2
Absence n
<chr> <int>
1 Non-strategic 756
2 Strategic 825
# The posterior draws of each roll call's absence discrimination. Its sign only# says which end of the scale is more often absent, so take its absolute value:# how strongly being absent from that roll call depends on a country's ideal point.un_abs_draws <-summary(un_corr, pars ='items', aggregated =FALSE) |>filter(`Item Type`=="Inflated Discrimination") |>transmute(rcid =as.numeric(Parameter), Iteration,discrim =abs(Posterior_Sample))# The average over the absences of each type, with each absence given its roll# call's discrimination, computed for every posterior draw so that the averages# have posterior intervals.un_abs_avg <-count(un_abs_type, Absence, rcid) |>inner_join(un_abs_draws, by ="rcid", relationship ="many-to-many") |>group_by(Absence, Iteration) |>summarise(avg_discrim =weighted.mean(discrim, n), .groups ="drop")ggplot(un_abs_avg, aes(x = avg_discrim, fill = Absence)) +geom_density(alpha =0.5, colour =NA) +theme_minimal() +labs(x ="Average absolute absence discrimination", y ="Density", fill =NULL)
# the averages and their difference, with 5% to 95% posterior intervalsun_abs_avg |>pivot_wider(names_from = Absence, values_from = avg_discrim) |>mutate(`Strategic minus non-strategic`= Strategic -`Non-strategic`) |>pivot_longer(-Iteration, names_to ="Absences") |>group_by(Absences) |>summarise(`Posterior Median`=median(value),`Low Posterior Interval`=quantile(value, 0.05),`High Posterior Interval`=quantile(value, 0.95)) |>tt(digits =2)
Absences
Posterior Median
Low Posterior Interval
High Posterior Interval
Non-strategic
0.208
0.189
0.23
Strategic
0.224
0.2048
0.244
Strategic minus non-strategic
0.016
-0.0071
0.037
The results of this analysis show that those votes coded as “strategic” do show more missingness discrimination though the UI of the average difference includes 0: [-0.0065, 0.038]. Essentially, this result means that strategic absences do show more ideological censoring in the sense that absence patterns tended to cluster in ideologically-similar countries on those days. In it is important to note the data used in this vignette are from a single UNGA session, so the difference could be more precise with the full data. In any case, this result does provide at least some validation both for Morse and Coggins (2024) and for idealstan’s method of accounting for strategic missingness.
References
Bailey, Michael A., Anton Strezhnev, and Erik Voeten. 2017. “Estimating Dynamic State Preferences from United Nations Voting Data.”Journal of Conflict Resolution 61 (2): 430–56. https://doi.org/10.1177/0022002715595700.
Boche, Adam, Jeffrey B. Lewis, Aaron Rudkin, and Luke Sonnet. 2018. “The New Voteview.com: Preserving and Continuing Keith Poole’s Infrastructure for Scholars, Students and Observers of Congress.”Public Choice 176 (1–2): 17–32. https://doi.org/10.1007/s11127-018-0546-0.
Kubinec, Robert. 2019. Generalized Ideal Point Models for Robust Measurement with Dirty Data in the Social Sciences. OSF Preprints. https://doi.org/10.31219/osf.io/8j2bt.
Morse, Julia C., and Bridget Coggins. 2024. “Your Silence Speaks Volumes: Weak States and Strategic Absence in the UN General Assembly.”The Review of International Organizations 19 (3): 515–44. https://doi.org/10.1007/s11558-024-09538-3.
Panke, Diana. 2014. “Absenteeism in the General Assembly of the United Nations: Why Some Member States Rarely Vote.”International Politics 51 (6): 729–49. https://doi.org/10.1057/ip.2014.34.
Poole, Keith T., and Howard Rosenthal. 1985. “A Spatial Model for Legislative Roll Call Analysis.”American Journal of Political Science 29 (2): 357–84. https://doi.org/10.2307/2111172.
Poole, Keith T., and Howard Rosenthal. 1997. Congress: A Political-Economic History of Roll Call Voting. Oxford University Press.
Rosas, Guillermo, Yael Shomer, and Stephen R. Haptonstahl. 2015. “No News Is News: Nonignorable Nonresponse in Roll-Call Data Analysis.”American Journal of Political Science 59 (2): 511–28. https://doi.org/10.1111/ajps.12148.
Voeten, Erik. 2013. “Data and Analyses of Voting in the United Nations General Assembly.” In Routledge Handbook of International Organization, edited by Bob Reinalda. Routledge. https://doi.org/10.4324/9780203405345-14.