predict.rrreg {rr}R Documentation

Predicted Probabilities for Randomized Response Regression

Description

predict.rrreg is used to generate predicted probabilities from a multivariate regression object of survey data using randomized response methods.

Usage

## S3 method for class 'rrreg'
predict(object, given.y = FALSE, alpha = .05, n.sims =
1000, avg = FALSE, newdata = NULL, quasi.bayes = FALSE, keep.draws = FALSE,
...)

Arguments

object

An object of class "rrreg" generated by the rrreg() function.

given.y

Indicator of whether to use "y" the response vector to calculate the posterior prediction of latent responses. Default is FALSE, which simply generates fitted values using the logistic regression.

alpha

Confidence level for the hypothesis test to generate upper and lower confidence intervals. Default is .05.

n.sims

Number of sampled draws for quasi-bayesian predicted probability estimation. Default is 1000.

avg

Whether to output the mean of the predicted probabilities and uncertainty estimates. Default is FALSE.

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 FALSE.

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 predict.rrreg() command.

Details

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.

Value

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 quasi-Bayesian simulations. If avg is set to TRUE, the output will only include the mean estimate.

se

Standard errors for the predicted probabilities of the randomized response item generated using Monte Carlo simulations. If quasi.bayes is set to FALSE, no standard errors will be outputted.

ci.lower

Estimates for the lower confidence interval. If quasi.bayes is set to FALSE, no confidence interval estimate will be outputted.

ci.upper

Estimates for the upper confidence interval. If quasi.bayes is set to FALSE, no confidence interval estimate will be outputted.

qoi.draws

Monte Carlos draws of the quantity of interest, returned only if keep.draws is set to TRUE.

References

Blair, Graeme, Kosuke Imai and Yang-Yang Zhou. (2014) "Design and Analysis of the Randomized Response Technique." Working Paper. Available at http://imai.princeton.edu/research/randresp.html.

See Also

rrreg to conduct multivariate regression analyses in order to generate predicted probabilities for the randomized response item.

Examples


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 = "forced-known")

## Generate the mean predicted probability of having social contacts to 
## armed groups across respondents using quasi-Bayesian 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)


[Package rr version 1.4.2 Index]