Description Usage Arguments Value Author(s) References Examples
Tunes and estimates MD Bayes algorithm (ei.MD.bayes). Returns a data frame of lambda posterior distribution draws. Similar to md_bayes_draw, but used primarily for assessing posterior distribution tests.
1 2 3 4 | md_bayes_draw_lambda(dat, race_vote_split, form,
ntunes=10, totaldraws = 100000, seed=12345,
sample = 100000, thin = 100, burnin = 100000,
ret.mcmc=TRUE)
|
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 |
race_vote_split |
Numeric vector of length 2 indicating where vote column ends (e.g., 3), and population counts begin (e.g., 4): c(3,4) |
form |
Formula object, e.g.: cbind(V1, V2, novote) ~ cbind(VtdAVap_cor, VtdBVap_cor, VtdHVap_cor, VtdOVap_cor) |
ntunes |
Numeric; how much to tune tuneMD. Default = 10 |
totaldraws |
Numeric; How many total draws from MD. Default = 100000 |
seed |
Numeric. Default = 12345 |
sample |
Numeric. Default = 100000 |
thin |
Numeric. Default = 10 |
burnin |
Numeric. Default = 100000 |
ret.mcmc |
Logical. Default = TRUE |
Posterior distribution of lambdas. This is often used for assessing RPB in elections with a small number of precincts.
Loren Collingwood <loren.collingwood@ucr.edu>; Justin Gross <jhgross@umass.edu>
eiPack, King et. al. (http://gking.harvard.edu/eiR)
1 2 3 4 5 6 7 8 9 10 11 12 13 |
# 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 excute md_bayes_draw(); not run here due to time
# md_bayes_draw_lambda(toy, c(2,3), form )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.