View source: R/predict_ideal.R
predict_ideal | R Documentation |
This function computes the probability matrix for the IDEAL Model. Specifically, it calculates the probabilities of voting "Yea" for each legislator (member), issue, (and time period) based on the posterior samples of model parameters.
predict_ideal(vote_info, post_samples)
vote_info |
A logical vote matrix (or a rollcall object) in which rows represent members and columns represent issues. The entries should be FALSE ("No"), TRUE ("Yes"), or NA (missing data). |
post_samples |
Posterior samples obtained from function 'ideal' in 'pscl' package. |
An array of probabilities with three dimensions. The first one represents to members, the second one refers to issues, and the third one refers to MCMC iterations.
# Long-running example
data(h116)
h116.c = preprocess_rollcall(h116)
require(pscl)
cl = constrain.legis(h116.c, x = list("CLYBURN" = -1, "SCALISE" = 1),
d = 1)
h116.c.ideal = ideal(h116.c, d = 1, priors = cl, startvals = cl,
maxiter = 2, thin = 1, burnin = 0,
store.item = TRUE)
h116.c.ideal.predprob = predict_ideal(h116.c, h116.c.ideal)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.