# poisIRT: Poisson IRT estimation via EM In kosukeimai/emIRT: EM Algorithms for Estimating Item Response Theory Models

## Description

poisIRT estimates an IRT model with count (usually word counts) in cells. Estimation is conducted using the EM algorithm described in the reference paper below. The algorithm generalizes a model by Slapin and Proksch (2009) that is commonly applied to manifesto data.

## Usage

 1 2 poisIRT(.rc, i = 0:(nrow(.rc)-1), NI = nrow(.rc), .starts = NULL, .priors = NULL, .control = NULL)

## Arguments

 .rc matrix, usually with unique words along the J rows and different documents across K columns. Each cell will contain a count of words. There should be no NA values, so documents missing a particular word should list 0 in the cell. i vector of length K, indicating for each of the K documents which actor it belongs to. Assignment of actors begins at actor 0. If set to 0:(K-1), and NI=K below, then each document is assigned its own ideal point, and we get the Slapin and Proksch Wordfish model. NI integer, number of unique actors. Must be less than or equal to K. If NI=K, then each document is assigned its own ideal point, and we get the Slapin and Proksch Wordfish model. .starts a list containing several matrices of starting values for the parameters. The list should contain the following matrices: alpha A (J x 1) matrix of starting values for the word frequency parameter alpha. psi A (K x 1) matrix of starting values for the document verbosity parameter psi. beta A (J x 1) matrix of starting values for the word discrimination parameter β. x An (NI x 1) matrix of starting values for the actor ideal points x_i. .priors list, containing several matrices of starting values for the parameters. The list should contain the following matrices: x\$mu numeric, prior mean for actor ideal points x_i. x\$sigma2 numeric, prior variance for actor ideal points x_i. beta\$mu numeric, prior mean for β_j. beta\$sigma2 numeric, prior variance for β_j. alpha\$mu numeric, prior mean for α_j. alpha\$sigma2 numeric, prior variance for α_j psi\$mu numeric, prior mean for ψ_k. psi\$sigma2 numeric, prior variance for ψ_k. .control list, specifying some control functions for estimation. Options include the following: threads integer, indicating number of cores to use. Default is to use a single core, but more can be supported if more speed is desired. verbose boolean, indicating whether output during estimation should be verbose or not. Set FALSE by default. thresh numeric. Algorithm will run until all parameters correlate at 1 - thresh across consecutive iterations. Set at 1e-6 by default. maxit integer. Sets the maximum number of iterations the algorithm can run. Set at 500 by default. checkfreq integer. Sets frequency of verbose output by number of iterations. Set at 50 by default.

## Value

An object of class poisIRT.

 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. alpha A (J x 1) matrix of point estimates for the word frequency parameter alpha. psi A (K x 1) matrix of point estimates for the document verbosity parameter psi. beta A (J x 1) matrix of point estimates for the word discrimination parameter β. x An (NI x 1) matrix of point estimates for the actor ideal points x_i. 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: beta A (J x 1) matrix of variational variance estimates for the word discrimination parameter β. x An (NI x 1) matrix of variational variance estimates for the actor ideal points x_i. 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 sizes, with elements listed as follow: K Number of unique words in term-document matrix. J Number of documents in term-document matrix. I Number of actors in model, always less than or equal to J. call Function call used to generate output. i_of_k A copy of input for argument ‘i’, which allows the J documents to be linked to I actors.

## Author(s)

Kosuke Imai [email protected]

James Lo [email protected]

Jonathan Olmsted [email protected]

## 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.