poisIRT {emIRT}R Documentation

Poisson IRT estimation via EM

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

    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 \beta.

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 \beta_j.

beta$sigma2

numeric, prior variance for \beta_j.

alpha$mu

numeric, prior mean for \alpha_j.

alpha$sigma2

numeric, prior variance for \alpha_j

psi$mu

numeric, prior mean for \psi_k.

psi$sigma2

numeric, prior variance for \psi_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 \beta.

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 \beta.

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 imai@harvard.edu

James Lo jameslo@princeton.edu

Jonathan Olmsted jpolmsted@gmail.com

References

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

'manifesto'

Examples


## Not run: 
## Load German Manifesto data
data(manifesto)

## Estimate variational Wordfish model
lout <- poisIRT(.rc = manifesto$data.manif,
		    i = 0:(ncol(manifesto$data.manif)-1),
		    NI=ncol(manifesto$data.manif),
                    .starts = manifesto$starts.manif,
                    .priors = manifesto$priors.manif,
                    .control = {list(
                        threads = 1,
                        verbose = TRUE,
                        thresh = 1e-6,
						maxit=1000
                        )})

## Positional Estimates for Parties
lout$means$x  

## End(Not run)


[Package emIRT version 0.0.14 Index]