RRsimu(numRep, n, pi, model, p, cor = 0, b.log = 0, complyRates = c(1, 1),
sysBias = c(0, 0), method = c("RRuni", "RRcor", "RRlog", "RRlin"),
alpha = 0.05, groupRatio = 0.5, MLest = TRUE, getPower = TRUE,
nCPU = 1)vector)vector), see RRunilist)RRcor). Can also be used to generate data with two dichotomous RR variables.RRlog)list)RRgenbeta"SLD") (for 2 RR variables: vector)RRuni if pi is outside of [0,1]method="RRcor" (performs an additional bootstrap assuming independence)parEsts a matrix containing the estimated parameters
results a matrix with mean parameters, standard errors, and number of samples to which the respective method could not be fitted
power a vector with the estimated power of the selected randomized response proceduresb.log is the slope-coefficient for the true, latent values in a logistic regression model that is used for data generation.
The argument cor is used for data generation for linear models. The directly measured covariate is sampled from a normal distribution with shifted means, depending on the true state on the sensitive attribute (i.e., the true, underlying values on the RR variable). For dichotomous RR variables, this corresponds to the assumption of an ordinary t-test, where the dependent variable is normally distributed within groups with equal variance. The difference in means is chosen in a way, to obtain the point-biserial correlation defined by cor.
Two RR variables:
cor has to be used. In case of two dichotomous RR variables, the true group membership of individuals is sampled from a 2x2 cross table. Within this table, probabilities are chosen in a way, to obtain the point-tetrachoric correlation defined by cor
Note, that for the FR model with multiple response categories (e.g., from 0 to 4), the specified cor is not the exact target of the sampling procedure. It assumes a normal distribution for each true state, with constant differences between the groups (i.e., it assumes an interval scaled variable).# Not run: Simulate data according to the Warner model
# mcsim <- RRsimu(numRep=100, n=300, pi=.4, model="Warner", p=.2, cor=.3)
# print(mcsim)Run the code above in your browser using DataLab