rollcall | R Documentation |
Create a rollcall
object, used for the analysis of legislative
voting or, equivalently, item-response modeling of binary data
produced by standardized tests, etc.
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)
data |
voting decisions (for roll calls), or test results (for
IRT). Can be in one of two forms. First, |
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 |
notInLegis |
numeric or |
legis.names |
a vector of names of the legislators or
individuals. If |
vote.names |
a vector of names or labels for the votes or items.
If |
legis.data |
a |
vote.data |
a |
desc |
character, a string providing an (optional) description of
the data being used. If |
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. |
See below for methods that operate on objects of class
rollcall
.
An object of class rollcall
, a list with the following components:
votes |
a |
codes |
a |
n |
numeric, number of legislators, equal to |
m |
numeric, number of votes, equal to |
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 |
source |
any user-supplied source information (e.g., a url or a
short-form reference). If no description is provided, |
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.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.