Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot.seatsVotes

plot seats-votes curves


Description

Plot seats-votes curves produced by seatsVotes

Usage

## S3 method for class 'seatsVotes'
plot(x, type = c("seatsVotes", "density"),
                legend = "bottomright", transform=FALSE, ...)

Arguments

x

an object of class seatsVotes

type

character, partially matching the options above; see details

legend

where to put the legend when plotting with type="seatsVotes"

transform

logical, whether to transform the vote shares for type="density"; see Details

...

arguments passed to or from other functions (e.g., options for the density function, when type="density")

Details

A seats-votes curve (with various annotations) is produced with option type="seatsVotes".

A density plot of the vote shares is produced with type="density". A bimodal density corresponds to an electoral system with a proliferation of safe seats for both parties, and a seats-votes curve that is relatively flat (or “unresponsive”) in the neighborhood of average district-level vote shares of 50 percent. The density is fitted using the defaults in the density function, but with the density constrained to fall to zero at the extremes of the data, via the from and to options to density. A rug is added to the density plot.

If transform=TRUE, the vote shares are transformed prior to plotting, so as to reduce the extent to which extreme vote shares close to zero or 1 determine the shape of the density (i.e., this option is available only for plots of type="density"). The transformation is a sinusoidal function, a scaled “log-odds/inverse-log-odds” function mapping from (0,1) to (0,1): i.e., f(x) = g(kh(x)) where h(x) is the log-odds transformation h(x) = log[x/(1-x)], k is a scaling parameter set to sqrt(3), and g(x) is the inverse-log-odds transformation g(x) = exp(x)/[1+exp(x)]. Note that this transformation is cosmetic, with the effect of assigning more of the graphing region to be devoted to marginal seats.

Value

The function performs the requested plots and exits silently with invisible{NULL}.

Author(s)

See Also

Examples

data(ca2006)
x <- ca2006$D/(ca2006$D+ca2006$R)
sv <- seatsVotes(x,
                 desc="Democratic Vote Shares, California 2006 congressional elections")

plot(sv)
plot(sv,type="density")
plot(sv,type="density",transform=TRUE)

pscl

Political Science Computational Laboratory

v1.5.5
GPL-2
Authors
Simon Jackman, with contributions from Alex Tahk, Achim Zeileis, Christina Maimone, Jim Fearon and Zoe Meers
Initial release
2020-02-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.