Learn R Programming

RRreg (version 0.4.1)

RRuni: Univariate analysis of randomized response data

Description

Analyse a data vector response with a specified RR model (e.g., Warner) with known randomization probability p

Usage

RRuni(response, data, model, p, group = NULL, MLest = TRUE)

Arguments

response
either vector of responses containing 0='no' and 1='yes' or name of response variable in data. In Kuk's card playing method (Kuk), the observed response variable gives the number of red cards. For the Forced Response (FR
data
optional data.frame containing the response variable
model
defines RR model. Available models: "Warner", "UQTknown", "UQTunknown", "Mangat", "Kuk","FR", "Crosswise", "CDM", "CDMsym", "SLD"
p
randomization probability defined as a single probability for
  • Warner: Probabiltiy to get sensitive Question
  • Mangat: Prob. for noncarriers to respond truthfully (i.e., with No=0)
  • Crosswise: Prevalence of 'yes' responses for unrelat
group
a group vector of the same length as response containing values 1 or 2, only required for two-group models, which specify different randomization probabilities for two groups, e.g., CDM or SLD. If a data.frame
MLest
if TRUE, least-squares estimates of pi outside of [0,1] are corrected to obtain maximum likelihood estimates

Value

  • an RRuni object, can by analyzed by using summary

See Also

vignette('RRreg') or https://dl.dropboxusercontent.com/u/21456540/RRreg/index.html for a detailed description of the RR models and the appropriate definition of p

Examples

Run this code
# Generate responses of 1000 people according to Warner's model
# with an underlying true proportion of .3
genData <- RRgen(n=1000, pi=.3, model="Warner", p=.7)
# Analyse univariate data to estimate 'pi'
analyse <- RRuni(response=genData$response, model="Warner", p=.7)
summary(analyse)

# Generate data in line with the Stochastic Lie Detector
# assuming that 90\% of the respondents answer truthfully
genData2 <- RRgen(n=1000, pi=.3, model="SLD", p=c(.2,.8),
                  complyRates=c(.8,1),groupRatio=0.4)
analyse2 <- RRuni(response=genData2$response, model="SLD",
                  p=c(.2,.8), group=genData2$group)
summary(analyse2)

Run the code above in your browser using DataLab