Вы находитесь на странице: 1из 27

MCMCirtHier1d:An Implementation of Subject-Specic Hierarchical Parameters to Improve Inference and Identication of Bayesian Item-Response Ideal Point Models

Michael Malecki January ,

Introduction

Bayesian item-response models, which estimate individuals preferences from some observed outcome, are now quite common in political science. ey share desirable properties with established

scaling techniques, while overcoming some pesky assumptions required to estimate the latter. Because all parameters are treated as random variables rather than xed quantities in the Bayesian context, their uncertainty (sometimes interesting in its own right) is modeled explicitly. With widely available free and well documented so ware performing the sampling, more and more researchers are able to focus on acquiring and coding data of various agents revealed preferences. In this paper I describe the implementation of an important extension to the standard twoparameter item-response model (there are three: a, b, and ). Moreover, I implement the sampling algorithm in a widely used estimation package, Martin and Quinns MCMCpack for R, so that researchers can take immediate advantage of a fast, stable sampler using tools with which they are already familiar. I describe model and the sampling algorithm in section , and discuss advantages over other implementations in section . I provide two illustrations in section . I conclude and enumerate
Source code for the model presented here is available from the authors web site, malecki.wustl.edu.

several extensions not yet implemented in section .

Item Response Models in Political Science

Item-response theory (IRT) models, which originated in the context of educational testing, have been adopted by political scientists as their own. Many users of the will be familiar with its example, which codes an IRT model in that language (as well as a lengthy aside on a datacompression technique for response matrices). In some ways the current situation for Bayesian ideal-point estimation is a throwback to the advent of the (Poole and Rosenthal, ) vote-matrix-scaling technique. Preferences can be summarized with ease, and these summaries are used on both the right- and le -hand side of other theoretical models (o en with underspecied assumptions and implications). Still, scaling techniques can be used for inference and are, at least, usually faster than Bayesian simulation. Hix, Noury and Roland (), for example, assess the relevance of dimensions beyond the dominant le right division in the European Parliament, and do so convincingly using an enormous data set and - scaling. Simon Jackmans clarion call for Bayesian techniques in Jackman (, ), with roll-call vote analyses in each. e canonical paper usually cited by political scientists is Clinton, Jackman and

Rivers (). Jackman implements IRT estimation in his pscl R package, with convenient interfaces to the most widely used legislative voting data repository, Poole and Rosenthals VoteView on the US Congress. Meanwhile, Martin and Quinn also have contributed heavily to both the technical and the practical side, with their package MCMCpack and important applications and extensions involving the US Supreme Court Martin and Quinn (, , ); Martin, Quinn and Pemstein (). Most crucially, their dynamic model maps preferences over time in the same parameter space, allowing direct, coherent comparisons.
For a discussion of roll-call voting analysis see Poole and Rosenthal (). Poole and Rosenthal developed and several related models, which is coded for Windows in Fortran. Only one of them has more recently been implemented in the R package wnominate.

O en, researchers use Bayesian IRT estimation MCMCpack, more o en than not alongside traditional scaling techniques such as . e widespread acceptance of

and common understanding of its interpretation means that the two are complementary, with the Bayesian method implicitly set up to prove itself against the other. To give two recent examples, Han () compares results from wnominate and MCMCpacks MCMCirtKd for the European Parliament, showing that the Bayesian models discrimination parameter, which allows some votes to be purely stochastic (that is, irrelevant), leads to dierent conclusions about legislative behavior. In particular he nds that overstates the divergence between members of certain national party delegations. He nds that the British Conservative party, usually a notch to the right of all other parties that comprise the European Peoples Party (EPP) party group in the Parliament, are not as distinct as had been thought; he shows that given their voting behavior, their preferences indeed may overlap with those of the German Christian Democrats (CDU/CSU). I consider the same data in section ., but I do not nd the same overlap.

Hierarchical IRT Model


is

In this section I describe a multilevel item-response theory model of MEPs voting behavior.

approach builds on the framework of Clinton, Jackman and Rivers (), with a new implementation in Martin and Quinn ()s MCMCpack using the powerful Scythe statistical library (Martin, Quinn and Pemstein, ). I follow advice from Bafumi et al. () regarding convergence and identication strategies. e extension of the basic IRT model to a multi-level or hierarchical setup has been alluded to and indeed tested previously in the literature. Indeed it is discussed in the seminal papers, but it is not implemented in any of the widely used samplers. Bafumi et al. () describe the hierarchical case and allude to Win, and Gill and Gelman and Hall provide code to t such models. Still, -language samplers are generally slow, subject to tempermental compilation issues, and despite recent advances, they interface poorly with other commonly used research tools, requiring

