Description Usage Arguments Value Author(s) References See Also Examples
ordIRT
estimates an dynamic IRT model with two response categories per item, over several
sessions. Ideal points over time follow a random walk prior, and the model originates from the
work of Martin and Quinn (2002). Estimation is conducted using the variational EM algorithm described
in the reference paper below. The algorithm will produce point estimates that are comparable to those
of MCMCdynamicIRT1d
, but will do so much more rapidly and also scale better
with larger data sets.
1 
.data 
a list with the following items.

.starts 
a list containing several matrices of starting values for the parameters. The list should contain the following matrices:

.priors 
list, containing several matrices of starting values for the parameters. The list should contain the following matrices:

.control 
list, specifying some control functions for estimation. Options include the following:

An object of class dynIRT
.
means 
list, containing several matrices of point estimates for the parameters corresponding to the inputs for the priors. The list should contain the following matrices.

vars 
list, containing several matrices of variance estimates for parameters corresponding to the inputs for the priors. Note that these variances are those recovered via variational approximation, and in most cases they are known to be far too small and generally unusable. Better estimates of variances can be obtained manually via the parametric bootstrap. The list should contain the following matrices:

runtime 
A list of fit results, with elements listed as follows: 
iters
integer, number of iterations run.
conv
integer, convergence flag. Will return 1 if threshold reached, and 0 if maximum number of iterations reached.
threads
integer, number of threads used to estimated model.
tolerance
numeric, tolerance threshold for convergence. Identical to thresh argument in input to .control list.
N 
Number of respondents in estimation, should correspond to number of rows in roll call matrix. 
J 
Number of items in estimation, should correspond to number of columns in roll call matrix. 
T 
Number of time periods fed into the estimation, identical to argument input from .data list. 
call 
Function call used to generate output. 
Kosuke Imai [email protected]
James Lo [email protected]
Jonathan Olmsted [email protected]
Original model and the example is based off of Andrew Martin and Kevin Quinn, “Dynamic Ideal Point Estimation via Markov Chain Monte Carlo for the U.S. Supreme Court, 19531999.” Political Analysis 10(2) 134153. Also see http://mqscores.berkeley.edu.
Variational model is described in Kosuke Imai, James Lo, and Jonathan Olmsted “Fast Estimation of Ideal Points with Massive Data.” Working Paper. Available at http://imai.princeton.edu/research/fastideal.html.
'mq_data'.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28  ### Replication of MartinQuinn Judicial Ideology Scores
### Based on July 23, 2014 (2014 Release 01) release of the Supreme Court Database
### Start values and priors based on replication code provided by Kevin Quinn
data(mq_data)
## Estimate dynamic variational model using dynIRT()
lout < dynIRT(.data = mq_data$data.mq,
.starts = mq_data$cur.mq,
.priors = mq_data$priors.mq,
.control = {list(
threads = 1,
verbose = TRUE,
thresh = 1e6,
maxit=500
)})
## Extract estimate from variational model
## Delete point estimates of 0, which are justices missing from that session
vi.out < c(t(lout$means$x))
vi.out[vi.out==0] < NA
vi.out < na.omit(vi.out)
## Compare correlation against MCMCestimated result
## Correlates at r=0.93 overall, and 0.96 when excluding Douglas
cor(vi.out, mq_data$mq_mcmc)
cor(vi.out[mq_data$justiceName != "Douglas"],
mq_data$mq_mcmc[mq_data$justiceName != "Douglas"])

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.