LMMstar-package: LMMstar package: repeated measurement models for discrete...

LMMstar-packageR Documentation

LMMstar package: repeated measurement models for discrete times


Companion R package for the course "Statistical analysis of correlated and repeated measurements for health science researchers" taught by the section of Biostatistics of the University of Copenhagen. It implements linear mixed models where the model for the variance-covariance of the residuals is specified via patterns (compound symmetry, toeplitz, unstructured, ...). Statistical inference for mean, variance, and correlation parameters is performed based on the observed information and a Satterthwaite approximation of the degrees of freedom. Normalized residuals are provided to assess model misspecification. Statistical inference can be performed for arbitrary linear or non-linear combination(s) of model coefficients. Predictions can be computed conditional to covariates only or also to outcome values.

Notations: the linear mixed model estimated by lmm is denoted:

\mathbf{Y}_{i} = \mathbf{X}_{i}β+\boldsymbol{\varepsilon}_i


  • \mathbf{Y}=(Y_1,…,Y_m): vector of outcomes.

  • \mathbf{X}=(X_1,…,X_p): design matrix (extractor: model.matrix.lmm).

  • \boldsymbol{\varepsilon}: vector of residuals with 0-mean and variance Ω_i (extractor: residuals.lmm).

  • β: estimated mean coefficients relative to X (extractor: coef.lmm).

  • Ω: the modeled variance-covariance of the residuals with diagonal elements σ^2_{j} (extractor: sigma.lmm).

  • i indexes the cluster (level where replicates are assumed independent).

  • j indexes the repetitions, e.g. the variance of \varepsilon_{ij} is σ^2_{ij}.

Covariance patterns: Ω can be parametrized as:

  • "ID": identity (no correlation, constant variance).

  • "IND": independent (no correlation, time-specific variance).

  • "CS": compound symmetry (constant correlation and variance). Can also be used to specify a nested random effect structure or a block specific correlation and variance.

  • "TOEPLITZ": toeplitz (lag-specific correlation, time-specific variance).

  • "UN": unstructured (time-specific correlation, time-specific variance).

It possible to stratify each structure with respect to a categorical variable.

Optimizer: the default optimizer, "FS", implements a fisher scoring algorithm descent with back-tracking in case of decreasing or undefined log-likelihood. It does not constrain Ω to be positive definite which may cause problem in small sample or complex models. It is possible to use other optimizer: nlme::gls for certain covariance patterns or stats::optim.

LMMstar documentation built on Jan. 7, 2023, 1:20 a.m.