RRuni | R Documentation |
Analyse a data vector response
with a specified RR model (e.g.,
Warner
) with known randomization probability p
RRuni(response, data, model, p, group = NULL, MLest = TRUE, Kukrep = 1)
response |
either vector of responses containing 0='no' and 1='yes' or
name of response variable in |
data |
optional |
model |
defines RR model. Available models: |
p |
randomization probability (see details or |
group |
a group vector of the same length as |
MLest |
whether to use |
Kukrep |
number of repetitions of Kuk's card-drawing method |
Each RR design model
differs in the definition of the
randomization probability p
, which is defined as a single probability
for
"Warner"
: Probability to get sensitive Question
"Mangat"
: Prob. for non-carriers to respond truthfully (i.e., with No=0)
"Crosswise"
: Probability to respond 'yes' to irrelevant second
question (coding of responses: 1=['no-no' or 'yes-yes']; 0=['yes-no' or 'no-yes'])
"Triangular"
: Probability to respond 'yes' to irrelevant second
question (coding of responses: 0='no' to both questions (='circle'); 1='yes'
to at least one question ('triangle'))
and as a two-valued vector of probabilities for
"Kuk"
: Probability of red cards in first and second set,
respectively (red=1, black=0);
Unrelated Question ("UQTknown"
): Prob. to respond to sensitive
question and known prevalence of 'yes' responses to unrelated question
Unrelated Question ("UQTunknown"
): Prob. to respond to
sensitive question in group 1 and 2, respectively
Cheating Detection ("CDM"
): Prob. to be prompted to say yes
in group 1 and 2, respectively
Symmetric CDM ("CDMsym"
): 4-valued vector: Prob. to be
prompted to say 'yes'/'no' in group 1 and 'yes'/'no' in group 2
Stochastic Lie Detector ("SLD"
): Prob. for noncarriers to
reply with 0='no' in group 1 and 2, respectively
Forced Response model ("FR"
): m-valued vector (m=number of
response categories) with the probabilities of being prompted to select
response categories 0,1,..,m-1, respectively (requires sum(p)<1
)
RR as misclassification ("custom"
): a quadratic misclassification
matrix is specified, where the entry p[i,j]
defines the
probability of responding i (i-th row) given a true state of j
(j-th column)) (see getPW
)
For the continuous RR models:
"mix.norm"
: 3-valued vector - Prob. to respond to sensitive
question and mean and SD of the masking normal distribution of the
unrelated question
"mix.exp"
: 2-valued vector - Prob. to respond to sensitive
question and mean of the masking exponential distribution of the
unrelated question
"mix.unknown"
: 2-valued vector - Prob. of responding to
sensitive question in group 1 and 2, respectively
an RRuni
object, can by analyzed by using summary
vignette('RRreg')
or
https://www.dwheck.de/vignettes/RRreg.html for a
detailed description of the RR models and the appropriate definition of p
# Generate responses of 1000 people according to Warner's model # with an underlying true proportion of .3 df <- RRgen(n = 1000, pi = .3, model = "Warner", p = .7) head(df) # Analyse univariate data to estimate prevalence 'pi' estimate <- RRuni(response = df$response, model = "Warner", p = .7) summary(estimate) # Generate data in line with the Stochastic Lie Detector # assuming that 90% of the respondents answer truthfully df2 <- RRgen( n = 1000, pi = .3, model = "SLD", p = c(.2, .8), complyRates = c(.8, 1), groupRatio = 0.4 ) estimate2 <- RRuni( response = df2$response, model = "SLD", p = c(.2, .8), group = df2$group ) summary(estimate2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.