Description Usage Arguments Details Value Author(s) References Examples
This function generates a sample from the posterior distribution of the measurement model of political support. Individuallevel covariates may be included in the model. The details of the model are given under ‘Details’. See also Bullock et al. (2011).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  endorse(Y, data, data.village = NA, village = NA, treat = NA,
na.strings = 99, identical.lambda = TRUE,
covariates = FALSE, formula.indiv = NA,
hierarchical = FALSE, formula.village = NA, h = NULL,
group = NULL, x.start = 0, s.start = 0,
beta.start = 1, tau.start = NA, lambda.start = 0,
omega2.start = .1, theta.start = 0, phi2.start = .1,
kappa.start = 0, psi2.start = 1, delta.start = 0,
zeta.start = 0, rho2.start = 1, mu.beta = 0, mu.x = 0,
mu.theta = 0, mu.kappa = 0, mu.delta = 0, mu.zeta = 0,
precision.beta = 0.04, precision.x = 1,
precision.theta = 0.04, precision.kappa = 0.04,
precision.delta = 0.04, precision.zeta = 0.04,
s0.omega2= 1, nu0.omega2 = 10, s0.phi2 = 1,
nu0.phi2 = 10, s0.psi2 = 1, nu0.psi2 = 10,
s0.sig2 = 1, nu0.sig2 = 400, s0.rho2 = 1,
nu0.rho2 = 10, MCMC = 20000, burn = 1000, thin = 1,
mh = TRUE, prop = 0.001, x.sd = TRUE,
tau.out = FALSE, s.out = FALSE, omega2.out = TRUE,
phi2.out = TRUE, psi2.out = TRUE, verbose = TRUE,
seed.store = FALSE, update = FALSE,
update.start = NULL)

