Description Usage Arguments Value See Also Examples
View source: R/mrp_party_estimation.R
The function fits a model using the jags
function and
predicts number of votes for a given candidate in unobserved polling
stations. Optionally the model can be fit with a stratified random sample
of the data, and predict for the population.
1 2 3 |
data |
A |
party |
Unquoted variable indicating the column from the data.frame to be modeled. |
stratum |
If sampling the data, unquoted variable indicating the column from the data.frame to be used as strata. The strata will also be used in the hierarchical structure of the model. |
frac |
If sampling the data, numeric value indicating the fraction of the data to sample, the sample is selected using stratified sampling with probability proportional to size. |
n_iter, n_burnin, n_chains |
Number of iterations, burnin size and chains.
to be used in |
seed |
Integer value used to set the state of the random number generator. |
seed_jags |
Seed for the call |
model_string |
String indicating the model to be used, if NULL defaults
to |
A list
with the object fitted using R2jags::jags and the vector
of simulated counts per candidate.
1 2 3 4 5 | # predict number of votes for pan_na using 6% of the sample
mrp_gto_pan <- mrp_party_estimation(gto_2012, pan_na,
stratum = distrito_loc_17, frac = 0.06, n_iter = 200, n_burnin = 100,
n_chains = 2, seed = 19291)
mrp_gto_pan$fit
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.