Description Usage Arguments Note Author(s) References Examples
This function provides cantonal estimates of public support based on MrP.
1 2  | mrp.zurich(response.model, augment.data = NA, augment.row = 0, uncertainty = FALSE, 
           Number.sim = 1000, output = 2)
 | 
response.model | 
 The output object of   | 
augment.data | 
 In case one uses survey data for the generation of   | 
augment.row | 
 Integer, between 1 and 26. Indicates the row or rows where the   | 
uncertainty | 
 Logical. If   | 
Number.sim | 
 Integer. Number of simulations to be run for uncertainty measure. Default is set to 1000.  | 
output | 
 Integer (0,1,2). Controls how much information is displayed. This option does not affect any functionality but only impacts on the amount of information which will be displayed.  | 
This function was written for a MA class at the University of Zurich (Fall 2013), see lecture by Fabio Wasserfallen on 11.29.2013 and the follow-up lecture by Lucas Leemann (12.13.2013).
Lucas Leemann
Jeffrey Lax and Justin Phillips. 2009. How Should We Estimate Public Opinion in The States? American Journal of Political Science 53 (1), 107-121.
Leemann, Lucas and Fabio Wasserfallen. 2013. Direct Democracy, Representation, and Policy Congruence. Presented at the General Conference of the European Political Science Association Barcelona: June 20-22.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  | ### Fake data
err.ind <- rnorm(1000,sd=4)
woman <- sample(c(0,1),replace=TRUE,size=1000) 
age <- sample(c(1:4),replace=TRUE,size=1000) 
education <- sample(c(1:6),replace=TRUE,size=1000) 
cantonnr <- sample(c(1:26),replace=TRUE,size=1000) 
region <- sample(c(1:7),replace=TRUE,size=1000) 
x <- rnorm(26); err.con <- rnorm(26,sd=4); X <- matrix(NA,1000,2)
for (q in 1:1000){ X[q,] <- c(x[cantonnr[q]],err.con[cantonnr[q]])}
y.fake <- X[,1] +X[,2] + woman+age+education+cantonnr+region + err.ind
y <- rep(0,length(y.fake))
y[y.fake>mean(y.fake)]<-1
model1 <- glmer(y ~ X[,1] + (1|woman)  + (1|education) + (1|age) + (1|cantonnr) 
                + (1|region), family=binomial(probit))
# now we can use the MrP function
mrp1 <- mrp.zurich(model1)
## Assume model1 would not have any repsondents from JU (cantonnr 26) and x[26]==2
mrp2 <- mrp.zurich(model1,augment.data=2,augment.row=26)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.