makeStratObj: Making a strat.elec.data Object from an elec.data Object

Description Usage Arguments Details Author(s) See Also Examples

View source: R/optStrat.R

Description

Makes a strat.elec.data object from an elec.data object.

Usage

1
	makeStratObj(Z, strat.col = NULL, CID = NULL, auditTable = NULL)

Arguments

Z

An elec.data object.

strat.col

Name of column in Z$V that identifies strata. If no value of strat.col is passed, makeStratObj will assume that stratum ID is contained in Z$V$CID.

CID

A vector of length nrow(Z$V) that identifies strata.

auditTable

A data.frame of dimension length(unique(CID) x 2 used to identify the number of samples taken from each stratum. Including auditTable is not necessary if Z contains audit information.

Details

makeStratObj requires as input a valid elec.data object Z such that one of the following is true:

If Z$audit is NULL, information giving the number of sampled batches in each stratum can be included through auditTable. 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.

makeStratObj creates a data.frame Z$strat. The columns of Z$strat are

If no audit data is provided, Z$strat$audit defaults to a zero vector.

If Z$V$CID is NULL, makeStratObj will copy the stratum labels into Z$V$CID. makeStratObj will also create

If Z$audit[Z$PID.col] is not NULL, makeStratObj will create Z$audit$e.max, the maximumMarginBound(Z) for batches in Z$audit.

After sending an elec.data object through makeStratObj, the object will be both an elec.data object and a strat.elec.data object.

Author(s)

Mike Higgins, Hua Yang

See Also

See strat.elec.data to create a strat.elec.data object from a votes data.frame and an audit data.frame.

Examples

1
2
3
4
	data("CA_House_2008")
	dstrat <- CA_House_2008.strat[[1]]
	auditTable <- cbind(unique(dstrat$V$CID),1)
	dstrat <- makeStratObj(dstrat,auditTable = auditTable)

elec.strat documentation built on May 1, 2019, 8:39 p.m.