MyNixOS website logo
Description

Bootstrap Methods for Nested Linear Mixed-Effects Models.

Bootstrap routines for nested linear mixed effects models fit using either 'lme4' or 'nlme'. The provided 'bootstrap()' function implements the parametric, residual, cases, random effect block (REB), and wild bootstrap procedures. An overview of these procedures can be found in Van der Leeden et al. (2008) <doi: 10.1007/978-0-387-73186-5_11>, Carpenter, Goldstein & Rasbash (2003) <doi: 10.1111/1467-9876.00415>, and Chambers & Chandra (2013) <doi: 10.1080/10618600.2012.681216>.

lmeresampler

R-CMD-check CRAN_Status_Badge CRAN_Downloads_Badge

The lme4 and nlme packages have made fitting nested linear mixed-effects models quite easy. Using the functionality of these packages we can easily use maximum likelihood or restricted maximum likelihood to fit our model and conduct inference using our parametric toolkit. In practice, the assumptions of our model are often violated to such a degree that leads to biased estimators and incorrect standard errors. In these situations, resampling methods such as the bootstrap can be used to obtain consistent estimators of the bias and standard errors for inference. lmeresampler provides an easy way to bootstrap nested linear-mixed effects models using the parametric, residual, cases, wild, or random effects block (REB) bootstraps fit using either lme4 or nlme. The output from lmeresampler is an lmeresamp object. Moreover, the lmeresampler package has its own print(), summary(), confint(), and plot() functions. All of these functions follow the syntax of generic print(), summary(), confint(), and plot() functions; thus, the commands may be used with lmeresamp objects.

Installation

You can install the latest released version from CRAN with:

install.packages("lmeresampler")

or the latest development version from GitHub:

if(!require(devtools)) install.packages("devtools")
devtools::install_github("aloy/lmeresampler")

Usage

Below is a short example of how to execute a parametric bootstrap for models fit either by lme4 or by nlme. For a complete guide outlining the purpose of lmeresampler, the structure of lmeresamp objects, each of the bootstrap types, how to implement parallelization with bootstrap() calls, directions for future developers, and examples, please see the package vignette, available on the lmeresampler website.

First, fit the necessary model(s) with the LME package of your choice. Here we show the same model fit first with lme4, then with nlme:

library(lmeresampler)

library(lme4)
vcmodA <- lmer(mathAge11 ~ mathAge8 + gender + class + (1 | school), data = jsp728)

library(nlme)
vcmodB <- lme(mathAge11 ~ mathAge8 + gender + class, random = ~1|school, data = jsp728)

Now, to perform a parametric bootstrap, first specify the model to be used, then the function to return the parameters of interest, then type = "parametric, and finally, the number of bootstrap resamples to be computed:

# let's set .f = fixef to specify that we want only the fixed effects bootstrapped

# lme4
lmer_par_boot <- bootstrap(vcmodA, .f = fixef, type = "parametric", B = 100)

# nlme
lme_par_boot  <- bootstrap(vcmodB, .f = fixef, type = "parametric", B = 100)

The four other bootstrap types (residual, cases, wild, and REB) may be executed in a similar way, with some minor changes.

References

A full list of references may be found in the package vignette.

Metadata

Version

0.2.4

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows