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.
networkIRT(.y, .starts = NULL, .priors = NULL, .control = NULL,
.anchor_subject = NULL, .anchor_item = NULL)
An object of class networkIRT
.
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 \(\beta\).
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\).
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 \(\beta\).
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\).
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.
Number of followers in estimation, should correspond to number of rows in data matrix .y
Number of politicians in estimation, should correspond to number of columns in data matrix .y
Function call used to generate output.
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.
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 \(\beta\).
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.
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\).
alpha$sigma
prior variance for \(\alpha\)
beta$mu
prior mean for \(\beta\).
beta$sigma
prior variance for \(\beta\).
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.
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.
integer, specifying subject to use as identification anchor.
integer, specifying item to use as identification anchor.
Kosuke Imai imai@Harvard.edu
James Lo jameslo@princeton.edu
Jonathan Olmsted jpolmsted@gmail.com
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.
'ustweet'
if (FALSE) {
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
)
}
Run the code above in your browser using DataLab