Y 
a list of the variable names for the responses. It should take the following form:
If 
data 
data frame containing the individuallevel variables.
The cases must be complete, i.e., no 
data.village 
data frame containing the villagelevel variables.
The cases must be complete, i.e., no 
village 
character. The variable name of the village indicator in the individuallevel data. If auxiliary information is included, this should correspond to the variable name of the units at which prediction is desired. 
treat 
An optional matrix of non negative integers indicating
the treatment
status of each observation and each question.
Rows are observations
and columns are questions. 0 represents the control status while
positive integers indicate treatment statuses.
If 
na.strings 
a scalar or a vector indicating the values of the
response variable that are to be interpreted as “Don't Know” or
“Refused to Answer.” The value should not be 
identical.lambda 
logical. If 
covariates 
logical. If 
formula.indiv 
a symbolic description specifying the individual level
covariates for the support parameter and the ideal points. The formula
should be onesided, e.g. 
hierarchical 
logical. IF 
formula.village 
a symbolic description specifying the village level covariates for the support parameter and the ideal points. The formula should be onesided. 
h 
Auxiliary data functionality. Optional named numeric vector with length equal to number of groups. Names correspond to group labels and values correspond to auxiliary moments (i.e. to the known share of the sensitive trait at the group level). 
group 
Auxiliary data functionality. Optional character string.
The variable name of the group indicator in the individuallevel data
(e.g. 
x.start 
starting values for the ideal points vector x. If

s.start 
starting values for the support parameter, s_ijk.
If 
beta.start 
starting values for the question related parameters,
α_j and β_j.
If 
tau.start 
starting values for the cut points in the response
model. If 
lambda.start 
starting values for the coefficients in the
support parameter model, lambda_jk.
If 
omega2.start 
starting values for the variance of the support
parameters, omega_{jk}^2.
If set to a scalar, the starting values for
omega_{jk}^2 will be the diagonal matrix with
the diagonal elements set to the scalar.
If 
theta.start 
starting values for the means of the
lambda_jk for each endorser.
If 
phi2.start 
starting values for the covariance matrices of the
coefficients
of the support parameters, Phi_k.
Phi_k is assumed to be a diagonal matrix.
If 
kappa.start 
starting values for the coefficients on village level covariates in the
support parameter model, kappa_k.
If 
psi2.start 
starting values for the variance of the village random intercepts in the support
parameter model, psi_{k}^2.
If 
delta.start 
starting values for the coefficients on individual level covariates in the ideal
point model. Will be used only if 
zeta.start 
starting values for the coefficients on village level covariates in the ideal
point model. Will be used only if 
rho2.start 
numeric. starting values for the variance of the village random intercepts in the ideal point
model, rho^2. The default is 
mu.beta 
the mean of the independent Normal prior on the
question related parameters. Can be either a scalar or a matrix of
dimension the number of questions times 2.
The default is 
mu.x 
the mean of the independent Normal prior on the
question related parameters. Can be either a scalar or a vector of
the same length as the number of observations.
The default is 
mu.theta 
the mean of the independent Normal prior on the
mean of the coefficients in the support parameter model.
Can be either a scalar or a vector of
the same length as the dimension of covariates.
The default is 
mu.kappa 
the mean of the independent Normal prior on the
coefficients of village level covariates. Can be either a scalar or a matrix of
dimension the number of covariates times the number of endorsers.
If auxiliary information is included, the value of 
mu.delta 
the mean of the independent Normal prior on the
the coefficients in the ideal point model.
Can be either a scalar or a vector of
the same length as the dimension of covariates.
The default is 
mu.zeta 
the mean of the independent Normal prior on the
the coefficients of village level covariates in the ideal point model.
Can be either a scalar or a vector of
the same length as the dimension of covariates.
The default is 
precision.beta 
the precisions (inverse variances) of the
independent Normal prior on the
question related parameters. Can be either a scalar or
a 2 by 2 diagonal matrix.
The default is 
precision.x 
scalar. The known precision of the
independent Normal distribution on the
ideal points.
The default is 
precision.theta 
the precisions of the
independent Normal prior on the means of the coefficients
in the support parameter model. Can be either a scalar or
a vector of the same length as the dimension of covariates.
The default is 
precision.kappa 
the precisions of the
independent Normal prior on the coefficients of village level covariates
in the support parameter model. Can be either a scalar or
a vector of the same length as the dimension of covariates.
If auxiliary information is included, the value of 
precision.delta 
the precisions of the
independent Normal prior on the the coefficients
in the ideal point model. Can be either a scalar or
a square matrix of the same dimension as the dimension of
covariates.
The default is 
precision.zeta 
the precisions of the
independent Normal prior on the the coefficients of village level covariates
in the ideal point model. Can be either a scalar or
a square matrix of the same dimension as the dimension of
covariates.
The default is 
s0.omega2 
scalar. The scale of the independent scaled
inverse chisquared
prior for the variance parameter in the support parameter model.
If auxiliary information is included, the value of 
nu0.omega2 
scalar. The degrees of freedom of the independent
scaled inversechisquared
prior for the variance parameter in the support parameter model.
If auxiliary information is included, the value of 
s0.phi2 
scalar. The scale of the independent
scaled inversechisquared
prior for the variances of the coefficients in
the support parameter model.
The default is 
nu0.phi2 
scalar. The degrees of freedom of the independent
scaled
inversechisquared
prior for the variances of the coefficients in
the support parameter model.
The default is 
s0.psi2 
scalar. The scale of the independent
scaled inversechisquared
prior for the variances of the village random intercepts in
the support parameter model.
The default is 
nu0.psi2 
scalar. The degrees of freedom of the independent
scaled
inversechisquared
prior for the variances of the village random intercepts in
the support parameter model.
The default is 
s0.sig2 
scalar. The scale of the independent
scaled inversechisquared
prior for the variance parameter in
the ideal point model.
The default is 
nu0.sig2 
scalar. The degrees of freedom of the independent
scaled
inversechisquared
prior for the variance parameter in the ideal point model.
The default is 
s0.rho2 
scalar. The scale of the independent
scaled inversechisquared
prior for the variances of the village random intercepts in
the ideal point model.
The default is 
nu0.rho2 
scalar. The degrees of freedom of the independent
scaled
inversechisquared
prior for the variances of the village random intercepts in
the ideal point model.
The default is 
MCMC 
the number of iterations for the sampler. The default is

burn 
the number of burnin iterations for the sampler. The
default is 
thin 
the thinning interval used in the simulation. The default
is 
mh 
logical. If 
prop 
a positive number or a vector consisting of positive
numbers. The length of the vector should be the same as the number of
questions. This argument sets proposal variance for the
MetropolisHastings algorithm in sampling the cut points of the
response model. The default is 
x.sd 
logical. If 
tau.out 
logical. A switch that determines whether or not to
store the cut points in the response model. The default is

s.out 
logical. If 
omega2.out 
logical. If 
phi2.out 
logical. If 
psi2.out 
logical. If 
verbose 
logical. A switch that determines whether or not to
print the progress of the chain and Metropolis acceptance ratios for
the cut points of the response model. The default is

seed.store 
logical. If 
update 
logical. If 
update.start 
list. If the function is run to update a chain, the output
object of the previous run should be supplied. The default is 
The model takes the following form:
Consider an endorsement experiment where we wish to measure the level of support for K political actors. In the survey, respondents are asked whether or not they support each of J policies chosen by researchers. Let Y_{ij} represent respondent i's answer to the survey question regarding policy j. Suppose that the response variable Y_{ij} is the ordered factor variable taking one of L_{j} levels, i.e., Y_{ij} \in \{0, 1, …, L_{j}  1\} where L_{j} > 1. We assume that a greater value of Y_{ij} indicates a greater level of support for policy j. We denote an M dimensional vector of the observed characteristics of respondent i by Z_i.
In the experiment, we randomly assign one of K political actors as an endorser to respondent i's question regarding policy j and denote this treatment variable by T_{ij} \in \{0,1,…,K\}. We use T_{ij}=0 to represent the control observations where no political endorsement is attached to the question. Alternatively, one may use the endorsement by a neutral actor as the control group.
The model for the response variable, Y_{ij}, is given by,
Y_ij = l if τ_l < Ystar_ij ≤ τ_(l+1),
Ystar_ij  T_ij = k ~ N( α_j + β_j (x_i + s_(ij, T_ij)), I)
where l \in \{0, 1, …, L_{j} \}, τ_{0} = ∞ < τ_{1} = 0 < τ_{2} < … < τ_{L_{j}} = ∞. β_j's are assumed to be positive.
The model for the support parameter, s_{ijk}, is given by if T_{ij} \neq 0,
s_ijk ~ N(Z_i^T λ_jk, ω_jk^2)
with covariates, and
s_ijk ~ N(λ_jk, ω_jk^2)
without covariates, for j = 1, …, J, \; k = 1, …, K, and if T_ij = 0, s_ijk = 0.
The λ's in the support parameter model are modeled in the following hierarchical manner,
λ_jk ~ N(θ_k, Φ_k)
for k = 1, …, K.
If you set identical.lambda = FALSE
and hierarchical = TRUE
,
the model for s_{ijk} is if T_{ij} \neq 0,
s_ijk ~ N(λ^{0}_{jk, village[i]} + Z_i^T λ_jk, ω_jk^2)
and
lambda^{0}_{jk, village[i]} ~ N( V_village[i]^T κ_jk, ψ_jk^2)
for k = 1, …, K and j = 1, …, J. In addition, λ and κ are modeled in the following hierarchical manner,
λ*_jk ~ N(θ_k, Φ_k)
for k = 1, …, K, where λ^{*}_{jk} = (λ^{T}_{jk}, κ^{T}_{jk})^{T}.
If you set identical.lambda = TRUE
and hierarchical = TRUE
,
the model for s_{ijk} is if T_{ij} \neq 0,
s_ijk ~ N(λ^{0}_{k, village[i]} + Z_i^T λ_k, ω_k^2)
and
lambda^{0}_{k, village[i]} ~ N( V_village[i]^T κ_k, ψ_k^2)
for k = 1, …, K.
If the covariates are included in the model, the model for the ideal points is given by
x_i ~ N(Z_i^T δ, σ_x^2)
for i = 1, …, N where σ_x^2 is a known prior variance.
If you set hierarchical = TRUE
,
the model is
x_i ~ N(δ^{0}_village[i] + Z_i^T δ, σ^2)
and
delta^{0}_{village[i]} ~ N( V_village[i]^T ζ, ρ^2)
for k = 1, …, K.
Finally, the following independent prior distributions are placed on unknown parameters,
α_j ~ N(μ_α, σ_α^2)
for j = 1, …, J,
β_j ~ TN_{β_j > 0}(μ_β, σ_β^2)
for j = 1, …, J,
δ ~ N(μ_δ, Σ_δ),
θ_k \sim \mathcal{N}(μ_θ, Σ_θ)
for k = 1, …, K,
ω_jk^2 ~ Invχ^2(ν_ω^0, s_ω^0)
for j = 1, …, J and k = 1, …, K, and
diag(Φ_k) ~ Invχ^2(ν_Φ^0, s_Φ^0)
for k = 1, …, K, where Φ_k is assumed to be a diagonal matrix.
An object of class "endorse"
, which is a list containing the following
elements:
beta 
an 
x 
If 
s 
If

delta 
If 
tau 
If 
lambda 
an mcmc object. A sample from the posterior distribution of lambda. Variable names are:

theta 
an mcmc object. A sample from the posterior distribution of theta. 
kappa 
an mcmc object. 
zeta 
an mcmc object. 
Note that the posterior sample of all parameters are NOT standardized. In making posterior inference, each parameter should be divided by the standard deviation of x (in the default setting, it is given as "x") or by sigma (in the default setting, it is given as "sigma2").
Also note that alpha and the intercept in delta (or, if the model is hierarchical, the intercept in zeta) are not identified. Instead,
 alpha + beta * delta_0
or, if the model is hierarchical,
 alpha + beta * zeta_0
is identified after either of the above standardization, where delta_0 and zeta_0 denote the intercepts.
When using the auxiliary data functionality, the following objects are included:
aux 
logical value indicating whether estimation incorporates auxiliary moments 
nh 
integer count of the number of auxiliary moments 
Kosuke Imai, Department of Politics, Princeton University [email protected], http://imai.princeton.edu
Yuki Shiraito, Department of Politics, Princeton University [email protected].
Bullock, Will, Kosuke Imai, and Jacob N. Shapiro. (2011) “Statistical Analysis of Endorsement Experiments: Measuring Support for Militant Groups in Pakistan,” Political Analysis, Vol. 19, No. 4 (Autumn), pp.363384.
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61  ## Not run:
data(pakistan)
Y < list(Q1 = c("Polio.a", "Polio.b", "Polio.c", "Polio.d", "Polio.e"),
Q2 = c("FCR.a", "FCR.b", "FCR.c", "FCR.d", "FCR.e"),
Q3 = c("Durand.a", "Durand.b", "Durand.c", "Durand.d",
"Durand.e"),
Q4 = c("Curriculum.a", "Curriculum.b", "Curriculum.c",
"Curriculum.d", "Curriculum.e"))
## Varyinglambda nonhierarchical model without covariates
endorse.out < endorse(Y = Y, data = pakistan, identical.lambda = FALSE,
covariates = FALSE, hierarchical = FALSE)
## Varyinglambda nonhierarchical model with covariates
indiv.covariates < formula( ~ female + rural)
endorse.out < endorse(Y = Y, data = pakistan, identical.lambda = FALSE,
covariates = TRUE,
formula.indiv = indiv.covariates,
hierarchical = FALSE)
## Commonlambda nonhierarchical model with covariates
indiv.covariates < formula( ~ female + rural)
endorse.out < endorse(Y = Y, data = pakistan, identical.lambda = TRUE,
covariates = TRUE,
formula.indiv = indiv.covariates,
hierarchical = FALSE)
## Varyinglambda hierarchical model without covariates
div.data < data.frame(division = sort(unique(pakistan$division)))
div.formula < formula(~ 1)
endorse.out < endorse(Y = Y, data = pakistan, data.village = div.data,
village = "division", identical.lambda = FALSE,
covariates = FALSE, hierarchical = TRUE,
formula.village = div.formula)
## Varyinglambda hierarchical model with covariates
endorse.out < endorse(Y = Y, data = pakistan, data.village = div.data,
village = "division", identical.lambda = FALSE,
covariates = TRUE,
formula.indiv = indiv.covariates,
hierarchical = TRUE,
formula.village = div.formula)
## Commonlambda hierarchical model without covariates
endorse.out < endorse(Y = Y, data = pakistan, data.village = div.data,
village = "division", identical.lambda = TRUE,
covariates = FALSE, hierarchical = TRUE,
formula.village = div.formula)
## Commonlambda hierarchical model with covariates
endorse.out < endorse(Y = Y, data = pakistan, data.village = div.data,
village = "division", identical.lambda = TRUE,
covariates = TRUE,
formula.indiv = indiv.covariates,
hierarchical = TRUE,
formula.village = div.formula)
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.