RRuni {RRreg}R Documentation

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, Kukrep = 1)

Arguments

response

either vector of responses containing 0='no' and 1='yes' or name of response variable in data. For the Forced Response (FR) model, response values are integers from 0 to (m-1), where 'm' is the number of response categories. In Kuk's card playing method (Kuk), the observed response variable gives the number of red cards.

data

optional data.frame containing the response variable

model

defines RR model. Available models: "Warner", "UQTknown", "UQTunknown", "Mangat", "FR", "Kuk","Crosswise", "Triangular", "CDM", "CDMsym", "SLD", "mix.norm", "mix.exp","mix.unknown", or "custom". See argument p or type vignette('RRreg') for detailed specifications.

p

randomization probability (see details or vignette("RRreg"))

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 data is provided, the variable group is searched within it.

MLest

whether to use optim to get ML instead of moment estimates (only relevant if pi is outside of [0,1])

Kukrep

number of repetitions of Kuk's card-drawing method

Details

Each RR design model differs in the definition of the randomization probability p, which is defined as a single probability for

and as a two-valued vector of probabilities for

For the continuous RR models:

Value

an RRuni object, can by analyzed by using summary

See Also

vignette('RRreg') or https://www.dwheck.de/vignettes/RRreg.html for a detailed description of the RR models and the appropriate definition of p

Examples

# 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)


[Package RRreg version 0.7.5 Index]