robust.lmer | R Documentation |
This function estimates a multilevel and linear mixed-effects model based on
a robust estimation method using the rlmer()
function from the
robustlmm package that down-weights observations depending on robustness
weights computed by robustification of the scoring equations and an application
of the Design Adaptive Scale (DAS) approach.
robust.lmer(model, method = c("DAStau", "DASvar"),setting = c("RSEn", "RSEa"),
digits = 2, p.digits = 3, write = NULL, append = TRUE, check = TRUE,
output = TRUE)
model |
a fitted model of class |
method |
a character string indicating the method used for estimating
theta and sigma, i.e., |
setting |
a character string indicating the setting for the parameters
used for computing the robustness weights, i.e., |
digits |
an integer value indicating the number of decimal places to be used. |
p.digits |
an integer value indicating the number of decimal places to be used for displaying p-value. |
write |
a character string naming a file for writing the output into
either a text file with file extension |
append |
logical: if |
check |
logical: if |
output |
logical: if |
The function
rlmer
from the robustlmm package is specified much like the
function lmer
from the lme4 package
, i.e., a formula object
and data frame is specified as the first and second argument. However, the
robust.lmer
function requires a fitted "lmerMod"
or
"lmerModLmerTest"
that is used to re-estimate the model using the
robust estimation method. Note that the function rlmer
provides
the additional arguments rho.e
, rho.b
, rho.sigma.e
,
rho.sigma.b
, rel.tol
, max.iter
, verbose
,
doFit
, init
, and initTheta
that are not supported by
the robust.lmer
function. See help page of the rlmer()
function
in the R package robustlmm
for more details.
The function rlmer
from the robustlmm package does not provide
any degrees of freedom or significance values. When specifying a "lmerModLmerTest"
object for the argument model
, the robust.lmer
function uses the
Satterthwaite or Kenward-Roger degrees of freedom from the "lmerModLmerTest"
object to compute significance values for the regression coefficients based on
parameter estimates and standard error of the robust multilevel mixed-effects
(see Sleegers et al. (2021).
Returns an object of class misty.object
, which is a list with following
entries:
call |
function call |
type |
type of analysis |
model |
object returned from the |
args |
specification of function arguments |
result |
list with results, i.e., |
Takuya Yanagida takuya.yanagida@univie.ac.at
Koller, M. (2016). robustlmm: An R Package for Robust Estimation of Linear Mixed-Effects Models. Journal of Statistical Software, 75(6), 1–24. https://doi.org/10.18637/jss.v075.i06
coeff.robust
, summa
## Not run:
# Load lme4, lmerTest, and misty package
misty::libraries(lme4, lmerTest, misty)
# Load data set "Demo.twolevel" in the lavaan package
data("Demo.twolevel", package = "lavaan")
#----------------------------------------------------------------------------
# Multilevel and Linear Mixed-Effects Model
# Cluster-mean centering, center() from the misty package
Demo.twolevel <- center(Demo.twolevel, x2, type = "CWC", cluster = "cluster")
# Grand-mean centering, center() from the misty package
Demo.twolevel <- center(Demo.twolevel, w1, type = "CGM", cluster = "cluster")
# Estimate two-level mixed-effects model
mod.lmer2 <- lmer(y1 ~ x2.c + w1.c + x2.c:w1.c + (1 + x2.c | cluster), data = Demo.twolevel)
# Example 1a: Default setting
mod.lmer2r <- robust.lmer(mod.lmer2)
# Example 1b: Extract robustness weights
mod.lmer2r$result$weight$iresid
mod.lmer2r$result$weight$iranef
#----------------------------------------------------------------------------
# Write Results
# Example 2a: Write results into a text file
robust.lmer(mod.lmer2, write = "Robust_lmer.txt", output = FALSE)
# Example 2b: Write results into a Excel file
robust.lmer(mod.lmer2, write = "Robust_lmer.xlsx", output = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.