rollcall                package:pscl                R Documentation

_c_r_e_a_t_e _a_n _o_b_j_e_c_t _o_f _c_l_a_s_s _r_o_l_l_c_a_l_l

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

     Create a 'rollcall' object, used for the analysis of legislative
     voting or, equivalently, item-response modeling of binary data
     produced by standardized tests, etc.

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

     rollcall(data,
              yea=1, nay=0, missing=NA, notInLegis=9,
              legis.names=NULL, vote.names=NULL,
              legis.data=NULL, vote.data=NULL,
              desc=NULL, source=NULL)

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

    data: voting decisions (for roll calls), or test results (for IRT).
           Can be in one of two forms.  First, 'data' may be a
          'matrix', with rows corresponding to legislators (subjects)
          and columns to roll calls (test items).  'data' can also be a
          'list' with an element named 'votes' containing the matrix
          described above.

     yea: numeric, possibly a vector, code(s) for a Yea vote in the
          rollcall context, or a correct answer in the educational
          testing context. Default is 1.

     nay: numeric, possibly a vector, code(s) for a Nay vote in the
          rollcall context, or an incorrect answer in the educational
          testing context.  Default is 0.

 missing: numeric or 'NA', possibly a vector, code(s) for missing data.
           Default is 'NA'.

notInLegis: numeric or 'NA', possibly a vector, code(s) for the
          legislator not being in the legislature when a particular
          roll call was recorded (e.g., deceased, retired, yet to be
          elected).

legis.names: a vector of names of the legislators or individuals.  If
          'data' is a list and contains an element named legis.names,
          then the list element will be used.  Names will be generated
          if not supplied.

vote.names: a vector of names or labels for the votes or items. If
          'data' is a list and contains an element named vote.names,
          then the list element will be used.  Names will be generated
          if not supplied.

legis.data: a 'matrix' or 'data.frame' containing covariates specific
          to each legislator/test-taker; e.g., party affiliation,
          district-level covariates.  If this object does not have the
          same number of rows as 'data', an error is returned.

vote.data: a 'matrix' or 'data.frame' containing covariates specific to
          each roll call vote or test item; e.g., a timestamp, the bill
          sponsor, descriptive text indicating the type of vote.  If
          this object does not have the same number of row as the
          number of columns in 'data', an error is returned.

    desc: character, a string providing an (optional) description of
          the data being used.  If 'data' is a list and contains an
          element named 'desc', then this will be used.

  source: character, a string providing an (optional) description of
          where the roll call data originated (e.g., a URL or a
          short-form reference).  Used in print and summary methods.

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

     See below for methods that operate on objects of class 'rollcall'.

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

     An object of class 'rollcall', a list with the following
     components:

   votes: a 'matrix' containing voting decisions, with rows
          corresponding to legislators (test subjects) and columns to
          roll call votes (test items). Legislators (test subjects) and
          items (or votes) have been labeled in the 'dimnames'
          attribute of this matrix, using the 'legis.names' and/or
          'vote.names' arguments, respectively.

   codes: a 'list' with named components 'yea', 'nay', 'notInLegis' and
          'missing', each component a numeric vector (possibly of
          length 1 and possibly 'NA'), indicating how entries in the
          'votes' component of the 'rollcall' object should be
          considered.  This list simply gathers up the values in the
          'yea', 'nay', 'notInLegis' and 'missing' arguments passed to
          the function.

       n: numeric, number of legislators, equal to 'dim(votes)[1]'

       m: numeric, number of votes, equal to 'dim(votes)[2]'

legis.data: user-supplied data on legislators/test-subjects.

vote.data: user-supplied data on rollcall votes/test-items.

    desc: any user-supplied description.  If no description was
          provided, defaults 'desc' defaults to 'NULL'.

  source: any user-supplied source information (e.g., a url or a
          short-form reference).  If no description is provided,
          'source' defaults to 'NULL'.

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

     'readKH' for creating objects from files (possibly over the web),
     in the format used for data from the United States Congress used
     by Keith Poole and Howard Rosenthal (and others).

     'summary.rollcall', 'ideal' for model fitting.

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

     ## generate some fake roll call data
     set.seed(314159265)
     fakeData <- matrix(sample(x=c(0,1),size=5000,replace=TRUE),
                        50,100)
     rc <- rollcall(fakeData)
     is(rc,"rollcall")        ## TRUE
     rc                       ## print the rollcall object on screen

     data(sc9497)             ## Supreme Court example data
     rc <- rollcall(data=sc9497$votes,
                    legis.names=sc9497$legis.names,
                    desc=sc9497$desc)
     summary(rc,verbose=TRUE)                      

     ## Not run: 
     ## s107
     ## could use readKH for this
     dat <- readLines("sen107kh.ord")
     dat <- substring(dat,37)
     mat <- matrix(NA,ncol=nchar(dat[1]),nrow=length(dat))
     for(i in 1:103){
       mat[i,] <- as.numeric(unlist(strsplit(dat[i],
                                             split=character(0))))
     }

     s107 <- rollcall(mat,
                      yea=c(1,2,3),
                      nay=c(4,5,6),
                      missing=c(7,8,9),
                      notInLegis=0,
                      desc="107th U.S. Senate",
                      source="http://voteview.ucsd.edu")
     summary(s107)
     ## End(Not run)

