simulate_lmmelsm: Simulate data from latent uni/multidimensional MELSM

View source: R/simulate.R

simulate_lmmelsmR Documentation

Simulate data from latent uni/multidimensional MELSM

Description

Simulate data from latent uni/multidimensional MELSM

Usage

simulate_lmmelsm(
  n,
  K,
  lambda,
  resid,
  nu,
  mu_beta = NULL,
  logsd_beta = NULL,
  P_random_ind = NULL,
  Q_random_ind = NULL,
  mu_logsd_betas_cor,
  mu_logsd_betas_sigma,
  epsilon_cor,
  zeta = NULL,
  X_loc = NULL,
  X_sca = NULL,
  X_bet = NULL,
  L2_pred_only = FALSE
)

Arguments

n

Integer. Number of repeated observations per group.

K

Integer. Number of groups.

lambda

Matrix (FxJ). Loading matrix.

resid

Numeric vector (J). Residual SDs.

nu

Numeric vector (J). Intercepts.

mu_beta

Matrix (PxF). Location coefficient matrix.

logsd_beta

Matrix (QxF). Scale coefficient matrix.

P_random_ind

Integer vector (P_random). Which location predictors have random slopes.

Q_random_ind

Integer vector (Q_random). Which scale predictors have random slopes.

mu_logsd_betas_cor

Matrix (Symmetric, SPD; F2 + P_randomF + Q_random*F). Correlation matrix of random effects (slopes and intercepts, for location and scale models).

mu_logsd_betas_sigma

Numeric vector (Positive; F2 + P_randomF + Q_random*F). RE SDs (intercepts on exponentiated scale, if zeta is specified).

epsilon_cor

Matrix (Symmetric, SPD; F). Stochastic error term correlation between factors.

zeta

Matrix (Rx[F*2 + P_random*F + Q_random*F]). Coefficient matrix for predicting RE SDs.

X_loc

Matrix (Optional; NxP). Location design matrix.

X_sca

Matrix (Optional; NxQ). Scale design matrix.

X_bet

Matrix (Optional; NxR). Between-SD design matrix.

L2_pred_only

Logical. Whether predictors should be group-level (TRUE) or observation level (FALSE).

Value

List of params (list), data (list), and df (data.frame).

Author(s)

Stephen R. Martin


LMMELSM documentation built on Dec. 28, 2022, 1:32 a.m.