RRlin | R Documentation |

Linear regression for a continuous criterion, using randomized-response (RR) variables as predictors.

RRlin( formula, data, models, p.list, group = NULL, Kukrep = 1, bs.n = 0, nCPU = 1, maxit = 1000, fit.n = 3, pibeta = 0.05 )

`formula` |
a continuous criterion is predicted by one or more categorical
RR variables defined by |

`data` |
an optional data frame, list or environment, containing the variables in the model. |

`models` |
character vector specifying RR model(s) in order of appearance
in formula. Available models: |

`p.list` |
list of randomization probabilities for RR models in the same
order as specified in |

`group` |
vector or matrix specifying group membership by the indices 1
and 2. Only for multigroup RR models, e.g., |

`Kukrep` |
defines the number of repetitions in Kuk's card playing method |

`bs.n` |
Number of samples used for the non-parametric bootstrap |

`nCPU` |
only relevant for the bootstrap: either the number of CPU cores
or a cluster initialized via |

`maxit` |
maximum number of iterations in optimization routine |

`fit.n` |
number of fitting runs with random starting values |

`pibeta` |
approximate ratio of probabilities pi to regression weights beta (to adjust scaling). Can be used for speeding-up and fine-tuning ML estimation (i.e., choosing a smaller value for larger beta values). |

Returns an object `RRlin`

which can be analysed by the generic
method `summary`

Daniel W. Heck

van den Hout, A., & Kooiman, P. (2006). Estimating the linear
regression model with categorical covariates subject to randomized
response. *Computational Statistics & Data Analysis, 50*, 3311-3323.

`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 two RR predictors dat <- RRgen(n = 500, pi = .4, model = "Warner", p = .3) dat2 <- RRgen(n = 500, pi = c(.4, .6), model = "FR", p = c(.1, .15)) dat$FR <- dat2$response dat$trueFR <- dat2$true # generate a third predictor and continuous dependent variables dat$nonRR <- rnorm(500, 5, 1) dat$depvar <- 2 * dat$true - 3 * dat2$true + .5 * dat$nonRR + rnorm(500, 1, 7) # use RRlin and compare to regression on non-RR variables linreg <- RRlin(depvar ~ response + FR + nonRR, data = dat, models = c("Warner", "FR"), p.list = list(.3, c(.1, .15)), fit.n = 1 ) summary(linreg) summary(lm(depvar ~ true + trueFR + nonRR, data = dat))

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.