Description Usage Arguments Details Author(s) See Also Examples
Makes a strat.elec.data
and an elec.data
object from
a votes data.frame
and an audit data.frame
.
1 2 3 |
V |
A |
C.names |
Names of candidates. |
f |
The number of winners. |
audit |
An audit |
pool |
Combine small candidates into single pseudo-candidates to increase power. |
tot.votes.col |
Name of column that has the total votes for the batches. |
PID.col |
Name of column that identifies unique batches. |
strat.col |
Name of column in votes that identifies strata. |
CID |
A vector of length |
auditTable |
A |
strat.elec.data
creates a strat.elec.data
object:
an elec.data
object with additional entries for easy use with theelec.strat
package.
strat.elec.data
allows for two ways to specify the stratification:
Specify strat.col
: the name of the column in V
that contains strata information.
Provide a CID
vector of length nrow(V)
specifying the stratification.
If neither method is used to specify stratification, only an elec.data
object is created.
If audit
is not NULL and strat.col
is provided,
strat.elec.data
will find the strat.col
column in
audit
to create an auditTable
.
If no column in audit
is labeled as strat.col
,
strat.elec.data
will throw an error.
If audit
is not NULL, strat.col
is NULL,
and CID
is provided,
strat.elec.data
will try to find
the column in audit
labeled PID.col
to generate the auditTable
.
If the PID.col
column is not in audit
,
then auditTable
will need to be given;
otherwise Z$strat$audit
defaults to a zero vector.
The argument auditTable
should be a
data.frame
of dimensions unique(CID)
x 2.
The first column is a list of unique stratum IDs.
The second column is the number of batches sampled
within the corresponding stratum.
strat.elec.data
first calls elec.data
to create
an elec
object Z
.
An auditTable
is either created through audit
or given by the auditTable
argument,
and makeStratObj
is called to create
a strat.elec.data
object.
For a detailed description of the structure of a strat.elec.data
object,
see makeStratObj
.
For a more detailed description of the arguments
V, C.names, f, pool, audit, tot.votes.col
, see elec.data
.
Mike Higgins
See elec.data
to create an elec.data
object.
See makeStratObj
to create a strat.elec.data
object from an
elec.data
object.
Both elec.data
and makeStratObj
are
called by strat.elec.data
.
1 2 3 4 5 6 | data(MN_Senate_2006)
votes <- MN_Senate_2006.strat$V
audit <- MN_Senate_2006.strat$audit
CID <- MN_Senate_2006.strat$V$CID
names <- c("Klo","Ken")
strat.elec.data(V = votes, C.names = names, audit = audit, CID = CID)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.