Learn R Programming

emIRT (version 0.0.5)

hierIRT: 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
matrix of numeric values containing the data to be scaled. Respondents are assumed to be on rows, and items assumed to be on columns, so the matrix is assumed to be of dimension (N x J). For each item, only 3 ordered category responses are acc

Value

  • An object of class hierIRT.
  • meanslist, containing several matrices of point estimates for the parameters corresponding to the inputs for the priors. The list should contain the following matrices.
    • alpha
    { A (J x 1) matrix of point estimates for the item difficulty parameter $\alpha_j$. } beta{ A (J x 1) matrix of point estimates for the item discrimination parameter $\beta_j$. } gamma{ An (I x D) matrix of point estimates for the group level coefficients $\gamma_{m}$. } eta{ An (I x 1) matrix of point estimates for the ideal point error term $\eta_n$.} sigma{ An (G x 1) matrix of point estimates for the group level variance parameter $\sigma^2_m$. } x_implied{ An (I x 1) matrix of the implied ideal point $x_i$, calculated as a function of gamma, z, and eta using the point estimates for those parameters. }

item

  • .starts
  • beta
  • gamma
  • eta
  • sigma
  • .priors
  • gamma.sigma
  • beta.mu
  • beta.sigma
  • sigma.v
  • sigma.s
  • .control
  • verbose
  • thresh
  • maxit
  • checkfreq
  • vars
  • gamma
  • beta2
  • runtime
  • conv
  • threads
  • tolerance
  • N
  • G
  • I
  • J
  • L
  • call

itemize

  • D

eqn

$\beta_j$

References

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.

See Also

'dwnom'.

Examples

Run this code
### Real data example of US Senate 80-110 (not run)
### Based on voteview.com example of DW-NOMINATE (ftp://voteview.com/dw-nominate.htm)
### We estimate a hierarchical model without noise and a linear time covariate
### This model corresponds very closely to the DW-NOMINATE model

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)

Run the code above in your browser using DataLab