Description Usage Arguments Value See Also Examples
Fit a generalized linear mixed-effects model (GLMM) with binary Randomized Response data.
Both fixed effects and random effects are specified via the model formula.
Randomize response parameters can be entered either as single values or as vectors.
Implemented as a wrapper for glmer
. Reference: Fox, J-P, Veen, D. and Klotzke, K. (2018).
Generalized Linear Mixed Models for Randomized Responses. Methodology. https://doi.org/10.1027/1614-2241/a000153
1 2 3 4 5 6 7 8 9 10 11 12 |
formula |
a two-sided linear formula object describing both the fixed-effects and fixed-effects part of the model, with the response on the left of a ~ operator and the terms, separated by + operators, on the right. Random-effects terms are distinguished by vertical bars ("|") separating expressions for design matrices from grouping factors. |
item |
optional item identifier for long-format data. |
link |
a glm link function for binary outcomes. Must be a function name. Available options: "RRlink.logit", "RRlink.probit", "RRlink.cloglog" and "RRlink.cauchit" |
RRmodel |
the Randomized Response model, defined per case. Available options: "DQ", "Warner", "Forced", "UQM", "Crosswise", "Triangular" and "Kuk" |
p1 |
the Randomized Response parameter p1, defined per case. Must be 0 <= p1 <= 1. |
p2 |
the Randomized Response parameter p2, defined per case. Must be 0 <= p2 <= 1. |
data |
a data frame containing the variables named in |
control |
a list (of correct class, resulting from |
na.action |
a function that indicates what should happen when the data contain NAs.
The default action ( |
... |
other potential arguments to be passed to |
An object of class RRglmerMod. Extends the class glmerMod
with Randomize Response data,
for which many methods are available (e.g. methods(class="glmerMod")
).
1 2 3 4 5 6 7 8 9 | # Fit the model with fixed effects for gender, RR and pp
# and a random effect for age using the logit link function.
# The Randomized Response parameters p1, p2 and model
# are specified for each observation in the dataset.
out <- RRglmer(response ~ Gender + RR + pp + (1|age), link="RRlink.logit", RRmodel=RRmodel,
p1=RRp1, p2=RRp2, data=Plagiarism, na.action = "na.omit",
etastart = rep(0.01, nrow(Plagiarism)),
control = glmerControl(optimizer = "Nelder_Mead", tolPwrss = 1e-03), nAGQ = 1)
summary(out)
|
Loading required package: lme4
Loading required package: Matrix
RRglmer(formula = "response~Gender+RR+pp+age", link = "RRlink.logit",
RRmodel = RRmodel, p1 = RRp1, p2 = RRp2, data = Plagiarism,
control = glmerControl(optimizer = "Nelder_Mead", tolPwrss = 0.001),
na.action = "na.omit", ... = pairlist(etastart = rep(0.01,
nrow(Plagiarism)), nAGQ = 1))
Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) [glmerMod]
Family: binomial ( RRlogit )
Formula: response ~ Gender + RR + pp + (1 | age)
Data: df
Control:
structure(list(optimizer = c("Nelder_Mead", "Nelder_Mead"), calc.derivs = TRUE,
use.last.params = FALSE, restart_edge = FALSE, boundary.tol = 1e-05,
tolPwrss = 0.001, compDev = TRUE, nAGQ0initStep = TRUE, checkControl = structure(list(
check.nobs.vs.rankZ = "ignore", check.nobs.vs.nlev = "stop",
check.nlev.gtreq.5 = "ignore", check.nlev.gtr.1 = "stop",
check.nobs.vs.nRE = "stop", check.rankX = "message+drop.cols",
check.scaleX = "warning", check.formula.LHS = "stop",
check.response.not.const = "stop"), .Names = c("check.nobs.vs.rankZ",
"check.nobs.vs.nlev", "check.nlev.gtreq.5", "check.nlev.gtr.1",
"check.nobs.vs.nRE", "check.rankX", "check.scaleX", "check.formula.LHS",
"check.response.not.const")), checkConv = structure(list(
check.conv.grad = structure(list(action = "warning",
tol = 0.001, relTol = NULL), .Names = c("action",
"tol", "relTol")), check.conv.singular = structure(list(
action = "message", tol = 1e-04), .Names = c("action",
"tol")), check.conv.hess = structure(list(action = "warning",
tol = 1e-06), .Names = c("action", "tol"))), .Names = c("check.conv.grad",
"check.conv.singular", "check.conv.hess")), optCtrl = list()), .Names = c("optimizer",
"calc.derivs", "use.last.params", "restart_edge", "boundary.tol",
"tolPwrss", "compDev", "nAGQ0initStep", "checkControl", "checkConv",
"optCtrl"), class = c("glmerControl", "merControl"))
AIC BIC logLik deviance df.resid
816.3 839.7 -403.1 806.3 797
Scaled residuals:
Min 1Q Median 3Q Max
-1.6814 -0.3004 0.5965 0.7068 10.2851
Random effects:
Groups Name Variance Std.Dev.
age (Intercept) 0.1367 0.3697
Number of obs: 802, groups: age, 20
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -4.9643 1.0004 -4.962 6.97e-07 ***
Gender 0.1016 0.5177 0.196 0.84437
RR 1.3503 0.5088 2.654 0.00796 **
pp 2.1542 0.9203 2.341 0.01924 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Correlation of Fixed Effects:
(Intr) Gender RR
Gender -0.326
RR -0.213 0.012
pp -0.845 0.081 -0.110
### GLMMRR - Binary Randomized Response Data ###
Generalized linear mixed-effects model
Family: binomial
Link function: RRlogit
---------------------------------------------------------
Item: Single item
Model(s): Crosswise (0.25 | 0)
DQ (1.00 | 0)
## Estimated Population Prevalence (weighted per RR model)
RRmodel estimate.weighted se.weighted n
Crosswise 0.115635 0.037257 614
DQ 0.037234 0.013809 188
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.