hierIRT {emIRT} | R Documentation |
Hierarchichal IRT estimation via Variational Inference
Description
hierIRT
estimates an hierarchical IRT model with two response categories, allowing the use of covariates
to help determine ideal point estimates. Estimation is conducted using the variational EM algorithm described
in the reference paper below. A special case of this model occurs when time/session is used as the covariate —
this allows legislator ideal points to vary over time with a parametric time trend. Notably, the popular
DW-NOMINATE model (Poole and Rosenthal, 1997) is one such example, in which legislator ideal points shift
by a constant amount each period, and the error term in the hierarchical model is set to 0. In contrast to
other functions in this package, this model does not assume a ‘rectangular’ roll call matrix, and all data
are stored in vector form.
Usage
hierIRT(.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 hierIRT
.
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 several parameters of interest for diagnostic purposes. 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. 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 |
A list of counts of various items: |
D
integer, number of dimensions (i.e. number of covariates, including intercept).
G
integer, number of groups.
I
integer, number of ideal points.
J
integer, number of items/bill parameters.
L
integer, number of observed votes.
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
Variational model is described in Kosuke Imai, James Lo, and Jonathan Olmsted “Fast Estimation of Ideal Points with Massive Data.” American Political Science Review, Volume 110, Issue 4, November 2016, pp. 631-656. <DOI:10.1017/S000305541600037X>.
See Also
'dwnom'.
Examples
### Real data example of US Senate 80-110 (not run)
### Based on voteview.com example of DW-NOMINATE (\url{https://voteview.com/})
### We estimate a hierarchical model without noise and a linear time covariate
### This model corresponds very closely to the DW-NOMINATE model
## Not run:
data(dwnom)
## This takes about 10 minutes to run on 8 threads
## You may need to reduce threads depending on what your machine can support
lout <- hierIRT(.data = dwnom$data.in,
.starts = dwnom$cur,
.priors = dwnom$priors,
.control = {list(
threads = 8,
verbose = TRUE,
thresh = 1e-4,
maxit=200,
checkfreq=1
)})
## Bind ideal point estimates back to legislator data
final <- cbind(dwnom$legis, idealpt.hier=lout$means$x_implied)
## These are estimates from DW-NOMINATE as given on the Voteview example
## From file "SL80110C21.DAT"
nomres <- dwnom$nomres
## Merge the DW-NOMINATE estimates to model results by legislator ID
## Check correlation between hierIRT() and DW-NOMINATE scores
res <- merge(final, nomres, by=c("senate","id"),all.x=TRUE,all.y=FALSE)
cor(res$idealpt.hier, res$dwnom1d)
## End(Not run)