Description Usage Arguments Details Value References See Also Examples
predict.rrreg
is used to generate predicted probabilities from a
multivariate regression object of survey data using randomized response
methods.
1 2 3 4 
object 
An object of class "rrreg" generated by the 
given.y 
Indicator of whether to use "y" the response vector to
calculate the posterior prediction of latent responses. Default is

alpha 
Confidence level for the hypothesis test to generate upper and
lower confidence intervals. Default is 
n.sims 
Number of sampled draws for quasibayesian predicted
probability estimation. Default is 
avg 
Whether to output the mean of the predicted probabilities and
uncertainty estimates. Default is 
newdata 
Optional new data frame of covariates provided by the user. Otherwise, the original data frame from the "rreg" object is used. 
quasi.bayes 
Option to use Monte Carlo simulations to generate
uncertainty estimates for predicted probabilities. Default is 
keep.draws 
Option to return the Monte Carlos draws of the quantity of interest, for use in calculating differences for example. 
... 
Further arguments to be passed to 
This function allows users to generate predicted probabilities for the
randomized response item given an object of class "rrreg" from the
rrreg()
function. Four standard designs are accepted by this
function: mirrored question, forced response, disguised response, and
unrelated question. The design, already specified in the "rrreg" object, is
then directly inputted into this function.
predict.rrreg
returns predicted probabilities either for each
observation in the data frame or the average over all observations. The
output is a list that contains the following components:
est 
Predicted probabilities for the randomized response item
generated either using fitted values, posterior predictions, or
quasiBayesian simulations. If 
se 
Standard errors for the
predicted probabilities of the randomized response item generated using
Monte Carlo simulations. If 
ci.lower 
Estimates for the lower
confidence interval. If 
ci.upper 
Estimates
for the upper confidence interval. If 
qoi.draws 
Monte Carlos draws of the quantity of interest, returned
only if 
Blair, Graeme, Kosuke Imai and YangYang Zhou. (2014) "Design and Analysis of the Randomized Response Technique." Working Paper. Available at http://imai.princeton.edu/research/randresp.html.
rrreg
to conduct multivariate regression analyses in
order to generate predicted probabilities for the randomized response item.
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:
data(nigeria)
set.seed(1)
## Define design parameters
p < 2/3 # probability of answering honestly in Forced Response Design
p1 < 1/6 # probability of forced 'yes'
p0 < 1/6 # probability of forced 'no'
## Fit linear regression on the randomized response item of
## whether citizen respondents had direct social contacts to armed groups
rr.q1.reg.obj < rrreg(rr.q1 ~ cov.asset.index + cov.married + I(cov.age/10) +
I((cov.age/10)^2) + cov.education + cov.female,
data = nigeria, p = p, p1 = p1, p0 = p0,
design = "forcedknown")
## Generate the mean predicted probability of having social contacts to
## armed groups across respondents using quasiBayesian simulations.
rr.q1.reg.pred < predict(rr.q1.reg.obj, given.y = FALSE,
avg = TRUE, quasi.bayes = TRUE,
n.sims = 10000)
## Replicates Table 3 in Blair, Imai, and Zhou (2014)
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs in the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.