binIRT: Two-parameter Binary IRT estimation via EM

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/binIRT.R

Description

binaryIRT estimates a binary IRT model with two 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 ideal, but will do so much more rapidly and also scale better with larger data sets.

Usage

1
2
  binIRT(.rc, .starts = NULL, .priors = NULL, .D = 1L, .control = NULL,
  .anchor_subject = NULL, .anchor_outcomes = FALSE)

Arguments

.rc

a list object, in which .rc$votes is a 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, ‘1’, and ‘-1’ represent different responses (i.e. yes or no votes) with ‘0’ as a missing data record.

.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 item difficulty parameter alpha.

  • beta A (J x D) matrix of starting values for the item discrimination parameter β.

  • x An (N x D) matrix of starting values for the respondent ideal points x_i.

.priors

list, containing several matrices of starting values for the parameters. The list should contain the following matrices:

  • x$mu A (D x D) prior means matrix for respondent ideal points x_i.

  • x$sigma A (D x D) prior covariance matrix for respondent ideal points x_i.

  • beta$mu A (D+1 x 1) prior means matrix for α_j and β_j.

  • beta$sigma A (D+1 x D+1) prior covariance matrix for α_j and β_j.

.D

integer, indicates number of dimensions to estimate. Only a 1 dimension is currently supported. If a higher dimensional model is requested, binIRT exits with an error.

.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 have a correlation greater than (1 - threshold) 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.

.anchor_subject

integer, the index of the subect to be used in anchoring the orientation/polarity of the underlying latent dimensions. Defaults to NULL and no anchoring is done.

.anchor_outcomes

logical, should an outcomes-based metric be used to anchor the orientation of the underlying space. The outcomes-based anchoring uses a model-free/non-parametric approximation to quantify each item's difficulty and each subject's ability. The post-processing then rotates the model-dependent results to match the model-free polarity. Defaults to FALSE and no anchoring is done.

Value

An object of class binIRT.

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.

  • x A (N x 1) matrix of point estimates for the respondent ideal points x_i.

  • beta A (J x D+1 ) matrix of point estimates for the item parameters α and β.

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:

  • x A (N x 1) matrix of variances for the respondent ideal points x_i.

  • beta A (J x D+1 ) matrix of variances for the item parameters α and β.

runtime

A list of fit results, with elements listed as follows:

n

Number of respondents in estimation, should correspond to number of rows in roll call matrix.

j

Number of items in estimation, should correspond to number of columns in roll call matrix.

d

Number of dimensions in estimation.

call

Function call used to generate output.

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.

See Also

'convertRC', 'makePriors', 'getStarts'.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
## Data from 109th US Senate
data(s109)

## Convert data and make starts/priors for estimation
rc <- convertRC(s109)
p <- makePriors(rc$n, rc$m, 1)
s <- getStarts(rc$n, rc$m, 1)

## Conduct estimates
lout <- binIRT(.rc = rc,
                .starts = s,
                .priors = p,
                .control = {
                    list(threads = 1,
                         verbose = FALSE,
                         thresh = 1e-6
                         )
                }
                )

## Look at first 10 ideal point estimates
lout$means$x[1:10]


lout2 <- binIRT(.rc = rc,
                .starts = s,
                .priors = p,
                .control = {
                    list(threads = 1,
                         verbose = FALSE,
                         thresh = 1e-6
                         )
                },
                .anchor_subject = 2
                )
                                        # Rotates so that Sen. Sessions (R AL)
                                        # has more of the estimated trait

lout3 <- binIRT(.rc = rc,
                .starts = s,
                .priors = p,
                .control = {
                    list(threads = 1,
                         verbose = FALSE,
                         thresh = 1e-6
                         )
                },
                .anchor_subject = 10
                )
                                        # Rotates so that Sen. Boxer (D CA)
                                        # has more of the estimated trait

cor(lout2$means$x[, 1],
    lout3$means$x[, 1]
    )
                                        # = -1 --> same numbers, flipped
                                        # orientation

emIRT documentation built on May 29, 2017, 7:10 p.m.