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.
alphaA (J x 1) matrix of point estimates for politician propensity to be followed \(alpha\).
betaA (N x 1) matrix of point estimates for follower propensity to follow others \(\beta\).
wAn (J x 1) matrix of point estimates for politician ideal points \(z\).
thetaAn (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:
alphaA (J x 1) matrix of variance estimates for politician propensity to be followed \(alpha\).
betaA (N x 1) matrix of variance estimates for follower propensity to follow others \(\beta\).
wAn (J x 1) matrix of variance estimates for politician ideal points \(z\).
thetaAn (N x 1) matrix of variance estimates for the follower ideal points \(x\).
A list of fit results, with elements listed as follows:
itersinteger, number of iterations run.
convinteger, convergence flag. Will return 1 if threshold reached, and 0 if maximum number of iterations reached.
threadsinteger, number of threads used to estimated model.
tolerancenumeric, 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:
alphaA (J x 1) matrix of starting values for politician propensity to be followed \(alpha\).
betaA (N x 1) matrix of starting values for follower propensity to follow others \(\beta\).
wAn (J x 1) matrix of starting values for politician ideal points \(z\).
thetaAn (N x 1) matrix of starting values for the follower ideal points \(x\).
gammaAn (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$muprior mean for \(\alpha\).
alpha$sigmaprior variance for \(\alpha\)
beta$muprior mean for \(\beta\).
beta$sigmaprior variance for \(\beta\).
w$muprior mean for z.
w$sigmaprior variance for z
theta$muprior mean for x.
theta$sigmaprior variance for x.
gamma$muShould be fixed to equal 1.
gamma$sigmaShould be fixed to equal 1.
list, specifying some control functions for estimation. Options include the following:
threadsinteger, indicating number of cores to use. Default is to use a single core, but more can be supported if more speed is desired.
verboseboolean, indicating whether output during estimation should be verbose or not. Set FALSE by default.
threshnumeric. Algorithm will run until all parameters correlate at 1 - thresh across consecutive iterations. Set at 1e-6 by default.
maxitinteger. Sets the maximum number of iterations the algorithm can run. Set at 500 by default.
checkfreqinteger. 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