convertEiData: Extracting important values for ecological Inference

Description Usage Arguments Details Value See Also Examples

Description

Extracting important values for calculation of the ecological Inference with the runMBayes-function

Usage

1
convertEiData(form, aggr, indi = NULL, IDCols = c("ID"))

Arguments

form

formula in this format cbind(column_1,column_2, ...,column_c)~cbind(row_1,row_2,...,row_r))

aggr

data.frame with aggregate data. One district per line and one column giving one ID per district. (see Details)

indi

data.frame with individual data. One district per line and one column giving one ID per district. (see Details) If no individual data are present it defaults to NULL

IDCols

vector of length 2 giving the column-names or numbers of ID column

Details

indi is a districts x [(r*c)+1] data.frame containing one district per line. One column gives the ID of the districts which will be connection to the ID column in the aggr-data.frame.

For example a 2x3 ecological Inference problem with formula cbind(col1,col2,col3) ~ cbind(row1,row2) will have the row format : [ID, row1.col1, row1.col2, row1.col3, row2.col1, row2.col2, row2.col3]

It is important that the formula names correspond to the exact column number in the indi-data.frame.

Value

list with components needed for the Metropolis algorithm in runMBayes

See Also

runMBayes, mcmc tuneVars

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
# loading some fake election data
data(topleveldat)
form <- cbind(CSU_2, SPD_2, LINK_2, GRUN_2) ~ cbind(CSU_1, SPD_1, Link_1)

conv <- convertEiData(form=form, aggr=aggr, indi=indi, IDCols=c("ID", "ID"))

str(conv)

## End(Not run)

eiwild documentation built on May 2, 2019, 6:43 a.m.

Related to convertEiData in eiwild...