MCMCirtKd              package:MCMCpack              R Documentation

_M_a_r_k_o_v _c_h_a_i_n _M_o_n_t_e _C_a_r_l_o _f_o_r _K-_D_i_m_e_n_s_i_o_n_a_l _I_t_e_m _R_e_s_p_o_n_s_e _T_h_e_o_r_y
_M_o_d_e_l

_D_e_s_c_r_i_p_t_i_o_n:

     This function generates a posterior density sample from a
     K-dimensional item response theory (IRT) model, with standard
     Normal priors on the subject abilities (ideal points), and Normal
     priors on the item parameters.  The user supplies data and priors,
     and a sample from the posterior density is returned as an mcmc
     object, which can be subsequently analyzed with functions provided
     in the coda package.

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

datamatrix: The matrix of data.  Must be 0, 1, or missing values.   It
          is of dimensionality items by subjects.

dimensions: The number of dimensions in the latent space.

item.constraints: List of lists specifying possible equality or simple
          inequality constraints on the item parameters. A typical
          entry in the list has one of three forms: 'rowname=list(d,c)'
          which will constrain the dth item parameter for the item
          named rowname to be equal to c, 'rowname=list(d,"+")' which
          will constrain the dth item parameter for the item named
          rowname to be positive, and'rowname=list(d, "-")' which will
          constrain the dth item parameter for the item named varname
          to be negative. If x is a matrix without row names defaults
          names of ``V1", ``V2", ... , etc will be used. In a d
          dimensional model, the first item parameter for item i is the
          difficulty parameter (alpha_i), the second item parameter is
          the discrimation parameter on dimension 1
          (beta_{i,1}{beta_{i,1}}), the third item parameter is the
          discrimation parameter on dimension 2
          (beta_{i,2}{beta_{i,2}}), ...,  and the (d+1)th item
          parameter is the discrimation parameter on dimension d
          (beta_{i,1}{beta_{i,1}}).  The item difficulty parameters
          (alpha) should generally not be constrained.  

  burnin: The number of burn-in iterations for the sampler.

    mcmc: The number of iterations for the sampler.

    thin: The thinning interval used in the simulation.  The number of
          iterations must be divisible by this value.

 verbose: A switch which determines whether or not the progress of the
          sampler is printed to the screen.  If TRUE, the iteration
          number and the subject abilities (ideal points) are printed
          to the screen.

    seed: The seed for the random number generator.  The code uses the
          Mersenne Twister, which requires an integer as an input.  If
          nothing is provided, the Scythe default seed is used.

alphabeta.start: The starting values for the alpha and beta difficulty
          and discrimination parameters. If 'alphabeta.start' is set to
          a scalar the starting value for all unconstrained item
          parameters will be set to that scalar. If 'alphabeta.start'
          is a matrix of dimension (K+1) x items then the
          'alphabeta.start' matrix is used as the starting values
          (except for equality-constrained elements). If
          'alphabeta.start' is set to 'NA' (the default) then starting
          values for unconstrained elements are set to values generated
          from a series of proportional odds logistic regression fits,
          and starting values for inequality constrained elements are
          set to either 1.0 or -1.0 depending on the nature of the
          constraints. 

      b0: The prior means of the alpha and beta difficulty and
          discrimination parameters, stacked for all items. If a scalar
          is passed, it is used as the prior mean for all items.

      B0: The prior precisions (inverse variances) of the independent
          Normal prior on the item parameters. Can be either a scalar
          or a matrix of dimension (K+1) x items.

store.item: A switch that determines whether or not to store the item
          parameters for posterior analysis.  _NOTE: This takes an
          enormous amount of memory, so should only be used if the
          chain is thinned heavily, or for applications with a small
          number of items_.  By default, the item parameters are not
          stored.

store.ability: A switch that determines whether or not to store the
          subject abilities for posterior analysis.  By default, the
          item parameters are all stored.

drop.constantvars: A switch that determines whether or not items and
          subjects that have no variation should be deleted before
          fitting the model. Default = TRUE.

     ...: further arguments to be passed

_D_e_t_a_i_l_s:

     '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 x 1), and
     that each item has a difficulty parameter alpha_i and
     discrimination parameter beta_i (K x 1). The observed choice by
     subject j on item i is the observed data matrix which is (I * J). 
     We assume that the choice is dictated by an unobserved utility: 

            z_ij = alpha_i + beta_i'*theta_j + epsilon_ij

     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 ~ N(0, 1)

     These cannot be changed by the user. For each item parameter, we
     assume independent Normal priors:

              [alpha_i beta_i]' ~ 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.

_V_a_l_u_e:

     An mcmc object that contains the posterior density sample.  This 
     object can be summarized by functions provided by the coda
     package.

_R_e_f_e_r_e_n_c_e_s:

     James H. Albert. 1992. ``Bayesian Estimation of Normal Ogive Item
     Response  Curves Using Gibbs Sampling." _Journal of Educational
     Statistics_.   17: 251-269.

     Joshua Clinton, Simon Jackman, and Douglas Rivers. 2000. ``The
     Statistical  Analysis of Legislative Behavior: A Unified
     Approach." Paper presented at  the Annual Meeting of the Political
     Methodology Society.

     Simon Jackman. 2001. ``Multidimensional Analysis of Roll Call Data
     via Bayesian Simulation.'' _Political Analysis._ 9: 227-241.

     Valen E. Johnson and James H. Albert. 1999. ``Ordinal Data
     Modeling."  Springer: New York.

     Andrew D. Martin, Kevin M. Quinn, and Daniel Pemstein.  2003.  
     _Scythe Statistical Library 0.4._ <URL: http://scythe.wustl.edu>.

     Martyn Plummer, Nicky Best, Kate Cowles, and Karen Vines. 2002.
     _Output Analysis and Diagnostics for MCMC (CODA)_. <URL:
     http://www-fis.iarc.fr/coda/>.

_S_e_e _A_l_s_o:

     'plot.mcmc','summary.mcmc', 'MCMCirt1d', 'MCMCordfactanal'

_E_x_a_m_p_l_e_s:

        ## Not run: 
        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)
        ## End(Not run)

