RankTest: Calculates the Rank of the Aggregate Design Matrix

Description Usage Arguments Details References Examples

Description

RankTest calcualtes the rank of the aggregate design matrix of a dataset

Usage

1
RankTest(formula, data, prpslid, gntid, getAggData = FALSE, ...)

Arguments

formula

(required) a formula object of the form y | b ~ x1 + ... xK. All x and b must be without missing values. Intercept is included automatically. For each proposal, the b vector must be identical across actors. y | is optional supplying known vote choices for a proposal. Only used if all votes for a proposal are none-missing.

data

(required) a data.frame object that contains all data used in the formula and the variables specified in prpslid and gntid.

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 actor in the data.

getAggData

if TRUE the aggregate design matrix is returned

Details

This function is useful to evaluate a necessary condition for parameteric identification of the partial m-probit model.

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
 ## Not run: 

	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)
 		})

  RankTest(formula=y.agg ~ x1, data=data, prpslid="prpslid", gntid="gntid")  

## End(Not run)

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