Title: | Optimal Classification Roll Call Analysis Software |
---|---|
Description: | Estimates optimal classification (Poole 2000) <doi:10.1093/oxfordjournals.pan.a029814> scores from roll call votes supplied though a 'rollcall' object from package 'pscl'. |
Authors: | Keith Poole [aut], Jeffrey Lewis [aut] , James Lo [aut], Royce Carroll [aut] , William May [aut, cre] , U.S. National Science Foundation [fnd] (NSF Grant SES-0611974) |
Maintainer: | William May <[email protected]> |
License: | GPL-2 |
Version: | 1.2.1 |
Built: | 2024-11-18 06:35:13 UTC |
Source: | CRAN |
oc
is the function that takes a rollcall
object and estimates nonmetric
Optimal Classification scores with them.
oc(rcObject, dims=2, minvotes=20, lop=0.025, polarity, verbose=FALSE)
oc(rcObject, dims=2, minvotes=20, lop=0.025, polarity, verbose=FALSE)
rcObject |
An object of class |
dims |
integer, number of dimensions to estimate. Must be nonnegative and cannot exceed 10 dimensions. |
minvotes |
minimum number of votes a legislator must vote in for them to be analyzed. |
lop |
A proportion between 0 and 1, the cut-off used for excluding lopsided
votes, expressed as the proportion of non-missing votes on the minority side.
The default, |
polarity |
a vector specifying the legislator in the data set who is conservative on
each dimension. For example, |
verbose |
logical, indicates whether bills and legislators to be deleted should be printed while data is being checked before ideal points are estimated. |
An object of class OCobject
, with elements as follows:
legislators |
data frame, containing all data from the old
|
rollcalls |
data frame, containing all data from the old
|
dimensions |
integer, number of dimensions estimated. |
eigenvalues |
A vector of roll call eigenvalues. |
fits |
A vector of length 2 with the classic measures of fit, containing the percent correct classification and the APRE. |
Keith Poole [email protected]
Jeffrey Lewis [email protected]
James Lo [email protected]
Royce Carroll [email protected]
Keith Poole. 2000. 'Non-parametric Unfolding of Binary Choice Data.' Political Analysis, 8(3):211-237
Keith Poole. 2005. 'Spatial Models of Parliamentary Voting.' Cambridge: Cambridge University Press.
Keith Poole. https://legacy.voteview.com/
'plot.OCobject','summary.OCobject'.
#This data file is the same as reading file using: ## Not run: sen90 <- readKH("https://voteview.com/static/data/out/votes/S090_votes.ord") ## End(Not run) #All ORD files can be found on voteview.com data(sen90) summary(sen90) #Small executable example sen90.1d <- oc(sen90,dims=1,polarity=c(7)) #Output file identical to one produced by command below ## Not run: sen90oc <- oc(sen90,dims=2,polarity=c(7,2)) ## End(Not run) data(sen90oc) summary(sen90oc) plot(sen90oc)
#This data file is the same as reading file using: ## Not run: sen90 <- readKH("https://voteview.com/static/data/out/votes/S090_votes.ord") ## End(Not run) #All ORD files can be found on voteview.com data(sen90) summary(sen90) #Small executable example sen90.1d <- oc(sen90,dims=1,polarity=c(7)) #Output file identical to one produced by command below ## Not run: sen90oc <- oc(sen90,dims=2,polarity=c(7,2)) ## End(Not run) data(sen90oc) summary(sen90oc) plot(sen90oc)
plot.angles
reads an Optimal Classification object and plots a histogram
of the angles of the cutlines for two dimensions. plot.angles
does not
work for one-dimensional OCobject
objects.
## S3 method for class 'OCangles' plot(x, main.title="Cutting Line Angles", x.title="Angle in Degrees", y.title="Count", dims=c(1,2),...)
## S3 method for class 'OCangles' plot(x, main.title="Cutting Line Angles", x.title="Angle in Degrees", y.title="Count", dims=c(1,2),...)
x |
an |
main.title |
string, coordinate plot title. |
x.title |
string, x-axis label. |
y.title |
string, y-axis label. |
dims |
vector of length 2, specifying the dimensions to be plotted. |
... |
other arguments to |
A cutting line angle plot.
Keith Poole [email protected]
Jeffrey Lewis [email protected]
James Lo [email protected]
Royce Carroll [email protected]
'oc', 'plot.OCcoords', 'plot.OCskree', 'plot.OCcutlines', 'plot.OCobject'
#This data file is the same as that obtained using: ## Not run: data(sen90) sen90oc <- oc(sen90,dims=2,polarity=c(7,2)) ## End(Not run) data(sen90oc) summary(sen90oc) plot.OCangles(sen90oc)
#This data file is the same as that obtained using: ## Not run: data(sen90) sen90oc <- oc(sen90,dims=2,polarity=c(7,2)) ## End(Not run) data(sen90oc) summary(sen90oc) plot.OCangles(sen90oc)
plot.coords
reads an Optimal Classification object in 2 user-specified
dimensions and plots the coordinates of each member, applying separate colors
and shapes to each party by default. A unit circle is included to emphasize the
constraints on the Optimal Classification coordinates, and options to select
non-party attributes of legislators are included. For a 1D OCobject
object, Optimal Classification ranks are plotted against themselves, so they
appear on a straight line.
## S3 method for class 'OCcoords' plot(x, main.title="OC Coordinates", d1.title="First Dimension", d2.title="Second Dimension", dims=c(1,2), plotBy="party", color=TRUE, shape=TRUE, cutline=NULL, Legend=TRUE, legend.x=0.8, legend.y=1,...)
## S3 method for class 'OCcoords' plot(x, main.title="OC Coordinates", d1.title="First Dimension", d2.title="Second Dimension", dims=c(1,2), plotBy="party", color=TRUE, shape=TRUE, cutline=NULL, Legend=TRUE, legend.x=0.8, legend.y=1,...)
x |
an |
main.title |
string, coordinate plot title. |
d1.title |
string, x-axis label. |
d2.title |
string, y-axis label. |
dims |
vector of length 2, specifying the dimensions to be plotted. |
plotBy |
string, name of a variable in |
color |
logical, marks different groups specified by |
shape |
logical, marks different groups specified by |
cutline |
vector, selects roll calls by row number for which a cutting line is desired. |
Legend |
logical, include a generic legend. |
legend.x |
numeric, corresponds to the 'x' argument of legend(). |
legend.y |
numeric, corresponds to the 'y' argument of legend(). |
... |
other arguments to |
A coordinate plot.
Keith Poole [email protected]
Jeffrey Lewis [email protected]
James Lo [email protected]
Royce Carroll [email protected]
'oc', 'plot.OCskree', 'plot.OCangles', 'plot.OCcutlines', 'plot.OCobject'
#This data file is the same as that obtained using: ## Not run: data(sen90) sen90oc <- oc(sen90,dims=2,polarity=c(7,2)) ## End(Not run) data(sen90oc) summary(sen90oc) plot.OCcoords(sen90oc)
#This data file is the same as that obtained using: ## Not run: data(sen90) sen90oc <- oc(sen90,dims=2,polarity=c(7,2)) ## End(Not run) data(sen90oc) summary(sen90oc) plot.OCcoords(sen90oc)
plot.cutlines
reads an Optimal Classification object and plots the cutting line
of a specified proportion of all votes along two user-specified dimensions. The
default is to plot 50 cutting lines. This is also known as a Coombs mesh.
A unit circle is included to emphasize the constraints on the Optimal Classification
coordinates. Only cutlines that are constrained to have midpoints lying in a
unit circle are included. plot.cutlines
does not work for 1D OCobject
objects.
## S3 method for class 'OCcutlines' plot(x, main.title="Cutting Lines", d1.title="First Dimension", d2.title="Second Dimension", lines=50,dims=c(1,2),lwd=2,...)
## S3 method for class 'OCcutlines' plot(x, main.title="Cutting Lines", d1.title="First Dimension", d2.title="Second Dimension", lines=50,dims=c(1,2),lwd=2,...)
x |
an |
main.title |
string, coordinate plot title. |
d1.title |
string, x-axis label. |
d2.title |
string, y-axis label. |
lines |
numeric, number of non-constrained cutlines to be plotted. If this number exceeds to total number of cutlines, then all cutlines are plotted. |
dims |
numeric vector of length 2, specifying dimensions to be plotted. |
lwd |
numeric, line width. |
... |
other arguments to |
A Coombs mesh.
Keith Poole [email protected]
Jeffrey Lewis [email protected]
James Lo [email protected]
Royce Carroll [email protected]
'oc', 'plot.OCcoords', 'plot.OCskree', 'plot.OCangles', 'plot.OCobject'
#This data file is the same as that obtained using: ## Not run: data(sen90) sen90oc <- oc(sen90,dims=2,polarity=c(7,2)) ## End(Not run) data(sen90oc) summary(sen90oc) plot.OCcutlines(sen90oc)
#This data file is the same as that obtained using: ## Not run: data(sen90) sen90oc <- oc(sen90,dims=2,polarity=c(7,2)) ## End(Not run) data(sen90oc) summary(sen90oc) plot.OCcutlines(sen90oc)
plot.OCobject
reads an Optimal Classification object in two user-specified
dimensions and plots the coordinates, cutting lines, a Coombs mesh, and a Skree plot.
For one-dimensional OCobject
objects, it plots a one-dimensional coordinate
plot along with a Skree plot.
## S3 method for class 'OCobject' plot(x, dims=c(1,2), ...)
## S3 method for class 'OCobject' plot(x, dims=c(1,2), ...)
x |
an |
dims |
a vector of length 2, specifying the two dimensions to be plotted. |
... |
other arguments do nothing and are not passed to any plot functions. |
A summary plot of an OCobject
object.
Keith Poole [email protected]
Jeffrey Lewis [email protected]
James Lo [email protected]
Royce Carroll [email protected]
'oc', 'plot.OCcoords', 'plot.OCskree', 'plot.OCangles', 'plot.OCcutlines'
#This data file is the same as that obtained using: ## Not run: data(sen90) sen90oc <- oc(sen90,dims=2,polarity=c(7,2)) ## End(Not run) data(sen90oc) summary(sen90oc) plot(sen90oc)
#This data file is the same as that obtained using: ## Not run: data(sen90) sen90oc <- oc(sen90,dims=2,polarity=c(7,2)) ## End(Not run) data(sen90oc) summary(sen90oc) plot(sen90oc)
plot.skree
is the function that takes an Optimal Classification object and
plots a Skree plot. Skree plots show the dimensionality of the voting by showing
the sizes of the eigenvalues.
## S3 method for class 'OCskree' plot(x, main.title="Skree Plot", x.title="Dimension", y.title="Eigenvalue",...)
## S3 method for class 'OCskree' plot(x, main.title="Skree Plot", x.title="Dimension", y.title="Eigenvalue",...)
x |
an |
main.title |
string, Skree plot title. |
x.title |
string, x-axis label. |
y.title |
string, y-axis label. |
... |
other arguments to |
A Skree plot, showing the first 20 eigenvalues.
Keith Poole [email protected]
Jeffrey Lewis [email protected]
James Lo [email protected]
Royce Carroll [email protected]
'oc', 'plot.OCcoords', 'plot.OCangles', 'plot.OCcutlines', 'plot.OCobject'
#This data file is the same as that obtained using: ## Not run: data(sen90) sen90oc <- oc(sen90,dims=2,polarity=c(7,2)) ## End(Not run) data(sen90oc) summary(sen90oc) plot.OCskree(sen90oc)
#This data file is the same as that obtained using: ## Not run: data(sen90) sen90oc <- oc(sen90,dims=2,polarity=c(7,2)) ## End(Not run) data(sen90oc) summary(sen90oc) plot.OCskree(sen90oc)
This dataframe contains a matrix of votes cast by U.S. Senators
in the 90th Congress. The data are formatted consistent with the
rollcall
object format in Simon Jackman's pscl
package.
data(sen90)
data(sen90)
The dataframe contains roll call data for all Senators in the 90th Senate.
The data is formatted as a rollcall
object with the following elements.
votes |
data frame, containing all data from the old
|
codes |
list of four vectors. |
n |
numeric, number of legislators |
m |
numeric, number of roll calls |
legis.data |
data frame, containing the following information on legislators:
|
vote.data |
null, would otherwise be a data frame containing data on the votes. |
desc |
null, would otherwise be a string describing the data set. |
source |
string, describing where data set was read from. |
Keith Poole [email protected]
Jeffrey Lewis [email protected]
James Lo [email protected]
Royce Carroll [email protected]
Voteview team. 2017. 90th Senate Roll Call Vote Data. https://voteview.com/static/data/out/votes/S090_votes.ord.
'oc'.
#This data file is the same as reading file using: ## Not run: sen90 <- readKH("https://voteview.com/static/data/out/votes/S090_votes.ord") ## End(Not run) data(sen90) summary(sen90) #Output file identical to one produced by command below ## Not run: sen90oc <- oc(sen90,dims=2,polarity=c(7,2)) ## End(Not run) data(sen90oc) summary(sen90oc) plot(sen90oc)
#This data file is the same as reading file using: ## Not run: sen90 <- readKH("https://voteview.com/static/data/out/votes/S090_votes.ord") ## End(Not run) data(sen90) summary(sen90) #Output file identical to one produced by command below ## Not run: sen90oc <- oc(sen90,dims=2,polarity=c(7,2)) ## End(Not run) data(sen90oc) summary(sen90oc) plot(sen90oc)
This dataframe contains the estimated ideal points of the 90th U.S Senate
using oc
. Although it can easily be obtained from calling
the example in oc
, it is included here to facilitate illustration
of the examples for the plot and summary functions.
data(sen90oc)
data(sen90oc)
An object of class OCobject
, with elements as follows:
legislators |
data frame, containing all data from the old
|
rollcalls |
data frame, containing all data from the old
|
dimensions |
integer, number of dimensions estimated. |
eigenvalues |
A vector of roll call eigenvalues. |
fits |
A vector of length 2 with the classic measures of fit, containing the percent correct classification and the APRE. |
Keith Poole [email protected]
Jeffrey Lewis [email protected]
James Lo [email protected]
Royce Carroll [email protected]
Voteview Team. 2017. 90th Senate Roll Call Vote Data. https://voteview.com/static/data/out/votes/S090_votes.ord.
'oc', 'plot.OCcoords', 'plot.OCskree', 'plot.OCangles', 'plot.OCcutlines', 'plot.OCobject'
#This data file is the same as that obtained using: ## Not run: data(sen90) sen90oc <- oc(sen90,dims=2,polarity=c(7,2)) ## End(Not run) data(sen90oc) summary(sen90oc) plot(sen90oc)
#This data file is the same as that obtained using: ## Not run: data(sen90) sen90oc <- oc(sen90,dims=2,polarity=c(7,2)) ## End(Not run) data(sen90oc) summary(sen90oc) plot(sen90oc)
summary.OCobject
reads an Optimal Classification object and prints a summary.
## S3 method for class 'OCobject' summary(object,verbose=FALSE,...)
## S3 method for class 'OCobject' summary(object,verbose=FALSE,...)
object |
an |
verbose |
logical, includes all ideal points if TRUE, otherwise only returns the first 10 legislators. |
... |
other arguments do nothing and are not passed to any functions. |
A summary of a OCobject
object.
Keith Poole [email protected]
Jeffrey Lewis [email protected]
James Lo [email protected]
Royce Carroll [email protected]
'oc', 'plot.OCcoords', 'plot.OCskree', 'plot.OCangles', 'plot.OCcutlines', 'plot.OCobject'
#This data file is the same as that obtained using: ## Not run: data(sen90) sen90oc <- oc(sen90,dims=2,polarity=c(7,2)) ## End(Not run) data(sen90oc) summary(sen90oc) plot(sen90oc)
#This data file is the same as that obtained using: ## Not run: data(sen90) sen90oc <- oc(sen90,dims=2,polarity=c(7,2)) ## End(Not run) data(sen90oc) summary(sen90oc) plot(sen90oc)
This data frame contains votes from the first three sessions of the United Nations. The same data can also be downloaded as a CSV file from https://legacy.voteview.com/. The object of this data set is to provide an example of how one might use the W-NOMINATE package on a set of roll call votes not already stored in ORD format.
data(UN)
data(UN)
This data frame contains votes from the first three sessions of the United Nations. The first column are country names, while the second column indicates membership in the former Warsaw Pact (used as a 'party' variable). Yeas are coded 1, 2, and 3, nays are coded 4, 5, and 6, missing votes are coded 7, 8, and 9, and not being in the General Assembly is coded as a 0.
Keith Poole [email protected]
Jeffrey Lewis [email protected]
James Lo [email protected]
Royce Carroll [email protected]
Keith Poole. 2005. UN Vote Data. https://legacy.voteview.com/.
'oc'.
#The same data set can be obtained from downloading the UN.csv #file from legacy.voteview.com and reading it as follows: ## Not run: UN<-read.csv("UN.csv",header=FALSE,strip.white=TRUE) ## End(Not run) data(UN) UN<-as.matrix(UN) UN[1:5,1:6] UNnames<-UN[,1] legData<-matrix(UN[,2],length(UN[,2]),1) colnames(legData)<-"party" UN<-UN[,-c(1,2)] rc <- rollcall(UN, yea=c(1,2,3), nay=c(4,5,6), missing=c(7,8,9),notInLegis=0, legis.names=UNnames, legis.data=legData, desc="UN Votes", source="legacy.voteview.com") # Not Run ## Not run: result<-oc(rc,polarity=1,dims=1) plot(result) summary(result) ## End(Not run)
#The same data set can be obtained from downloading the UN.csv #file from legacy.voteview.com and reading it as follows: ## Not run: UN<-read.csv("UN.csv",header=FALSE,strip.white=TRUE) ## End(Not run) data(UN) UN<-as.matrix(UN) UN[1:5,1:6] UNnames<-UN[,1] legData<-matrix(UN[,2],length(UN[,2]),1) colnames(legData)<-"party" UN<-UN[,-c(1,2)] rc <- rollcall(UN, yea=c(1,2,3), nay=c(4,5,6), missing=c(7,8,9),notInLegis=0, legis.names=UNnames, legis.data=legData, desc="UN Votes", source="legacy.voteview.com") # Not Run ## Not run: result<-oc(rc,polarity=1,dims=1) plot(result) summary(result) ## End(Not run)