MyNixOS website logo
Description

Fit Latent Multivariate Mixed Effects Location Scale Models.

In addition to modeling the expectation (location) of an outcome, mixed effects location scale models (MELSMs) include submodels on the variance components (scales) directly. This allows models on the within-group variance with mixed effects, and between-group variances with fixed effects. The MELSM can be used to model volatility, intraindividual variance, uncertainty, measurement error variance, and more. Multivariate MELSMs (MMELSMs) extend the model to include multiple correlated outcomes, and therefore multiple locations and scales. The latent multivariate MELSM (LMMELSM) further includes multiple correlated latent variables as outcomes. This package implements two-level mixed effects location scale models on multiple observed or latent outcomes, and between-group variance modeling. Williams, Martin, Liu, and Rast (2020) <doi:10.1027/1015-5759/a000624>. Hedeker, Mermelstein, and Demirtas (2008) <doi:10.1111/j.1541-0420.2007.00924.x>.

LMMELSM

LMMELSM stands for latent, multidimensional mixed effects location scale models.

The mixed effects location scale model is a multilevel model in which both the location ($\mu$) and scale ($\sigma$) are modeled and have random effects. That is, in addition to random intercepts and coefficients, the MELSM allows variance to differ between groups, and across covariates. Within the MELSM framework, variances are meaningful, and can be directly modeled. MELSMs are useful for predicting volatility, variance, uncertainty, variation between group means, measurement error variance, and much more. As an added side effect, prediction intervals are tailored to each individual or group (differing predictive uncertainty), and fixed effects are more robust because those with less variance (more reliability) are implicitly weighted more.

LMMELSM extends the MELSM to include latent variables. Instead of predicting the expected values and variances of observed or computed variables, the LMMELSM predicts expected values and variances of multiple correlated latent factors. Assuming an adequate measurement model, the LMMELSM therefore models the variance of a reduced-error score.

LMMELSM is therefore useful for modeling conditional and group-specific latent means and variances. One such example is modeling the intraindividual variability of latent scores of a persons over time in an experience sampling methodology. Another example is modeling the heterogeneity of individuals' latent means from person-level covariates.

LMMELSM currently supports:

  • Observed outcomes
  • Latent outcomes
  • Single or multiple outcomes
  • Location modeling, with random intercepts and coefficients
  • Within-group scale modeling, with random intercepts and coefficients
  • Between-group scale modeling (on the between-group mean variances)

Installation

You can install the released version of LMMELSM from github with:

remotes::install_github("stephensrmmartin/LMMELSM")

Example

In this example, increasingly complex MELSMs are modeled, and demonstrate the simple formula syntax.

library(LMMELSM)

data(sim_data)

# Intercept-only model
fit <- lmmelsm(Agreeableness ~ A_1 + A_2 + A_3 + A_4 + A_5 + A_6, subject, sim_data)

# Random Time-varying predictor on location
fit <- lmmelsm(list(Agreeableness ~ A_1 + A_2 + A_3 + A_4 + A_5 + A_6,
                    location ~ x1 | x1),
               subject, sim_data)

# Random Time-varying predictors on both location and scale
fit <- lmmelsm(list(Agreeableness ~ A_1 + A_2 + A_3 + A_4 + A_5 + A_6,
                    location ~ x1 | x1,
                    scale ~ x2 | x2),
               subject, sim_data)

# Time-varying predictors, person-level predictors on location, scale, and between-group variance
# Multidimensional!
fit <- lmmelsm(list(Agreeableness ~ A_1 + A_2 + A_3 + A_4 + A_5 + A_6,
                    Neuroticism ~ N_1 + N_2 + N_3 + N_4 + N_5 + N_6,
                    location ~ x1 + baseline | x1,
                    scale ~ x2 + baseline | x2,
                    between ~ baseline),
               subject, sim_data)

# Time-varying predictors, person-level predictors on location, scale, and between-group variance
fit <- lmmelsm(list(Agreeableness ~ A_1 + A_2 + A_3 + A_4 + A_5 + A_6,
                    Neuroticism ~ N_1 + N_2 + N_3 + N_4 + N_5 + N_6,
                    location ~ x1 + baseline | x1,
                    scale ~ x1 + x2 + baseline | x1 + x2,
                    between ~ baseline),
               subject, sim_data)


# Non-latent Multivariate MELSM
fit <- lmmelsm(list(observed ~ A_1 + N_1,
                    location ~ x1 + baseline|x1,
                    scale ~ x2 + baseline|x2,
                    between ~ baseline),
               subject, sim_data)

# Summarize
summary(fit)

# Get subject-specific random effects
ranef(fit)

# Get subject-specific coefficients
coef(fit)

Metadata

Version

0.2.0

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