Package 'confintROB'

Title: Confidence Intervals for Robust and Classical Linear Mixed Model Estimators
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>.
Authors: Fabio Mason [aut, cre], Manuel Koller [aut], Eva Cantoni [ctb, ths], Paolo Ghisletta [ths]
Maintainer: Fabio Mason <[email protected]>
License: GPL-2
Version: 1.0-1
Built: 2025-03-04 03:17:05 UTC
Source: https://github.com/cran/confintROB

Help Index


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 lmerMod, rlmerMod or varComprob

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 order of the varCorr function from package lme4. By default, the CIs of all the parameters of the model are computed.

level

confidence level in ]0; 1[

method

type of CIs: "Wald", "boot", "BCa"

nsim

number of bootstrap samples, positive integer

boot.type

type of bootstrap: "wild" or "parametric"

clusterID

text variable indicating the clustering variable. This is only required for method "BCa" or for boot.type "wild" for varComprob objects. This vector is used to identify the level of the "cluster" to which these resampling methods should be applied and is not included in the varComprob objects.

verify.saved

check if an existing CI is already computed. Only for the vignette examples

.export

passed on to foreach

varComprob.data

a data frame object used to fit the original model. This is only required for the varComprob objects

varComprob.random

text variable describing the random effect structure as it would be written with lmer from lme4. This is only required for the varComprob objects

...

additional arguments passed on to lmer (if applicable)

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 methods "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

lmer rlmer varComprob

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