tune_lucid: Wrapper for LUCID Model and Penalty Tuning

tune_lucidR Documentation

Wrapper for LUCID Model and Penalty Tuning

Description

Fit a grid of LUCID models over candidate numbers of latent clusters K and (optionally) L1 penalties Rho_G, Rho_Z_Mu, and Rho_Z_Cov. The input format for K differs by lucid_model. For "early", use an integer vector (for example, 2:4). For "parallel", use a list of vectors/integers, one per layer (for example, list(2:3, 2:3, 2)). For "serial", use a nested list as required by the serial model.

Usage

tune_lucid(
  G,
  Z,
  Y,
  CoG = NULL,
  CoY = NULL,
  family = c("normal", "binary"),
  K,
  lucid_model = c("early", "parallel", "serial"),
  Rho_G = 0,
  Rho_Z_Mu = 0,
  Rho_Z_Cov = 0,
  verbose_tune = FALSE,
  ...
)

Arguments

G

Exposures, a numeric vector, matrix, or data frame. Categorical variables should be transformed into dummy variables.

Z

Omics data. If "early", an N by M matrix. If "parallel", a list of matrices (same N). If "serial", a list matching the serial model structure.

Y

Outcome, a numeric vector. Binary outcomes should be coded as 0/1.

CoG

Optional covariates for the G-to-X model.

CoY

Optional covariates for the X-to-Y model.

family

Outcome family: "normal" or "binary".

K

Candidate latent-cluster values in model-specific format.

lucid_model

LUCID model type: "early", "parallel", or "serial".

Rho_G

Scalar or vector penalty for exposure coefficients in the G-to-X model. CoG covariates are included unpenalized. Vector tuning is supported for "early" and "parallel". For "serial", only scalar inputs are supported.

Rho_Z_Mu

Scalar or vector penalty for cluster-specific Z means. Vector tuning is supported for "early" and "parallel". For "serial", only scalar inputs are supported.

Rho_Z_Cov

Scalar or vector penalty for cluster-specific Z covariance matrices. Vector tuning is supported for "early" and "parallel". For "serial", only scalar inputs are supported.

verbose_tune

Logical; print tuning progress if TRUE.

...

Additional arguments passed to estimate_lucid.

Value

A list containing the tuning table, fitted models, and the selected optimal model. Returned element names differ slightly by model:

  • "early": best_model, tune_list, res_model

  • "parallel"/"serial": model_opt, tune_K, model_list

Examples

## Not run: 
G <- sim_data$G
Z <- sim_data$Z
Y <- sim_data$Y_normal
tune_early <- tune_lucid(G = G, Z = Z, Y = Y, lucid_model = "early", K = 2:3)
tune_rho <- tune_lucid(
  G = G, Z = Z, Y = Y, lucid_model = "early", K = 2,
  Rho_G = c(0, 0.1), Rho_Z_Mu = c(0, 5), Rho_Z_Cov = c(0, 0.1)
)

## End(Not run)

LUCIDus documentation built on March 11, 2026, 9:06 a.m.

Related to tune_lucid in LUCIDus...