tedious data manipulation for simple importation of data that could be handled directly.

e Basic Model

Item-response models in political science typically deal with a vector of votes y b Y taken by legislators j b J on bills k b K, which operationalizes the Euclidean spatial voting model z j,k U j,k yea  U j,k nay.

()

is theoretical model implies the following statistical model where we replace y with a continuous random variable z with the following assumptions:

yj,k

if

z j,k e

if z j,k f .
iid

()

z j,k ak j  bk  jk , j,k N , .

()

Equation () is a standard IRT model with bill diculty b and discrimination a, and legislator ideal point (ability in educational testing). e basic model, however, is not identied a

problem for interpretation but not for estimation. Given only the data, the model can locate the indierence hyperplane Jackman (, ) (the point at which legislators are indierent between proposals), but this plane could be reversed (ipped le -to-right) and has indeterminate scale. I specify a normalized one-dimensional model by adjusting all parameters relative to and specify a prior distribution for that determines the models le -right orientation.
All and R packages require that data matrices (not standard data.frames) be written to disk, while R itself has changed the format of dumped data, becoming more compatible with than with . ough the language is straightforward and shares some syntactic features with R users still must write models and priors down separately.

Bonus Level

Typically, IRT (and other techniques such as ) require that at least one subject be either xed at a point (most liberal, most conservative) or constrained to positive or negative values. at

is, normally all are sampled from the same N , distribution, except for some, which are xed

at a point or constrained to be positive or negative. Such a strategy incorporates a small amount of prior knowledge, enough to identify the model, but we could simultaneously t the data more closely while making weaker assumptions. and common standard deviation: j N j,
j N Xj ,

us, we assume that ideal points jhave a person-specic mean

() ()

N , , IG ~, ~.

()

where X is a vector of person-level covariates. Now, every ideal point is eectively constrained to an interval subset of , and tells us the eect of each person-level attribute. e hierarchical model

more closely resembles the typical constrained IRT model when we x values , and as few as

one j to have X j , . Even then these are weaker assumptions than the stong constraining identication strategy, which actually xes for some j. Intuition and interpretation of the model is straightforward and powerful: Ideal points are estimated using both person-level predictors and a vector of vote choices.
Variance decreases as the eect of Xj explains vote choices. Put simply, to the extent that

explains vote choices, the lower the uncertainty for . Bill discrimination and diculty a, b depend on both votes and ideal points. e model reduces to a standard unidentied ideal-point model as X

(that is, all ideal

points would be draws from the same normal distribution with mean ).

Predictions about ideal points (and voting behavior) can be made given only the elements of x. In other words, given absolutely no voting history, the ideal point of a new legislator can be estimated, with appropriate uncertainty, knowing only those attributes that make up x. Predictions of voting behavior could be made by specifying only the discrimination and diculty of any number of bills.

MCMC Algorithm

e full conditional distribution of each parameter is available in the one-dimensional case, so we can use a Gibbs sampling algorithm in which parameters are updated sequentially conditioned on every other parameters value. We adapt the estimation procedure for unidimensional IRT in MCMCpack (MCMCirt1d) to the hierarchical case (MCMCirtHier1d): rewrite the update so it includes second-level parameters and , and add a draw of those parameters to the implementation. . Sample Z, augmenting dichotomous vote choices Y. . Sample ideal points . Where o en the model is identied in this stage by constraining one or more js to be positive or negative (or to particular values) where, for example, certain j are drawn from normal distributions truncated above or below at zero the hierarchical setting obviates these constraints. In particular we draw each j from its posterior distribution dened as follows: j N j,
X j  ak z j,k  bk k

()

Q
K

() ()

 a a  

e so ware is available at malecki.wustl.edu, and is based on legacy version .- of MCMCpack using only the Mersenne Twister random-number generator (RNG), while newer MCMCpack uses C++ templates to provide support for arbitrary RNGs including parallel LEcuyer streams, which could dramatically improve sampler speed.

It is obvious from equation () that j depends on both the person-level predictors x and the information from outcomes Y through augmented Z, and that it incorporates the uncertainty at each level. . Sample bill parameters a, b together. eter update:
N

is is a standard bivariate normal IRT item param-

p a, bY, Z,

a b

, ab

()

a b

ab zk  B b

()

ab  B 

()

. Sample .
. Sample .

