RRlog(formula, data, model, p, group, n.response = 1, LR.test = TRUE, fit.n = 3, EM.max = 1000, optim.max = 500, ...)formuladata.frame, in which variables can be found (optional)"Warner", "UQTknown", "UQTunknown", "Mangat", "Kuk", "FR", "Crosswise", "CDM", "CDMsym", "SLD", "custom". See vignette("RRreg") for details.RRuni for details)CDM or SLD), use 1 and 2 to indicate the group membership, matching the respective randomization probabilities p[1], p[2]. If an RR design and a direct question (DQ) were both used in the study, the group indices are set to 0 (DQ) and 1 (RR; 1 or 2 for two-group RR designs). This can be used to test, whether the RR design leads to a different prevalence estimate by including a dummy variable for the question format (RR vs. DQ) as predictor. If the corresponding regression coefficient is significant, the prevalence estimates differ between RR and DQ. Similarly, interaction hypotheses can be tested (e.g., the correlation between a sensitive attribute and a predictor is only found using the RR but not the DQ design). Hypotheses like this can be tested by including the interaction of the DQ-RR-dummy variable and the predictor in formula (e.g., RR ~ dummy*predictor).p (either a single number if all participants give the same number of responses or a vector)fit.bound or the maximum number of fitting replication is reached. Thereby, stability of the estimates is increased. fit.bound should be increased if extreme parameter estimates are to be expected.EM.max=0, the EM algorithm is skipped.optimRRlog which can be analysed by the generic method summary
optim.
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
# generate data set without biases
dat <- RRgen(1000,pi=.3,"Warner",p=.9)
dat$covariate <- rnorm(1000)
dat$covariate[dat$true==1] <- rnorm(sum(dat$true==1),.4,1)
# analyse
ana <- RRlog(response~covariate,dat,"Warner", p=.9, fit.n = 1)
summary(ana)
# check with true, latent states:
glm(true~covariate, dat, family=binomial(link="logit"))
Run the code above in your browser using DataLab