election {survey} | R Documentation |
A sample of voting data from US states or counties (depending on data availability), sampled with probability proportional to number of votes
data(election)
election
is a data frame with 4600 observations on the following 8 variables.
County
TotPrecincts
PrecinctsReporting
Bush
Kerry
Nader
votes
p
votes
election_pps
is a sample of 40 counties or states taken with
probability proportional to the number of votes. It includes the
additional column wt
with the sampling weights
election_insample
indicates which rows of election
were sampled.
election_jointprob
are the pairwise sampling probabilities and
election_jointHR
are approximate pairwise sampling probabilities using
the Hartley-Rao approximation.
.
data(election) ## high positive correlation between totals plot(Bush~Kerry,data=election,log="xy") ## high negative correlation between proportions plot(I(Bush/votes)~I(Kerry/votes), data=election) dpps<- svydesign(id=~1, weights=~wt, fpc=~p, data=election_pps, pps="brewer") dppswr <-svydesign(id=~1, weights=~wt, data=election_pps) svytotal(~Bush+Kerry+Nader, dpps) svytotal(~Bush+Kerry+Nader, dppswr)