is is the typical Normal regression update of on X conditioned on . is too is the typical Normal regression update, where is drawn from an In-

verse Gamma distribution conditional on outcome , covariates X, and coecients .

..

Implementation Details

I t the model in compiled C++ code that makes use of Martin and Quinns Scythe statistical library. Scythe provides, among other things, a Matrix class with methods that operate as mathematical statisticians would expect. It is always faster than interpreted R code. And as I explain later, storage of samples is enhanced because of C database APIs. e actual sampler is very straightforward. e steps described in section . are simple function calls in an MCMC loop:
// MCMC sampling occurs in this loop for (int iter=0; iter < tot_iter; ++iter) { // sample latent utilities (Z) irt_Z_update1(Z, X, theta, eta, stream); // sample ability (ideal points j) (theta)

hirt_theta_update1(theta, Z, eta, beta, Xj, sigma2, stream); // sample item (case, bill k) parameters (eta) // SAME as non-hier version because eta use Xbeta only through theta irt_eta_update1(eta, Z, theta, ab0, AB0, stream); // sample level2 coefficients (beta) // using standard regression update XpY = t(Xj) * theta; beta = NormNormregress_beta_draw(XpX, XpY, b0, B0, sigma2, stream); // update level2 sigma2 sigma2 = NormIGregress_sigma2_draw (Xj, theta, beta, *c0, *d0, stream); [...] }

e update of is conditioned on the augmented data, the previous iterations bill parameters , and X . So, just as I show the update above mathematically, here is the C++ implementation of equations ():
// update ability parameters (ideal points) for one dimensional // hierarchical item response model void hirt_theta_update1 (Matrix<double>& theta, const Matrix<double> & Z, const Matrix<double>& eta, const Matrix<double>& beta, const Matrix<double>& Xj, const double& sigma2, rng *stream) { const const const const int J = Z.rows(); int K = Z.cols(); Matrix<double> b = eta(_, 0); Matrix<double> a = eta(_, 1);

// calculate the posterior variance outside the J-specific loop Matrix<double> apa = crossprod(a); const double sig2_inv = 1.0 / sigma2; Matrix<double> sig_theta = invpd(apa + sig2_inv); // sample for each J for (int j=0; j<J; ++j) { double thetahat_j = 0.0 ; // get XBeta Matrix<double> Xbeta = Xj(j,_) * beta; for (int k=0; k<K; ++k) { // loop over bills k thetahat_j += a[k] * (- Z(j,k) + b[k]); } thetahat_j += Xbeta[0] / sigma2; thetahat_j = thetahat_j * sig_theta[0]; theta[j] = stream->rnorm( thetahat_j , sig_theta[0] );

} }

Further Renements
Normalization

Finally, we follow the advice of Bafumi et al. () and reduce autocorrelation of samples by adjusting diculty, discrimination, and ideal points, for each iteration g:
ad j ideal point j g j g  ~s ,

() () ()

discrimination ak g ak g s
ad j ad j diculty bk g bk g  ~s

is transformation, performed a er the MCMC run is complete, identies the model Typically, IRT (and other techniques such as ) require that at least one subject be either xed at a point (most liberal, most conservative) or constrained. In the Bayesian IRT framework, estimation could proceed anyway without these identifying assumptions; however, note that the ipping (multiplying every term by ) is solved in the hierarchical case because in eect every j is constrained through each subjects X vector and the previous iterations vector of .

MCMC Sample Storage

Storage of sampler draws is a major concern. My implementation in MCMCirtHier1d of database storage elegantly solves two problems and opens the possibility of greater use of parallel computation. First, to the extent computers or their conditions are subject to nature electrical outages (or, in the case of Microso Windows, catastrophic operating system crashes) chains stored in volatile memory are highly undesirable. Samplers could resume from where they le o if samples were
Without these adjustments, it could either shi or stretch additive and multiplicative aliasing, respectively.

