BayesSimPMP: Simulates Posterior Predicted Probabilities for Proposal...

Description Usage Arguments Details Value References Examples

Description

BayesSimPMP simulates posterior predicted probabilities for an estimated partial m-probit using Monte Carlo.

Usage

1
2
3
4
BayesSimPMP(posterior, data, prpslid, gntid, R, V = NULL, qweights = NULL,
  pweights = NULL, qvote = NULL, pvote = NULL, pslct = NULL,
  qslct = NULL, method = "mc", NSIM = 500, verbose = 500, seed = NULL,
  postSamp = NULL, postMean = FALSE)

Arguments

posterior

(required) a posterior object from BayesPMP(). Can have multiple chains.

data

(required) a data.frame object that contains all RHS variables used in the formula to obtain posterior using BayesPMP().

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 n_distinct(prpslid) or a single number.

V

the number of veto members that have to agree to pass a proposal. Can can be a vector of length n_distinct(prpslid) or a single number. The function assumes that the first V members in the data are the once with veto power. That is, after sorting the data for each proposal by gntid the first V entries are used as they belong to members with with veto power.

NSIM

integer. The number of Monte Carlo simulations to run.

verbose

integer number: use 0 for no output; use any positive natural number to report progress at each verbose-th iteration.

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 data that identifies groups of proposals for which a varying intercept should be estimated.

q/pweights

integer matrix of dimension M x T where T is the number of distinct voting weights. The vote weights sorted by gntid.

q/pvote

scalar or integer vector of length J. The threshold for the vote weights.

q/pslct

integer vector of length J. Each entry refers to the applicable column in the q/pweights for a particular proposal j.

Details

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.

Value

matrix object of size max(prpslid) times niter(posterior) * nchain(posterior).

References

Marbach, Moritz. 2016. 'Analyzing Decision Records from Committees.” Working Paper.

Examples

 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)

sumtxt/consilium documentation built on May 30, 2019, 8:38 p.m.