Version: | 1.2.1 |
Date: | 2023-02-03 |
Title: | Optimal Classification Roll Call Analysis Software |
Depends: | R (≥ 2.3.1), pscl (≥ 0.59) |
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'. |
License: | GPL-2 |
URL: | https://legacy.voteview.com/oc_in_R.htm, https://github.com/wmay/oc |
BugReports: | https://github.com/wmay/oc/issues |
Repository: | CRAN |
NeedsCompilation: | yes |
RoxygenNote: | 6.0.1 |
Packaged: | 2023-02-06 02:43:12 UTC; will |
Author: | Keith Poole [aut],
Jeffrey Lewis |
Maintainer: | William May <wmay@hey.com> |
Date/Publication: | 2023-02-06 11:32:31 UTC |
United Nations Vote Data
Description
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.
Usage
data(UN)
Value
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.
Author(s)
Keith Poole ktpoole@uga.edu
Jeffrey Lewis jblewis@ucla.edu
James Lo lojames@usc.edu
Royce Carroll rcarroll@rice.edu
Source
Keith Poole. 2005. UN Vote Data. https://legacy.voteview.com/.
See Also
'oc'.
Examples
#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)
Optimal Classification Roll Call Scaling
Description
oc
is the function that takes a rollcall
object and estimates nonmetric
Optimal Classification scores with them.
Usage
oc(rcObject, dims=2, minvotes=20, lop=0.025, polarity, verbose=FALSE)
Arguments
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. |
Value
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. |
Author(s)
Keith Poole ktpoole@uga.edu
Jeffrey Lewis jblewis@ucla.edu
James Lo lojames@usc.edu
Royce Carroll rcarroll@rice.edu
References
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/
See Also
'plot.OCobject','summary.OCobject'.
Examples
#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)
Optimal Classification Cutting Line Angles Plot
Description
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.
Usage
## S3 method for class 'OCangles'
plot(x, main.title="Cutting Line Angles",
x.title="Angle in Degrees", y.title="Count",
dims=c(1,2),...)
Arguments
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 |
Value
A cutting line angle plot.
Author(s)
Keith Poole ktpoole@uga.edu
Jeffrey Lewis jblewis@ucla.edu
James Lo lojames@usc.edu
Royce Carroll rcarroll@rice.edu
See Also
'oc', 'plot.OCcoords', 'plot.OCskree', 'plot.OCcutlines', 'plot.OCobject'
Examples
#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)
Optimal Classification Coordinate Plot
Description
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.
Usage
## 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,...)
Arguments
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 |
Value
A coordinate plot.
Author(s)
Keith Poole ktpoole@uga.edu
Jeffrey Lewis jblewis@ucla.edu
James Lo lojames@usc.edu
Royce Carroll rcarroll@rice.edu
See Also
'oc', 'plot.OCskree', 'plot.OCangles', 'plot.OCcutlines', 'plot.OCobject'
Examples
#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)
Optimal Classification Cutline Plot
Description
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.
Usage
## 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,...)
Arguments
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 |
Value
A Coombs mesh.
Author(s)
Keith Poole ktpoole@uga.edu
Jeffrey Lewis jblewis@ucla.edu
James Lo lojames@usc.edu
Royce Carroll rcarroll@rice.edu
See Also
'oc', 'plot.OCcoords', 'plot.OCskree', 'plot.OCangles', 'plot.OCobject'
Examples
#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)
Optimal Classification Summary Plot
Description
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.
Usage
## S3 method for class 'OCobject'
plot(x, dims=c(1,2), ...)
Arguments
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. |
Value
A summary plot of an OCobject
object.
Author(s)
Keith Poole ktpoole@uga.edu
Jeffrey Lewis jblewis@ucla.edu
James Lo lojames@usc.edu
Royce Carroll rcarroll@rice.edu
See Also
'oc', 'plot.OCcoords', 'plot.OCskree', 'plot.OCangles', 'plot.OCcutlines'
Examples
#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)
Optimal Classification Skree Plot
Description
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.
Usage
## S3 method for class 'OCskree'
plot(x, main.title="Skree Plot", x.title="Dimension",
y.title="Eigenvalue",...)
Arguments
x |
an |
main.title |
string, Skree plot title. |
x.title |
string, x-axis label. |
y.title |
string, y-axis label. |
... |
other arguments to |
Value
A Skree plot, showing the first 20 eigenvalues.
Author(s)
Keith Poole ktpoole@uga.edu
Jeffrey Lewis jblewis@ucla.edu
James Lo lojames@usc.edu
Royce Carroll rcarroll@rice.edu
See Also
'oc', 'plot.OCcoords', 'plot.OCangles', 'plot.OCcutlines', 'plot.OCobject'
Examples
#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)
90th U.S. Senate Roll Call Vote Matrix
Description
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.
Usage
data(sen90)
Value
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. |
Author(s)
Keith Poole ktpoole@uga.edu
Jeffrey Lewis jblewis@ucla.edu
James Lo lojames@usc.edu
Royce Carroll rcarroll@rice.edu
Source
Voteview team. 2017. 90th Senate Roll Call Vote Data. https://voteview.com/static/data/out/votes/S090_votes.ord.
See Also
'oc'.
Examples
#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)
90th U.S. Senate Ideal Points via Optimal Classification
Description
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.
Usage
data(sen90oc)
Value
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. |
Author(s)
Keith Poole ktpoole@uga.edu
Jeffrey Lewis jblewis@ucla.edu
James Lo lojames@usc.edu
Royce Carroll rcarroll@rice.edu
Source
Voteview Team. 2017. 90th Senate Roll Call Vote Data. https://voteview.com/static/data/out/votes/S090_votes.ord.
See Also
'oc', 'plot.OCcoords', 'plot.OCskree', 'plot.OCangles', 'plot.OCcutlines', 'plot.OCobject'
Examples
#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)
Optimal Classification Summary
Description
summary.OCobject
reads an Optimal Classification object and prints a summary.
Usage
## S3 method for class 'OCobject'
summary(object,verbose=FALSE,...)
Arguments
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. |
Value
A summary of a OCobject
object.
Author(s)
Keith Poole ktpoole@uga.edu
Jeffrey Lewis jblewis@ucla.edu
James Lo lojames@usc.edu
Royce Carroll rcarroll@rice.edu
See Also
'oc', 'plot.OCcoords', 'plot.OCskree', 'plot.OCangles', 'plot.OCcutlines', 'plot.OCobject'
Examples
#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)