Learn R Programming

emIRT (version 0.0.5)

ordIRT: Two-parameter Ordinal IRT estimation via EM

Description

ordIRT estimates an ordinal IRT model with three ordered response categories. Estimation is conducted using the EM algorithm described in the reference paper below. The algorithm will produce point estimates that are comparable to those of MCMCordfactanal, but will do so much more rapidly and also scale better with larger data sets.

Usage

ordIRT(.rc, .starts = NULL, .priors = NULL, .D = 1L, .control = NULL)

Arguments

.rc
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
.starts
a list containing several matrices of starting values for the parameters. Note that the parameters here correspond to the re-parameterized version of the model (i.e. alpha is $alpha^*$, not the original $alpha_{1j}$ The list should contain the foll

Value

  • An object of class ordIRT.
  • meanslist, containing several matrices of point estimates for the parameters corresponding to the inputs for the priors. The list should contain the following matrices.
    • x
    { A (N x 1) matrix of point estimates for the respondent ideal points $x_t$.} beta{ A (J x 1) matrix of point estimates for the reparameterized item discrimination parameter $\beta^*$.} tau{ A (J x 1) matrix of point estimates for the bill cutpoint $\tau_j$.} Delta_sq{ A (J x 1) matrix of point estimates for the squared bill cutpoint difference $\tau_j^2$.} Delta{ A (J x 1) matrix of point estimates for the bill cutpoint difference $\tau_j$.}

item

  • .priors
  • x$sigma
  • beta$mu
  • beta$sigma
  • .D
  • .control
  • verbose
  • thresh
  • maxit
  • checkfreq
  • vars
  • beta
  • tau
  • runtime
  • conv
  • threads
  • tolerance
  • n
  • j
  • call

eqn

$\tau_j$

itemize

  • iters

References

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

'AsahiTodai'.

Examples

Run this code
### Real data example: Asahi-Todai survey (not run)
## Collapses 5-category ordinal survey items into 3 categories for estimation
data(AsahiTodai)
out.varinf <- ordIRT(.rc = AsahiTodai$dat.all, .starts = AsahiTodai$start.values,
					.priors = AsahiTodai$priors, .D = 1,
					.control = {list(verbose = TRUE,
                     thresh = 1e-6, maxit = 500)})

## Compare against MCMC estimates using 3 and 5 categories
cor(ideal3, out.varinf$means$x)
cor(ideal5, out.varinf$means$x)


### Monte Carlo simulation of ordIRT() model vs. known parameters
## Set number of legislators and items
set.seed(2)
NN <- 500
JJ <- 100

## Simulate true parameters from original model
x.true <- runif(NN, -2, 2)
beta.true <- runif(JJ, -1, 1)
tau1 <- runif(JJ, -1.5, -0.5)
tau2 <- runif(JJ, 0.5, 1.5)
ystar <- x.true %o% beta.true + rnorm(NN *JJ)

## These parameters are not needed, but correspond to reparameterized model
#d.true <- tau2 - tau1
#dd.true <- d.true^2
#tau_star <- -tau1/d.true
#beta_star <- beta.true/d.true

## Generate roll call matrix using simulated parameters
newrc <- matrix(0, NN, JJ)
for(j in 1:JJ) newrc[,j] <- cut(ystar[,j], c(-100, tau1[j], tau2[j],100), labels=FALSE)

## Generate starts and priors
cur <- vector(mode = "list")
cur$DD <- matrix(rep(0.5,JJ), ncol=1)
cur$tau <- matrix(rep(-0.5,JJ), ncol=1)
cur$beta <- matrix(runif(JJ,-1,1), ncol=1) 
cur$x <- matrix(runif(NN,-1,1), ncol=1) 
priors <- vector(mode = "list")
priors$x <- list(mu = matrix(0,1,1), sigma = matrix(1,1,1) )
priors$beta <- list(mu = matrix(0,2,1), sigma = matrix(diag(25,2),2,2))

## Call ordIRT() with inputs
time <- system.time({
    lout <- ordIRT(.rc = newrc,
                    .starts = cur,
                    .priors = priors,
                    .control = {list(
                        threads = 1,
                        verbose = TRUE,
                        thresh = 1e-6,
			maxit=300,
			checkfreq=50
                        )})
})

## Examine runtime and correlation of recovered ideal points vs. truth
time
cor(x.true,lout$means$x)

Run the code above in your browser using DataLab