dynIRT {emIRT} | R Documentation |
Dynamic IRT estimation via Variational Inference
Description
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.
Usage
dynIRT(.data, .starts = NULL, .priors = NULL, .control = NULL)
Arguments
.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:
|
Value
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. |
Author(s)
Kosuke Imai imai@harvard.edu
James Lo lojames@usc.edu
Jonathan Olmsted jpolmsted@gmail.com
References
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, 1953-1999.” Political Analysis 10(2) 134-153.
Variational model is described in Kosuke Imai, James Lo, and Jonathan Olmsted (2016). “Fast Estimation of Ideal Points with Massive Data.” American Political Science Review, Vol. 110, No. 4 (December), pp. 631-656.
See Also
'mq_data'.
Examples
### Replication of Martin-Quinn 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 = 1e-6,
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 MCMC-estimated 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"])