Description Usage Arguments Details Value References Examples
BayesSimPMP
simulates posterior predicted probabilities for an estimated partial m-probit using Monte Carlo.
1 2 3 4 |
posterior |
(required) a posterior object from |
data |
(required) a |
prpslid |
(required) the name for the consecutive numbered ([1, J]) integer variable that identifies each proposal uniquely in the data. |
gntid |
(required) the name for the consecutive numbered ([1, M]) integer variable that identifies each voting member in the data. |
R |
(required) the number of members that have to agree to pass a proposal excluding the
members that have veto power. Can be a vector of length |
V |
the number of veto members that have to agree to pass a proposal. Can
can be a vector of length |
NSIM |
integer. The number of Monte Carlo simulations to run. |
verbose |
integer number: use |
seed |
integer number for the seeding value. |
postSamp |
number of posterior samples to be used in the calculations. |
postMean |
only calculate the predicted probabilities for the posterior mean? |
groups |
the name for the integer variable in |
q/pweights |
integer matrix of dimension |
q/pvote |
scalar or integer vector of length |
q/pslct |
integer vector of length |
To obtain the posterior density for the predicted probability that proposal j
passes, the function uses a
a Monte Carlo algorithm. Conditional on the covariates for all voting members with respect to proposal j
and a single draw from
the posterior density of the coefficients, it simulates NSIM
vote profiles. The number of
adoption decisions implied by these vote profiles relative to NSIM
gives an estimate about the probability for the passage of the
j^{th}
proposal. Iterating over all posterior draws gives the posterior density for the predicted probability that proposal j
passes.
The function runs in C++
.
The function can not (yet) obtain posterior predicted probabilities if the posterior includes a varying intercept.
matrix
object of size max(prpslid)
times niter(posterior) * nchain(posterior)
.
Marbach, Moritz. 2016. 'Analyzing Decision Records from Committees.” Working Paper.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ## Not run:
# Example 1: Using Simulated Data #
###########################
require(plyr)
set.seed(10)
J <- 250 # proposal
I <- 10 # actors
R <- 6 # majority threshold
# Simualte roll call voting record
beta <- c(0,0.4)
X <- data.frame(x0=1,x1=runif(J*I,-2,2))
y <- rbinom(J*I, 1, pnorm(as.matrix(X) %*% beta))
# Bundle data with IDs
data <- data.frame(gntid=sort(rep(seq(1,I), J)),
prpslid=rep(seq(1,J), I),
y, X)
# Generate decision record
data <- ddply(data, "prpslid" ,function(x) {
x$y.agg <- as.numeric(sum(x$y) >= R)
return(x)
})
# Estimate partial m-probit
m1 <- BayesPMP(formula=y.agg ~ x1,R=R, prpslid="prpslid", gntid="gntid", data=data)
# Simulate posterior predicted probability for first proposal (prpslid==1).
m1sim <- BayesSimPMP(m1, R=R, prpslid="prpslid", gntid="gntid",data=data[data$prpslid==1,])
hist(m1sim, breaks=100)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.