Type: | Package |
Title: | Confidence Intervals for Robust and Classical Linear Mixed Model Estimators |
Version: | 1.0-2 |
Date: | 2025-06-20 |
Maintainer: | Fabio Mason <fabio.mason@unige.ch> |
Encoding: | UTF-8 |
Description: | The main function calculates confidence intervals (CI) for Mixed Models, utilizing both classical estimators from the lmer() function in the 'lme4' package and robust estimators from the rlmer() function in the 'robustlmm' package, as well as the varComprob() function in the 'robustvarComp' package. Three methods are available: the classical Wald method, the wild bootstrap, and the parametric bootstrap. Bootstrap methods offer flexibility in obtaining lower and upper bounds through percentile or BCa methods. More details are given in Mason, F., Cantoni, E., & Ghisletta, P. (2021) <doi:10.5964/meth.6607> and Mason, F., Cantoni, E., & Ghisletta, P. (2024) <doi:10.1037/met0000643>. |
License: | GPL-2 |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Depends: | R (≥ 3.5.0) |
Imports: | foreach, lme4, MASS, mvtnorm, tidyr, methods |
Suggests: | robustlmm (≥ 3.1-1), robustvarComp (≥ 0.1-7), lmerTest (≥ 3.1-3), xtable, ggplot2, parallel, doParallel |
LazyData: | true |
Packaged: | 2025-06-20 18:31:55 UTC; kollerma |
Author: | Fabio Mason [aut, cre], Manuel Koller [aut], Eva Cantoni [ctb, ths], Paolo Ghisletta [ths] |
Repository: | CRAN |
Date/Publication: | 2025-06-21 05:00:06 UTC |
Confidence Intervals for Robust and Classical Linear Mixed Model Estimators.
Description
Confidence Intervals (CIs) based on parametric and semi-parametric bootstrap (and Wald-type) for robust and classical Linear Mixed Models estimators.
Usage
confintROB(
object,
parm,
level = 0.95,
method = c("boot", "BCa", "Wald"),
nsim = 5000,
boot.type = c("wild", "parametric"),
clusterID,
verify.saved = NULL,
.export = NULL,
varComprob.data,
varComprob.random,
...
)
Arguments
object |
an object of class |
parm |
parameters for which intervals are sought. Specified by an integer vector of positions (see example) or a character vector of parameter names. Fixed effects parameters are ordered according their appearance in the formula. For the order of variance components, see argument |
level |
confidence level in ]0; 1[ |
method |
type of CIs: |
nsim |
number of bootstrap samples, positive integer |
boot.type |
type of bootstrap: |
clusterID |
text variable indicating the clustering variable. This is only required for method |
verify.saved |
check if an existing CI is already computed. Only for the vignette examples |
.export |
passed on to |
varComprob.data |
a data frame object used to fit the original model. This is only required for the |
varComprob.random |
text variable describing the random effect structure as it would be written with |
... |
additional arguments passed on to |
Details
Implements the classical Wald-type CI, the parametric and the wild bootstrap (Modugno & Giannerini, 2013) for linear mixed models estimated with the robust estimators in rlmer
(Koller, 2016; Koller & Stahel, 2022) and
varComprob
(Agostinelli & Yohai, 2016) and the classical estimators in lmer
(Bates et al., 2013). For bootstrap methods, percentile, Bias-Corrected, and accelerated (BCa) versions are available. All these versions are tested in Mason, Cantoni & Ghisletta (2021, 2024).
confintROB
computes 5 types of CIs based on arguments method
and boot.type
.
method
:
- "Wald"
: CIs computation is based on standard error estimates
- "boot"
: CIs are computed using the respective percentile of estimates obtained on bootstrap sample(s) based on the confidence level
- "BCa"
: based on the Jacknife method, the Bias-Corrected and accelerated parameters are computed on the original sample to correct estimates obtained from the bootstrap sample(s)
boot.type
(for method
s "boot"
and "BCa"
):
- "parametric"
: the classical parametric bootstrap scheme is used to create bootstrap sample(s)
- "wild"
: the semi-parametric bootstrap scheme is used to create bootstrap sample(s)
Value
a numeric table (matrix with column and row names) of CIs.
References
Agostinelli, C., & Yohai, V. J. (2016). Composite robust estimators for linear mixed models. Journal of the American Statistical Association, 111 (516), 1764-1774. doi:10.1080/01621459.2015.1115358
Bates, D., Machler, M., Bolker, B., & Walker, S. (2015). Fitting linear mixed-effects models using lme4. Journal of Statistical Software, 67 (1), 1-48. doi: 10.18637/jss.v067.i01
Koller, M. (2016). robustlmm: An R package for robust estimation of linear mixed-effects models. Journal of Statistical Software, 75 (6), 1-24. doi: 10.18637/jss.v075.i06
Koller, M., & Stahel, W. A. (2022). Robust estimation of general linear mixed effects models. In P. M. Yi & P. K. Nordhausen (Eds.), Robust and multivariate statistical methods. Springer Nature Switzerland AG.
Mason, F., Cantoni, E., & Ghisletta, P. (2021). Parametric and semi-parametric bootstrap-based confidence intervals for robust linear mixed models. Methodology, 17 (4), 271-295. doi: 10.5964/meth.6607
Mason, F., Cantoni, E., & Ghisletta, P. (2024). Linear mixed models and latent growth curve models for group comparison studies contaminated by outliers. Psychological methods. doi: 10.1037/met0000643
Modugno, L., & Giannerini, S. (2013). The wild bootstrap for multilevel models. Communications in Statistics - Theory and Methods, 44 (22), 4812-4825. doi: 10.1080/03610926.2013.80280
See Also
Examples
if (require(robustlmm)) {
model.RSE <- rlmer(Reaction ~ 1 + Days + (Days|Subject),
data = sleepstudy)
CI.RSE <- confintROB(model.RSE, level = .95, boot.type = "wild",
parm = c(1,2), # indicates that only CIs
# for the intercept and Days are asked.
nsim = 10) # small nsim for speed, in practice use, e.g., 5000
print(CI.RSE)
}
The medication data set
Description
Often used for didactic purposes (Singer & Willett, 2003), and originally discussed in Tomarken, Shelton, Elkins, and Anderson (1997). During seven days, three times a day (from time = 0 to time = 6.667), a sample of n = 64 adults (identified by the variable id) were randomly assigned to either a treatment group (treat=1) or a control group (treat=0) and were required to report their mood (pos).
Usage
data(medication)
Format
'medication' a data.frame with 5 columns and 1242 rows:
- obs
row number
- id
participant number
- treat
treatment assignment, 1= treatment; 0= control
- time
time from 0 to 6.667, with increments of 0.333
- pos
the positive mood score
References
Tomarken, A. J., Shelton, R. C., Elkins, L., & Anderson, T. (1997). Sleep deprivation and anti-depressant medication: unique effects on positive and negative affect. In American Psychological Society Meeting, Washington, DC.
The simulated data set ispired by the medication example
Description
A simulated dataset
Usage
data(medsim)
Format
'medsim' a data.frame with 5 columns and 420 rows:
- obs
row number
- id
participant number
- time
time in waves from 0 to 18, with increments of 3
- treat
treatment assignment, 1= treatment; 0= control
- pos
the positive mood score