written to nonvolatile storage. Second, memory is limited while for all practical purposes hard disk storage is innite. However, disks are slow (several orders of magnitude slower than memory) and require valuable processor time to access. Although other samplers, most notably Jackmans ideal sampler in pscl, write to disk, they do so for every stored sample, which may result in a bottleneck if the sampler is faster than the system bus. A more elegant solution is to hold batches of samples in memory and commit them in batches to disk. Fortunately, this problem has been solved by database engines, which balance speed, data integrity, and memory limitations. We can use SQL transactions to hold batches of samples in memory and commit them at a given rate; most transactional models also allow the database engine to force a commit when memory is exhausted. Even one-dimensional IRT models sample many thousands of parameters: the augmented outcome variable, discrimination and diculty for each item (bill/case), and the ideal point of each subject. Over hundreds of thousands of iterations, several gigabytes of system memory may be consumed (not to mention the carefree memory management of R itself, which may be storing several copies of the same data besides that used by the model-tting function). Multidimensional IRT models (a stylization of Bayesian ordered factor-analytic models) store loadings for each bill and ideal points for each subject on every dimension. Martin and Quinn advise in MCMCpack documentation, In applications with many items this takes an enormous amount of memory. If you have many items and want to want to store the item parameters you may want to thin the chain heavily. By default, the item parameters are not stored. is, given modern technology, is a travesty the item parameters are crucial for assessing dimensionality. Running the chain twice, once for subjects and once for bills, is an easy but thoroughly inelegant workaround.

..

Storage Implementation Details

e current implementation should be considered a proof of concept of the use of SQL-compliant databases to store MCMC draws. Tighter integration with the database-independent interface RS-DBI will be adopted in the future. For now, samples are stored in the lightweight open-source SQLite embedded database. SQLite solves the problem of size and stability, but is not scalable. Parallel access is impossible because, according to its documentation, A lock means that the process is planning on writing to the database le at some point in the future. Although users may still connect to the database to retrieve samples, thus may monitor convergence while the sampler is running itself another advantage of database storage over memory. Other database engines, such as MySQL, Postgres, Oracle, or Micros s SQL Server, are designed for concurrency and are well suited for parallel computation. Moreover, in any of those contexts the storage can be handled by a dedicated machine. I sketch how database-independent storage will work in section . For now, I describe the SQLite implementation. Before the compiled model-tting code is called, R connects to or creates a database and creates tables with the appropriate number of columns: jsubject parameters in a table called theta, k item parameters in tables a and b, and s  subject-level parameters plus common variance in table beta. e table-creation function returns for each table an statement with the correct

number of placeholders (generally a question mark). Here is the SQL for the theta table from the Supreme Court example in section .:
CREATE TABLE theta (theta_Rehnquist REAL, theta_Stevens REAL, theta_O_Connor REAL, theta_Scalia REAL, theta_Kennedy REAL, theta_Souter REAL, theta_Thomas REAL, theta_Ginsburg REAL, theta_Breyer REAL ); INSERT INTO theta VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? );

e model tting function connects to the same database directly using database engines C API which returns a database handle. e R-generated statements are prepared (compiled)

Database-specic helper functions ensure that column names are legal and denitions use the appropriate data type, typical double but as we see SQLite uses real. A matrix object for subject covariates is coerced to a data.frame for the creation of column names.

