tracex                 package:pscl                 R Documentation

_t_r_a_c_e _p_l_o_t _o_f _M_C_M_C _i_t_e_r_a_t_e_s, _p_o_s_t_e_r_i_o_r _d_e_n_s_i_t_y _o_f _l_e_g_i_s_l_a_t_o_r_s'
_i_d_e_a_l _p_o_i_n_t_s

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

     Produces a trace plot of the MCMC samples from the posterior
     density of legislators' 'ideal' points.

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

     tracex(object, legis=NULL, d=1, conf.int=0.95,
            showAll = FALSE, burnin=NULL,span=.25,
            legendLoc="topright")

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

  object: an object of class 'ideal'.

   legis: a vector of either the names of legislators (or 'partial
          matches' of the names as given in the 'dimnames' of
          'object$x'.

       d: numeric, either a scalar or a vector of length two, the
          dimension(s) to be traced.

conf.int: numeric, the level of the confidence interval on the
          posterior mean to be plotted.

 showAll: logical, if 'TRUE' and 'length(d)==2', display traces for all
          selected legislators' ideal points on the one plot.

  burnin: of the recorded MCMC samples, how many to discard as burnin? 
          Default is 'NULL', in which case the value of 'burnin' in the
          'ideal' object is used.

    span: numeric, a proportion, the 'span' to be used when calling
          'loess' to generate a moving average for trace plots when
          'd=1'

legendLoc: numeric or character, and possibly a vector, specifying
          where to place the legend when 'd=1'; setting
          'legendLoc=NULL' will suppress the legend for all requested
          trace plots

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

     Produces a trace plot showing the history of the MCMC iterations
     for the ideal point of each of the legislators (partially) named
     in 'legis'.  For 'd=1', each trace plot includes a trace over
     iterations, the cumulative mean, a moving average, the MCMC-based
     estimate of the mean of the posterior, and a confidence interval
     (specified by 'conf.int') around the mean of the posterior (using
     the estimated 'quantiles') of the respective MCMC iterates).  All
     of these values are calculated discarding the initial 'burnin'
     iterations.

     When 'd' is a vector of length two, a 2-dimensional trace plot is
     displayed, with the 'd[1]' dimension on the horizontal axis, and
     the 'd[2]' dimension on the vertical axis.

     When 'd=1', a legend will be placed on the plot; the option
     'legendLoc' controls the placing of the legend.  'legendLoc' may
     be a vector, specifying a unique legend location for each
     requested trace plots.  If 'legendLoc' is of length 1, it will be
     'rep'licated to have length equal to the number of requested trace
     plots.

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

     'ideal'; 'pmatch' for matching legislators' names.  See 'legend'
     for valid options to 'legendLoc'.

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

     data(s109)
     ## short run for demo purposes only
     id1 <- ideal(s109,
                  meanzero=TRUE,
                  maxiter=500,
                  burnin=100,thin=10,
                  verbose=TRUE)
     tracex(id1,legis="KENN")

     ## n.b., no such legislator named Horrendous Goblin
     tracex(id1,legis=c("KENN","BOX","KYL","Horrendous Goblin"))

     ## Not run: 
     id2 <- ideal(s109,
                  d=2,
                  maxiter=5000,   ## unidentified!
                  burnin=0,
                  thin=50)
     tracex(id2,d=1,legis=c("KENNEDY","BOXER","KYL","Horrendous Goblin"))
     tracex(id2,d=2,legis=c("KENNEDY","BOXER","KYL","Horrendous Goblin"))
     tracex(id2,d=1:2,
            legis=c("KENNEDY","BOXER","KYL","Horrendous Goblin"))

     ## partial matching
     tracex(id2,d=1:2,
            legis=c("KENN","BOX","BID","SNO","SPEC","MCCA","KYL",
                    "Horrendous Goblin"),
            showAll=TRUE)
     ## End(Not run)

