networkIRT: Network IRT estimation via EM

View source: R/networkIRT.R

networkIRTR Documentation

Network IRT estimation via EM

Description

networkIRT estimates an IRT model with network 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

   networkIRT(.y, .starts = NULL, .priors = NULL, .control = NULL,
    .anchor_subject = NULL, .anchor_item = NULL)

Arguments

.y

matrix, with 1 indicating a valid link and 0 otherwise. Followers (usually voters) are on rows, elites are on columns. No NA values are permitted.

.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 politician propensity to be followed alpha.

  • beta A (N x 1) matrix of starting values for follower propensity to follow others β.

  • w An (J x 1) matrix of starting values for politician ideal points z.

  • theta An (N x 1) matrix of starting values for the follower ideal points x.

  • gamma An (1 x 1) matrix, should generally be fixed to be 1.

.priors

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

  • alpha$mu prior mean for α.

  • alpha$sigma prior variance for α

  • beta$mu prior mean for β.

  • beta$sigma prior variance for β.

  • w$mu prior mean for z.

  • w$sigma prior variance for z

  • theta$mu prior mean for x.

  • theta$sigma prior variance for x.

  • gamma$mu Should be fixed to equal 1.

  • gamma$sigma Should be fixed to equal 1.

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

.anchor_subject

integer, specifying subject to use as identification anchor.

.anchor_item

integer, specifying item to use as identification anchor.

Value

An object of class networkIRT.

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 politician propensity to be followed alpha.

  • beta A (N x 1) matrix of point estimates for follower propensity to follow others β.

  • w An (J x 1) matrix of point estimates for politician ideal points z.

  • theta An (N x 1) matrix of point estimates for the follower ideal points x.

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:

  • alpha A (J x 1) matrix of variance estimates for politician propensity to be followed alpha.

  • beta A (N x 1) matrix of variance estimates for follower propensity to follow others β.

  • w An (J x 1) matrix of variance estimates for politician ideal points z.

  • theta An (N x 1) matrix of variance estimates for the follower ideal points x.

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

Number of followers in estimation, should correspond to number of rows in data matrix .y

J

Number of politicians in estimation, should correspond to number of columns in data matrix .y

call

Function call used to generate output.

Author(s)

Kosuke Imai kimai@princeton.edu

James Lo jameslo@princeton.edu

Jonathan Olmsted jpolmsted@gmail.com

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

'ustweet'

Examples


## Not run: 
data(ustweet)

## A ridiculously short run to pass CRAN
## For a real test, set maxit to a more reasonable number to reach convergence
lout <- networkIRT(.y = ustweet$data,
                   .starts = ustweet$starts,
                   .priors = ustweet$priors,
                   .control = {list(verbose = TRUE,
                                    maxit = 3,
                                    convtype = 2,
                                    thresh = 1e-6,
                                    threads = 1
                                    )
                           },
                   .anchor_item = 43
                   )


## End(Not run)


emIRT documentation built on March 18, 2022, 5:36 p.m.

Related to networkIRT in emIRT...