against this database handle. Before the MCMC run begins, the sampler calls on the database. To reduce autocorrelation, it is still useful to thin the chain, so every thin samples, values are bound to each prepared statement (placeholders lled) and the statements are executed. Finally, at some greater interval (say, thin), the transaction is committed and a new one begun. Examples of the relevant code that inserts ideal points are given below.
sqlite3_open(dbname[0], &dbh); sqlite3_stmt *insert_theta; sqlite3_prepare(dbh, insert_stmt[0], -1, &insert_theta, 0 ); [...] if ((iter >= burnin[0]) && ((iter % thin[0]==0))) { // store ideal points for (int l=0; l<J; ++l) { sqlite3_bind_double(insert_theta, l+1, theta[l]); } sqlite3_step(insert_theta); } [...] // reset the insert statements for next use sqlite3_reset(insert_beta); sqlite3_reset(insert_a); sqlite3_reset(insert_b); sqlite3_reset(insert_theta); if ( (iter % (thin[0] * 100) ==0) ){ Rprintf("Committing samples.\n"); sqlite3_exec(dbh, "COMMIT;",0,0,0); sqlite3_exec(dbh, "BEGIN TRANSACTION;",0,0,0); }

// // // //

db handle sql stmt created in R auto max length statement handle

As I have noted above, convergence can be assessed as the model is still tting the database can be read (perhaps by another machine) while the sampler is still running. e standard RS-DBI-

compliant interfaces provide the method dbReadTable() which returns the entire contents of a table as a data.frame, which one can easily analyze as-is or coerce to a coda mcmc object.

Applications

I provide two examples: a trivial analogue to the US Supreme Court example given in the MCMCpack documentation for MCMCirt1d, where subject covariates may be of theoretical interest, but mainly serve to identify the model and obviate constraints on ; and a more involved example where inference about subject-specic characteristics are of primary interest.

Ideal Points of US Supreme Court Justices, Term

I begin with the example from Martin and Quinns MCMCirt1d: ideal points for the justices of the US Supreme Court, in the term. e data comprise nine justices each voting on cases. We

construct two covariates for each justice that we believe may relate to their ideal points, each binary: sex and the party of the president who appointed them. Sex is coded for females, and presidents party for Republicans:
data(SupremeCourt) presparty <- c(1,1,0,1,1,1,1,0,0) # 1=Republican sex <- c(0,0,1,0,0,0,0,1,0) # 1=female Xjdata <- data.frame(presparty=presparty,sex=sex)

We start the chain with values opposite of expectations, . for party and . for sex. is run for , iterations a er a burnin of ,, and every th value is stored.

e sampler

A er less than a minute, we have draws stored in our database contained in the le Hierd.db. Samples are easily retrieved:
dbh <- dbConnect("SQLite","Hier1d.db") beta <- dbReadTable(dbh,"beta") theta <- dbReadTable(dbh,"theta") a <- dbReadTable(dbh,"a") b <- dbReadTable(dbh,"b") dbDisconnect(dbh)

Trace plots and kernel-smoothed posterior densities are shown for in Figure . In Figure I compare the estimates of from the hierarchical model with the standard IRT model, where two

Figure . Trace and posterior density for second-level (justice-specic) covariates in the Supreme Court example.

Trace of presparty
6 0.4

Density of presparty

5000

10000

15000 Iterations

20000

25000

0.0 2

0.2

N = 1000 Bandwidth = 0.2502

Trace of sex
0.30 4

Density of sex

5000

10000

15000 Iterations

20000

25000

0.00 6

0.15

N = 1000 Bandwidth = 0.3149

Trace of sigmasq
0.00 0.06 0.12 80

Density of sigmasq

0 5000

40

10000

15000 Iterations

20000

25000

20

40

60

80

100

N = 1000 Bandwidth = 0.9801

ideal points are constrained for identication. Following the example in MCMCirt1d we constrain Scalia to be positive (right/conservative) and Ginsburg to be negative (le /liberal). e advantages of the hierarchical model are immediately apparent, with more precise estimates on all ideal points. Moreover, we have identied the model by having sensible interpretations of covariates the positive coecient on appointing presidents party, with indicating Republican presidents, is enough to ensure that conservative justices are on the right.

Figure . Ideal point estimates and credible intervals for justices of the supreme court in , estimated using a hierarchical model and the standard one-dimensional IRT model.

Hierarchical
Thomas Stevens Souter Scalia Rehnquist O'Connor Kennedy Ginsburg Breyer 2
q q q q q q q q q q q q q

Standard
q

Justice

q q q q

Party and Preference in the European Parliament

is example is taken from a working paper, From Preferences to Behavior: Modeling MEPs RollCall Voting Behavior (Gabel, Hix and Malecki, ). I include it to show the kind of parameters that are of substantive theoretical interest that in fact imply the theoretical model described in this paper. We simultaneously t the vote-choice model and make inferences about real covariates: party, nationality, and surveyed preferences on the primary (le right) dimension. We consider voting behavior in the European Parliament (EP). Members of the EP (MEPs) are directly elected every ve years, by proportional ballot, in every member state. However, they run for oce as members of national-level parties. Once in the legislature, parties are procedurally encouraged to form European party groups. Committee assignments, for example, are allotted by party group; unattached or non-inscrit members are considerably disadvantaged. e problem with both traditional scaling techniques and non-hierarchical IRT models is that votes induced by parties and votes of sincere preference are observationally equivalent. is has led

to a lively debate with regard to the US Congress, which Smith () neatly summarizes. Only one study we know of attempts to use an exogenous measure of preference (Ansolabehere, Snyder Jr. and Stewart III, ). e data comprise roll-call votes on legislative procedures (codecision, co peration, consultao tion, and assent) in the h European Parliament (). We exclude non-legislative procedures most importantly Resolutions from the analysis. It is on legislative procedures that we would expect party groups to use whatever power they had over members. Of the votes, are on legislative procedures. Crucially, this means that party groups have no inuence over the agenda here. Because the Commission proposes legislation, this move handily eliminates another endogenous mechanism of party inuence. Next, we narrow our focus to those MEPs for whom we could construct a factor score of their rst dimension (le right) preferences from the survey, for a total of MEPs. Factor scores ranged from . to .. e distribution of the MEPs by member state and party group is shown in table .

Table . Number of MEPs in the sample by party group and member state. Anti AT BE DE ES FR GR IT DK LU NL FI PT EI SE UK Total EPP UEN LDR Com NI PES Green Total

..

Ideal Points and Preferences

Recall that the estimate of is draw from a Normal distribution where the mean is a function of person-level predictors X j, coecients j, the data yj,k , and estimated bill parameters ak , bk . Figure plots the ideal points against the survey preferences, with colors indicating party group. e range of preferences within each party group (along the abscissa) is much wider than that of voting behavior (the ordinate). A solid black line shows the simple regression of voting behavior on preference. Colored dotted lines indicate the party group median on each axis.

..

Party Eects

Turning now to the second-level parameters of the model, how much of vote choice depends not on MEPs preferences but on their party group? Parties do more to divide MEPs on votes than do preferences. But, preferences matter. Given a party (and member state) intercept, the coecient of the survey preference score is .. is term accounts for the gentle upward slope of each partys

cloud of points those on the partys right edge in preference tend to be toward the right (up) in

Figure . Ideal points and surveyed LR preference of MEPs in EP. Preferences, along the x axis, overlap considerably between parties, but revealed preference (voting behavior) hardly overlaps.

Preferences and Voting Behavior


Communists Greens Socialists LibDems EPP/U=UK

UU U U U U U U U U U U U

IRT estimate

q q q q qq qq q q q q

q q q q q q q q

q q q q q q q q q q q q q q q q q q q

q q

q q q q q q q q q

qq

Uq

q q q qq q qq q q q q q q qq q q q

q qq q q qq q q q q qq q q qq q q q q qq q q q q q q qq q q q q q q qq q q q q q q q q q q q qq q q q q q q q

q q

q q qq q qqq q q qq q

q q q q q q q q

q q q q

q q

Survey Preference Factor 1 Score Dashed lines are party medians on each dimension
voting as well. e means and distributions of party terms are shown in Figure . and preferences are shown in Figure . e relative eects of party

e mean of these parameters gives the mean party eect

Most of the eect may be driven by the British Conservative party, a group distinct from the EPP on both dimensions. We leave a more rigorous investigation of national parties for future research, but note that even without interaction, UK stands apart to the right of other member-state terms see Figure

Figure . Distributions of party component of ideal points. Because the mean of ideal points is additive, these represent the independent eect of being a member of a given party, irrespective of other .

Directly Estimated Party Effects


0.8 0.0 3 0.4

Density

for EP Party Group

(independent of preferences), showing, for example, that preference divides the PES from the LDR group more than party discipline: their party eects are nearly indistinguishable. Comparing the largest party groups, the PES and EPP, party divides more than preference: the lowest absolute value credible value for either party eect is greater than the highest for preference. Finally, consider the spread of these distributions. Compared to preferences, the party eects are quite dispersed. Moreover, the widths of credible intervals for party eects are very close to those for member states. Interpretation of this quantity is dicult, and certainly warrants a closer look. For now, two observations: rst, party is no more precise a predictor of vote choices than is member state. Even with fewer observations in each member state, the precision of these estimates is as diuse as that of parties. Second, the spread is more important than whether the estimates contain zero with high probability. Two parties, the LDP and the UEN, constrain their members to a similar degree as other parties, but their eect in the model is to constrain their members at or near the center of the distribution.

Figure . Preference has a distinct eect, with a very narrow distribution. Parties as a predictor, on the other hand, vary in their strength.

Density

Communists Greens Socialists LibDems EPP Survey Preference

0 3

for EP Party Group and Surveyed Preference

..

Results compared to EUSA paper

We have previously shown that some cohesion in vote-behavior scaling ( including resolutions) varies systematically with party group size. Using party dummies in a regression on scores yields very similar results to the hierarchical IRT model (Figure in this case, but we can easily posit a situation in which it did not; regression on (or on IRT s, as in Han ()) where we care about party eects on vote choices is a clear example of the ecological fallacy. It can tell us nothing about how parties or preferences aect any component yea or nay. By contrast, the model presented here oers a direct interpretation as a two-level model of vote choice, which incorporates uncertainty over all parameters (bill positions, MEP ideal points, and second-level predictors of ideal points). e regression-on- strategy takes ideal points as

xed, thus ignoring the (im)precision of its estimates. Here, we estimate party eects directly, and can interpret the central tendency of party eects as something like cohesion. We thus ask: how narrowly does party group constrain the estimate of ? e width of credible intervals is shown sorted in the right panel of Figure , and compared to

Figure . Comparison of party eects on nominate scores (le ) and direct estimation (right).

Gabel and Hix


EPP Pref UEN LDR PES Comm Green
q q q q q q q

GabelMalecki IRT
EPP
q q q q q q q

Party Group

UEN Pref LDR PES Com Green

0.80.60.40.2 0.0 0.2 0.4

1.0 0.5 0.0

0.5

1.0

Regression on Nominate

mean post. dens.

that for preference. Finally, Figure shows the lengths of these intervals for all non-preference s (party group and member state).

Figure . Means and credible intervals for all coecients for all party groups and member states. are inuenced, obviously, by the number of observations of each, but also by the power of each item.

ese estimates

pref Member_StateUK Member_StateSE Member_StatePT Member_StateNL Member_StateLU Member_StateEI Member_StateIT Member_StateGR Member_StateFI Member_StateFR Member_StateES Member_StateDK Member_StateDE Member_StateBE Member_StateAT EP_GroupGreen EP_GroupPES EP_GroupNI EP_GroupCom EP_GroupLDR EP_GroupUEN EP_GroupEPP EP_GroupAnti

q q q q q q q q q q q q q q q q q q q q q q q q

Member_StateAT Member_StatePT EP_GroupUEN EP_GroupNI Member_StateIT EP_GroupAnti Member_StateBE Member_StateFR Member_StateGR Member_StateLU Member_StateSE EP_GroupGreen EP_GroupCom Member_StateNL Member_StateEI Member_StateDK EP_GroupLDR Member_StateFI Member_StateDE Member_StateUK Member_StateES EP_GroupEPP EP_GroupPES

q q q q q q q q q q q q q q q q q q q q q q q

1.0 0.5 0.0

0.5

1.0

0.42

0.44

0.46

0.48

sort(apply(beta[, 1:23], 2, sd))

..

Compared to

Lastly, we compare our one-dimensional IRT estimate with results from -. Hix and Noury produced two-dimensional estimates based on scaling of vote choices on all roll calls (including non-legislative procedures). In Figure , we compare their rst dimension with the single dimension estimated in our IRT model.
Figure . Ideal point estimates from our multilevel IRT compared to rst-dimension scores from Hix and Noury.

U
q q qq q q q q qq q q qq q q q q qqq q q q q qqq q q qq qq q qq q q q q q q q q q q q q q

U U U UU UU U U UU U

0.5

q q

Nominate

qq qq q qq q q q q q q q q

0.0

q q qq q q qq qq q qqqq q qq qqq qq q q q q qq q q q q qq q q q q q q q q q q q q q

0.5

q q q q q q qq q q qq q qq q q q qq q q q q qq

Communists Greens PES LibDemReform EPP/U=UK 0 IRT 1 2

We observe that the results are broadly consistent. Party groups cluster together using both es-

timation techniques, but our multilevel setting allows us to see how tightly. Moreover, we have modeled directly both party and preference in voting decisions. e gure also shows that is less able to distinguish the British members of the EPP by voting behavior alone. By accounting for both member state and party group as well as votes, the IRT model is able to produce more accurate estimates of these MEPs ideal points. By contrast, we note that the Communists and Greens are less distinct in our estimates than under , though we suspect that this feature is a result of the inclusion of non-legislative resolutions in the estimates. Han () estimates a two-dimensional model, and nds that British conservatives are less distinct from their EPP copartisans on the rst (le right) dimension. When we estimate a single dimension, we likely capture some of the correlated second integration dimension, on which we would expect Britains Conservative party to be more distinct.

Future Work
Bayes Factors

In typical models, we are not generally interested in assessing model t, because there is no real alternative choice of model. Here, where we might include dierent sets of subject covariates. How much better does a model including nationality t the EP data than one with only party group? Does a model including national party t better than one of party group and nationality? How much or how little does judge sex improve t to the Supreme Court data? e Bayes Factor for comparing two models requires that we compute the marginal likelihood of each, using the method of Chib (). A future version of this so ware will include samplers for the reduced runs with some parameters xed. Again, once we are certain the model is converged in the target distribution, we could start a parallel run for the marginal likelihood by xing some parameters at their posterior means, easily returned by the database.

Ordered Polytomous Outcome for Multidimensional Outcomes

Fox () describes the Metropolis step for updating the item parameters for polytomous data, or ordered factor analysis. Reduction of conict to a single dimension may not be appropriate, as we have seen for the European Parliament. When all votes are condensed to a single dimension, second (or higher) dimensions, if correlated with the rst, may overstate dierences in preferences on the rst dimension.

Database Independent Storage

e purpose of database independent (DBI) abstraction is to shield users from the implementationspecic details by providing a common set of functions. Developers map a generic call to a specic database API function such as mysql execute or sqlite3 exec, with the appropriate arguments in the appropriate order. I propose a very thin DBI layer that prepares statements, binds values to prepared statements, and excutes them. Call this the MCMCstore layer. Whereas now MCMCpack modules dene the size of return matrices or arrays and manipulate them directly, they should simply call a store() function when appropriate and leave the details to the storage manager. RS-DBI provides a connection manager that looks up the relevant connection object when a request is made. Implementing code, then, takes as an argument the connection managers connection reference (an integer). ence. e connection manager returns a DBI connection object given this refere

e details of the DBI connection can be used to access the external connection object.

RSQLite code to close a connection provide a simple example:


void RS_SQLite_closeConnection(Con_Handle conHandle) { RS_DBI_connection *con; sqlite3 *db_connection; con = RS_DBI_getConnection(conHandle); db_connection = (sqlite3 *) con->drvConnection; sqlite3_close(db_connection); }

A new bundle of storage functions will be dened in storage.h, and will need include congure

options for whether to include rs-dbi.h, rs-mysql.h, and rs-sqlite.h, defaulting to all of the above; but users should be able to compile with only one database if desired. MCMCstore() will have to be templated for each storagetype (database implementation, or memory). e connection will be

opened from R, when tables are created, then the RS-DBI connection id passed to the model-tting c++ code. By using the RS-DBI connection manager, the same connection can be re-used rather than a new one opened (as is currently the case). class MCMCstore. e model-tting code will initialize an object of

e MCMCstore classs store() function will call appropriate db-specic code

as above (sqlite bind double, mysql or other database API commands to insert, insert, execute, reset, etc.).

References
Ansolabehere, Stephen, James M. Snyder Jr., and Charles Stewart III. . e Eects of Party and Preferences on Congressional Roll-Call Voting. Legislative Studies Quarterly :. Bafumi, Joseph, Andrew Gelman, David K. Park, and Noah Kaplan. . Practical Issues in Implementing and Understanding Bayesian Ideal Point Estimation. Political Analysis :. Clinton, Joshua, Simon Jackman, and Douglas Rivers. . Data. American Political Science Review :. e Statistical Analysis of Roll Call

Fox, J.P. . Multilevel IRT Modeling in Practice with the Package mlirt. Journal of Statistical So ware . Gabel, Matthew J., Simon Hix, and Michael Malecki. . From Preferences to Behavior: Modeling MEPs Roll-Call Voting Behavior. Presented at the conference, Measures of Legislators Policy Preferences and the Dimensionality of Policy Spaces at Washington University in St. Louis, November . Han, Jeong-Hun. . Analysing Roll Calls of the European Parliament: A Bayesian Application. European Union Politics :. Hix, Simon, Abdul Noury, and Grard Roland. . Dimensions of Politics in the European e Parliament. AJPS :. Jackman, Simon. . Estimation and Inference via Bayesian Simulation: An Introduction to Markov Chain Monte Carlo. American Journal of Political Science :. Jackman, Simon. . Multidimensional Analysis of Roll Call Data via Bayesian Simulation: Identication, Estimation, Inference, and Model Checking. Political Analysis (June):. Martin, Andrew D., and Kevin M. Quinn. . Dynamic Ideal Point Estimation via Markov Chain Monte Carlo for the U. S. Supreme Court, -. Political Analysis :. Martin, Andrew D., and Kevin M. Quinn. . MCMCpack: Markov chain Monte Carlo (MCMC) Package. R package version .-, URL http://mcmcpack.wustl.edu . Martin, Andrew D., and Kevin M. Quinn. . Assessing Preference Change on the US Supreme Court. Journal of Law, Economics, and Organization :. Martin, Andrew D., Kevin M. Quinn, and Daniel Pemstein. . Scythe Statistical Library ., URL scythe.wustl.edu.. Poole, Keith T., and Howard Rosenthal. . A Spatial Model for Legislative Roll-Call Analysis. AJPS :. Poole, Keith T., and Howard Rosenthal. . A Political-Economic History of Roll-Call Voting. Oxford: Oxford University Press. Smith, Steven S. . Party Inuence in Congress. Cambridge: Cambridge University Press.