MCMCirtKd(datamatrix, dimensions, item.constraints=list(),
burnin = 1000, mcmc = 10000, thin=5, verbose = FALSE, seed = 0,
alphabeta.start = NA, b0 = 0, B0=0, store.item = FALSE,
store.ability=TRUE, drop.constantvars=TRUE, ... )
rowname=list(d,c)
which will constrain the dth item parameter for the item namalphabeta.start
is set to a
scalar the starting value for all unconstrained item parameters will
be set to that scalar. If alp
MCMCirtKd
simulates from the posterior density using
standard Gibbs sampling using data augmentation (a Normal draw
for the subject abilities, a multivariate Normal
draw for the item parameters, and a truncated Normal draw for
the latent utilities). The simulation proper is done in
compiled C++ code to maximize efficiency. Please consult the
coda documentation for a comprehensive list of functions that
can be used to analyze the posterior density sample.
The default number of burnin and mcmc iterations is much
smaller than the typical default values in MCMCpack. This is
because fitting this model is extremely computationally
expensive. It does not mean that this small of a number of
scans will yield good estimates. If the verbose option is
chosen, output will be printed to the screen every fifty
iterations. The priors of this model need to be proper for
identification purposes. The user is asked to provide prior
means and precisions (not variances) for the item
parameters and the subject parameters.
The model takes the following form. We assume that each
subject has an subject ability (ideal point) denoted
$\theta_j$ $(K \times 1)$,
and that each item has a difficulty
parameter $\alpha_i$ and discrimination parameter
$\beta_i$ $(K \times 1)$.
The observed choice by subject
$j$ on item $i$ is the observed data matrix which
is $(I \times J)$. We assume that the choice is
dictated by an unobserved utility: $$z_{i,j} = \alpha_i +
\beta_i' \theta_j + \varepsilon_{i,j}$$ Where the errors are assumed to be
distributed standard Normal. The parameters of interest are
the subject abilities (ideal points) and the item parameters. We assume the following priors. For the subject abilities (ideal points)
we assume independent standard Normal priors:
$$\theta_{j,k} \sim \mathcal{N}(0,1)$$
These cannot be changed by the user.
For each item parameter, we assume independent Normal priors:
$$\left[\alpha_i, \beta_i \right]' \sim \mathcal{N}_{(K+1)}
(b_{0,i},B_{0,i})$$
Where $B_{0,i}$ is a diagonal matrix.
One can specify a separate prior mean and precision
for each item parameter.
The model is identified by the constraints on the item parameters
(see Jackman 2001). The user cannot place constraints on the subect
abilities. This identification scheme differs from that in
MCMCirt1d
, which uses a single directional constraint on
one subject ability. However, in our experience, using subject
ability constraints for models in greater than one dimension does not work
particularly well.
Andrew D. Martin, Kevin M. Quinn, and Daniel Pemstein. 2003.
Scythe Statistical Library 0.4.
plot.mcmc
,summary.mcmc
,
MCMCirt1d
, MCMCordfactanal
data(SupremeCourt)
# note that the rownames (the item names) are "1", "2", etc
posterior1 <- MCMCirtKd(SupremeCourt, dimensions=1,
burnin=5000, mcmc=50000, thin=10,
B0=.25, store.item=TRUE,
item.constraints=list("1"=list(2,"-")))
plot(posterior1)
summary(posterior1)
data(Senate)
rownames(Senate) <- Senate$member
# note that we need to transpose the data to get
# the bills on the rows
posterior2 <- MCMCirtKd(t(Senate[,6:677]), dimensions=2,
burnin=5000, mcmc=50000, thin=10,
item.constraints=list(rc2=list(2,"-"), rc2=c(3,0),
rc3=list(3,"-")),
B0=.25)
plot(posterior2)
summary(posterior2)
Run the code above in your browser using DataLab