Description Usage Arguments Value Author(s) References Examples
Tunes and estimates MD Bayes algorithm (ei.MD.bayes). This, combined with md_bayes_table() produces tables of results compatible with EI table of results.
1 2 3 |
dat |
data.frame() object of just raw candidate vote and raw population counts. Put vote results in first set of columns, put population counts next |
form |
Formula object, e.g.: cbind(V1, V2, novote) ~ cbind(VtdAVap_cor, VtdBVap_cor, VtdHVap_cor, VtdOVap_cor) |
total_yes |
Logical, default=TRUE. Include total variable from data? Usually when data are stored in percents |
total |
character, total variable column name |
ntunes |
Numeric. How much to tune tuneMD. Default = 10 |
totaldraws |
Numeric. Number of total draws from MD. Default = 10000 |
seed |
Numeric. Default = 12345 |
sample |
Numeric. Default = 10000 |
thin |
Numeric. Default = 10 |
burnin |
Numeric. Default = 10000 |
ret.mcmc |
Logical. Default = TRUE |
ci |
numeric vector of credible interval (low/high), default is 95 percent= c(0.025, 0.975) |
ci_TRUE |
Logical, default = TRUE. Include credible intervals in reported results. |
produce_draws |
Logical, default is FALSE. Produces two-item list of table and md.bayes() mcmc draws (for additional testing and analysis) |
... |
Additional arguments passed to tuneMD() and ei.MD.bayes() |
List object of length 1 (when produce_draws=FALSE). List object of length 2 (when produce_draws=TRUE). First item is list of race x candidate tabular results, with mean, SE, and credible intervals. Second item is mcmc draws.
Loren Collingwood <loren.collingwood@ucr.edu>
eiPack, King et. al. (http://gking.harvard.edu/eiR)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# TOY DATA EXAMPLE
canda <- c(10,8, 10, 4, 8)
candb <- 20-canda
white <- c(15, 12, 18, 6, 10)
black <- 20 - white
toy <- data.frame(canda, candb, white, black)
# Generate formula for passage to ei.reg.bayes() function #
form <- formula(cbind(canda,candb) ~ cbind(black, white))
# Then execute md_bayes_gen(); not run here due to time
md_bayes_gen(toy, form, total_yes=FALSE, ntunes=1, thin=1, totaldraws=100, sample=10, burnin=1)
# Add in mcmc drawrings #
drawrings <- md_bayes_gen(toy, form, total_yes=FALSE, ntunes=1, thin=1,totaldraws=100,sample=10,burnin =1, produce_draws=TRUE)
head ( drawrings$draws )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.