This tutorial is designed as a hands-on, end-to-end
guide for fitting LUCID models on HELIX-style multi-omics data,
with a binary outcome. Its companion vignette,
lucid_3models_normal_outcome.Rmd, walks through the
identical pipeline step by step for a continuous
outcome, including the lucid() tuning wrapper, missing-data
diagnostics, and prediction/g-computation – material this vignette does
not repeat. Visualization (Sankey diagram, cluster omics profiles) is
shown here too, since neither depends on the outcome family.
What you will learn here:
G, Z,
Y_binary, CoG, CoY) from one
dataset.Rho_* > 0) for
selection.Rho_* = 0) for stable inference +
bootstrap CI.predict_lucid()’s response argument
controls whether a binary outcome comes back as class labels or as
probabilities.Important runtime note:
K and do the screen-then-refit by
hand, mirroring the continuous-outcome companion vignette’s
early/parallel/serial sections.K fixed and use small bootstrap R
so the vignette remains reproducible and fast.The HELIX example data (simulated_HELIX_data.rda)
provides:
phenotype: exposure/covariate/outcome-style
variables.methylome,
transcriptome, miRNA.Model inputs used throughout:
G: exposure matrix (main predictors of latent cluster
assignment). Built with a known signal structure – three exposures
correlated with the outcome and six pure-noise exposures – so that
feature selection can be checked against the truth rather than taken on
trust. The outcome itself is deliberately kept out of
G.Z: omics input (matrix for early, list for parallel,
nested list for serial mixed).Y: continuous outcome vector; Y_binary is
its median split, used to demonstrate the binary outcome model on the
same subjects.CoG: covariates for G -> X model.CoY: covariates for X -> Y model.| Hyperparameter | Meaning | Tutorial choice and rationale |
|---|---|---|
K |
number of latent clusters | fixed to small values for speed and interpretability |
Rho_G |
penalty on G -> X coefficients |
positive in screening fit, zero in inference refit |
Rho_Z_Mu |
penalty on cluster-specific omics means | positive in screening fit, zero in inference refit |
Rho_Z_Cov |
penalty on omics covariance matrices | positive in screening fit, zero in inference refit |
max_itr, max_tot.itr,
tol |
EM controls | modest values to balance speed/stability |
family |
outcome model family | normal for this tutorial |
seed |
reproducibility | fixed before each fit/bootstrap |
# Keep knitting on error, so that one failing step reports itself and the rest of
# the tutorial still runs. The status table in section 13 records what happened.
knitr::opts_chunk$set(error = TRUE)
# Lightweight registry so the document can verify itself rather than relying on
# the reader to notice a missing output.
.reg <- new.env(parent = emptyenv()); .reg$rows <- list()
check_obj <- function(name, expected_class = NULL, section = "") {
ok <- exists(name, envir = globalenv())
cls <- if (ok) class(get(name, envir = globalenv()))[1] else NA_character_
status <- if (!ok) "MISSING"
else if (!is.null(expected_class) && !identical(cls, expected_class)) "unexpected class"
else "ok"
.reg$rows[[length(.reg$rows) + 1L]] <-
data.frame(section = section, object = name, class = cls,
status = status, stringsAsFactors = FALSE)
invisible(NULL)
}
library(LUCIDus)
# The HELIX simulation object bundled with the package.
data(simulated_HELIX_data)This chunk creates a compact tutorial dataset and deliberately injects both:
so we can observe missing-data handling in summaries.
# Use a smaller subset for vignette speed while preserving model behavior.
idx <- 1:90
ph <- simulated_HELIX_data$phenotype[idx, ]
n <- nrow(ph)
set.seed(2026)
# ---------------------------------------------------------------------------
# A tutorial dataset with a KNOWN answer.
#
# The HELIX omics matrices are real simulated data with their own structure, and
# the exposures shipped with them have no relationship to it. That is fine for
# demonstrating that code runs, but it makes feature selection impossible to
# judge: there is no right answer to compare against. So we plant one.
#
# The generating story, which is the DAG LUCID assumes:
#
# causal exposures -> latent subgroup -> omics profile
# -> outcome
#
# Three exposures carry the subgroup signal with graded strength; six are pure
# noise. Half the features of each omics layer are shifted by subgroup
# membership; the rest are left as they came. Selection therefore has an
# unambiguous target, and the tutorial can check its answer instead of asserting
# it.
# ---------------------------------------------------------------------------
# The true latent subgroup. Retained so every selection claim below can be
# checked against it.
x_true <- rbinom(n, 1, 0.5)
# Exposures. g_causal_* predict subgroup membership; g_noise_* do not.
# Effect sizes are deliberately moderate. Stronger exposures make selection
# look better but drive the G -> X model to saturation, where every subject sits
# at posterior probability 1 and no counterfactual shift can move anything --
# which would make the g-computation demonstration in the continuous-outcome
# companion vignette vacuous.
G <- cbind(
g_causal_1 = 1.0 * (x_true - 0.5) + rnorm(n, sd = 0.8), # strongest
g_causal_2 = -0.8 * (x_true - 0.5) + rnorm(n, sd = 0.8), # moderate, negative
g_causal_3 = 0.6 * (x_true - 0.5) + rnorm(n, sd = 0.8), # weakest
g_noise_1 = rnorm(n), g_noise_2 = rnorm(n), g_noise_3 = rnorm(n),
g_noise_4 = rnorm(n), g_noise_5 = rnorm(n), g_noise_6 = rnorm(n)
)
G <- as.matrix(scale(G))
causal_exposures <- c("g_causal_1", "g_causal_2", "g_causal_3")
# Exposure penalty used throughout. The continuous-outcome companion vignette
# shows what this value recovers and sweeps it, along with the omics penalty,
# separately.
RHO_G <- 0.05
# Covariates for G->X (CoG) and X->Y (CoY).
# Here we use age-related and sex covariates from phenotype.
CoG <- cbind(
hs_child_age_yrs_None = as.numeric(ph$hs_child_age_yrs_None),
sex_male = as.numeric(ph$e3_sex_None == "male")
)
CoY <- CoG
# Two outcomes on the SAME subjects, so the normal and binary results below are
# directly comparable: the only thing that changes between them is the outcome
# model, not the sample, the omics, or the injected missingness.
#
# Continuous outcome: the real CK-18 measurement, plus a subgroup effect so the
# cluster -> outcome arm of the model has something to estimate.
Y <- as.numeric(ph$ck18_scaled) + 1.2 * x_true
# Binary outcome: median split. The median is used rather than a higher
# threshold because it splits these 90 subjects 45/45, and a balanced outcome
# gives the K = 2 outcome model the most to work with at this sample size.
Y_binary <- as.integer(Y > median(Y))
cat("binary outcome balance:\n"); print(table(Y_binary))## binary outcome balance:
## Y_binary
## 0 1
## 45 45
# Construct three omics layers and standardize each, then plant the subgroup
# signal in the first three features of every layer. The remaining seven per
# layer are left as they came and act as omics noise.
meth <- scale(simulated_HELIX_data$methylome[idx, 1:10, drop = FALSE])
tran <- scale(simulated_HELIX_data$transcriptome[idx, 1:10, drop = FALSE])
mir <- scale(simulated_HELIX_data$miRNA[idx, 1:10, drop = FALSE])
signal_features <- 1:3
omics_shift <- 3.0
meth[, signal_features] <- meth[, signal_features] + omics_shift * x_true
tran[, signal_features] <- tran[, signal_features] - omics_shift * x_true
mir[, signal_features] <- mir[, signal_features] + omics_shift * x_true
# Column positions of the signal features once the layers are stacked for the
# early model, so selection can be scored against them later.
signal_cols_early <- c(signal_features,
ncol(meth) + signal_features,
ncol(meth) + ncol(tran) + signal_features)
# Early model uses one combined Z matrix.
Z_early <- cbind(meth, tran, mir)
# Parallel model uses list-of-layers.
Z_parallel <- list(methylome = meth, transcriptome = tran, miRNA = mir)
# Inject listwise + sporadic missingness for demonstration.
Z_early_miss <- Z_early
Z_early_miss[1, ] <- NA # listwise row
Z_early_miss[2:4, 1] <- NA # sporadic block
Z_early_miss[5, 3] <- NA # sporadic cell
Z_parallel_miss <- Z_parallel
Z_parallel_miss[[1]][1, ] <- NA # listwise in layer 1
Z_parallel_miss[[2]][2, 2] <- NA # sporadic in layer 2
Z_parallel_miss[[3]][3, 1] <- NA # sporadic in layer 3
# Quick structural sanity check.
str(list(
G = G,
CoG = CoG,
CoY = CoY,
Y = Y,
Z_early = Z_early_miss,
Z_parallel = Z_parallel_miss
), max.level = 1)## List of 6
## $ G : num [1:90, 1:9] 1.587 1.051 -0.744 0.168 0.834 ...
## ..- attr(*, "dimnames")=List of 2
## ..- attr(*, "scaled:center")= Named num [1:9] -0.0377 0.0866 0.0539 -0.0695 0.1933 ...
## .. ..- attr(*, "names")= chr [1:9] "g_causal_1" "g_causal_2" "g_causal_3" "g_noise_1" ...
## ..- attr(*, "scaled:scale")= Named num [1:9] 1.053 0.864 0.732 1.038 1.211 ...
## .. ..- attr(*, "names")= chr [1:9] "g_causal_1" "g_causal_2" "g_causal_3" "g_noise_1" ...
## $ CoG : num [1:90, 1:2] 7.48 7.21 8.59 8.48 6.06 ...
## ..- attr(*, "dimnames")=List of 2
## $ CoY : num [1:90, 1:2] 7.48 7.21 8.59 8.48 6.06 ...
## ..- attr(*, "dimnames")=List of 2
## $ Y : num [1:90] 1.817 1.67 0.479 -0.281 0.394 ...
## $ Z_early : num [1:90, 1:30] NA NA NA NA 3.17 ...
## ..- attr(*, "dimnames")=List of 2
## $ Z_parallel:List of 3
These helpers implement a robust refit pipeline:
G/Z inputs.# get_selected_G()/get_selected_Z() (from the package itself) already return a
# well-shaped, aligned logical mask straight from the fitted object -- no
# length mismatch is possible, since they derive it from the model's own
# recorded fields. The one thing left for a tutorial to decide is what to do
# if a penalty happened to deselect EVERY feature: refitting on zero columns
# would fail, so this keeps everything instead in that one edge case.
keep_or_all <- function(mask) if (any(mask, na.rm = TRUE)) mask else rep(TRUE, length(mask))
# Build selected-only inputs for early model.
prepare_early_selected_inputs <- function(fit_pen, G, Z) {
list(
G = as.matrix(G[, keep_or_all(get_selected_G(fit_pen)), drop = FALSE]),
Z = as.matrix(Z[, keep_or_all(get_selected_Z(fit_pen)), drop = FALSE])
)
}
# Build selected-only inputs for parallel model.
prepare_parallel_selected_inputs <- function(fit_pen, G, Z) {
keep_g <- keep_or_all(get_selected_G(fit_pen))
Z_sel <- lapply(seq_along(Z), function(i) {
zi <- as.matrix(Z[[i]])
zi[, keep_or_all(get_selected_Z(fit_pen, layer = i)), drop = FALSE]
})
names(Z_sel) <- names(Z)
list(
G = as.matrix(G[, keep_g, drop = FALSE]),
Z = Z_sel
)
}
# Serial stage>1 uses latent-cluster-derived "G" internally.
# We therefore subset stage-1 original G and each stage's Z where applicable.
prepare_serial_selected_inputs <- function(fit_pen, G, Z) {
G_refit <- as.matrix(G)
keep_g1 <- get_selected_G(fit_pen)
if (length(keep_g1) == ncol(G_refit)) {
G_refit <- G_refit[, keep_or_all(keep_g1), drop = FALSE]
}
selected_z <- get_selected_Z(fit_pen)
Z_refit <- Z
for (i in seq_along(fit_pen$submodel)) {
sm <- fit_pen$submodel[[i]]
if (inherits(sm, "early_lucid")) {
zi <- as.matrix(Z_refit[[i]])
Z_refit[[i]] <- zi[, keep_or_all(selected_z[[i]]), drop = FALSE]
} else if (inherits(sm, "lucid_parallel")) {
zi_list <- Z_refit[[i]]
for (j in seq_along(zi_list)) {
zij <- as.matrix(zi_list[[j]])
zi_list[[j]] <- zij[, keep_or_all(selected_z[[i]][[j]]), drop = FALSE]
}
Z_refit[[i]] <- zi_list
}
}
list(G = G_refit, Z = Z_refit)
}
# Zero-penalty refit, for any model type.
#
# The three model types previously had three byte-identical wrappers differing
# only in `lucid_model` and whether `useY` was forwarded; they are one function
# here. Everything about the model -- family, K, initialization, EM controls --
# is carried over from the screening fit, so the ONLY difference between the
# screening fit and this one is that the penalties are zero. That is what makes
# the refit estimates unshrunk and therefore suitable for bootstrap inference.
refit_selected <- function(model_type, fit_pen, inputs, Y,
CoG = NULL, CoY = NULL, seed = 1, verbose = FALSE) {
args <- list(
lucid_model = model_type,
G = inputs$G,
Z = inputs$Z,
Y = Y,
CoG = CoG,
CoY = CoY,
family = fit_pen$family,
K = fit_pen$K,
init_omic.data.model = fit_pen$init_omic.data.model,
init_impute = fit_pen$init_impute,
init_par = fit_pen$init_par,
Rho_G = 0,
Rho_Z_Mu = 0,
Rho_Z_Cov = 0,
max_itr = fit_pen$em_control$max_itr,
max_tot.itr = fit_pen$em_control$max_tot.itr,
tol = fit_pen$em_control$tol,
seed = seed,
verbose = verbose
)
# Every fitted class records useY, so it is carried over for all three model
# types. The original three wrappers omitted it on the early path, which meant
# an unsupervised screening fit would have been silently refitted supervised.
args$useY <- fit_pen$useY
do.call(estimate_lucid, args)
}
# Dispatcher for the three input-preparation helpers above.
prepare_selected_inputs <- function(model_type, fit_pen, G, Z) {
switch(model_type,
early = prepare_early_selected_inputs(fit_pen, G, Z),
parallel = prepare_parallel_selected_inputs(fit_pen, G, Z),
serial = prepare_serial_selected_inputs(fit_pen, G, Z),
stop("unknown model_type: ", model_type)
)
}
# Compact stage-wise feature-selection report for serial fits, built entirely
# from get_selected_G()/get_selected_Z() -- no per-stage dispatch of its own.
serial_selection_report <- function(fit_serial_pen) {
selected_z <- get_selected_Z(fit_serial_pen)
out <- vector("list", length(fit_serial_pen$submodel))
for (i in seq_along(fit_serial_pen$submodel)) {
sm <- fit_serial_pen$submodel[[i]]
if (inherits(sm, "early_lucid")) {
out[[i]] <- list(
stage = i,
model = "early",
selected_G = if (i == 1) sum(get_selected_G(fit_serial_pen)) else NA,
total_G = if (i == 1) length(get_selected_G(fit_serial_pen)) else NA,
selected_Z = sum(selected_z[[i]]),
total_Z = length(selected_z[[i]])
)
} else {
out[[i]] <- list(
stage = i,
model = "parallel",
selected_G = if (i == 1) sum(get_selected_G(fit_serial_pen)) else NA,
total_G = if (i == 1) length(get_selected_G(fit_serial_pen)) else NA,
selected_Z_by_layer = sapply(selected_z[[i]], sum),
total_Z_by_layer = sapply(selected_z[[i]], length)
)
}
}
out
}Y_binary is the median split of the continuous outcome
built in section 5, on the same subjects, with the same injected
missingness. Fitting proceeds in the same three explicit steps as the
continuous-outcome companion vignette: penalized screening fit,
zero-penalty refit on the survivors, then bootstrap. Only the outcome
model changes.
set.seed(1105)
early_pen_bin <- estimate_lucid(
lucid_model = "early",
G = G,
Z = Z_early_miss,
Y = Y_binary,
CoG = CoG,
CoY = CoY,
family = "binary",
K = 2,
Rho_G = RHO_G,
Rho_Z_Mu = 0,
Rho_Z_Cov = 0,
max_itr = 15,
max_tot.itr = 40,
tol = 1e-2,
seed = 1105,
verbose = FALSE
)## Fitting LUCID early model (K = 2)...
## Finished LUCID early model. Selected G: 3/9; Selected Z: 30/30.
##
## ====================================================
## LUCID Early Integration: Model Summary
## ====================================================
##
## Model specification
## Family : binary
## Number of observations : 90
## Number of clusters (K) : 2
##
## Missing-data profile
## Listwise missing rows : 1 / 90 (1.1%)
## Sporadic missing rows : 4 / 90 (4.4%)
## Missing cells total : 34 / 2700 (1.3%)
##
## Feature selection overview
## G features selected : 3 / 9 (33.3%)
## Z features selected : 30 / 30 (100.0%)
##
## Model fit statistics
## Log-likelihood : -3849.79
## BIC : 12199.39
## basis: Eq 18 (one df credited per deselected variable), unstructured covariance count; not comparable across lucid_model
## Number of parameters : 1000
##
## Regularization
## Rho_G : 0.050
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## (1) Y (binary outcome): log odds of Y for cluster 1 (reference) and log OR for rest cluster (and log OR of covariate if included)
## gamma exp(gamma)
## (Intercept) -0.73926341 0.4774655
## LC2 2.18145303 8.8591696
## hs_child_age_yrs_None -0.02393363 0.9763505
## sex_male -0.18121878 0.8342528
##
## (2) Z: mean of omics data for each latent cluster
## mu_cluster1 mu_cluster2
## cg_GRHL3 0.0924580784 2.868878796
## cg_BTF3L4 0.0504117901 2.940262544
## cg_AL358472.7 -0.0682167146 3.111371337
## cg_HDGF 0.1510032084 -0.167508036
## cg_TDRD5 -0.0772691564 0.081265470
## cg_CSRNP3 -0.0551484069 0.069248978
## cg_HSPD1 0.0104684042 -0.028301690
## cg_EPM2AIP1 -0.0117188165 0.012988888
## cg_AC025171.1 -0.0629591771 0.039244080
## cg_VTRNA1_3 0.1298205885 -0.175977806
## tc_TC01006069_nc -0.2003925479 -2.771910188
## tc_SLC9A4 0.0375795289 -3.045362497
## tc_RAB6C_AS1 -0.1683097219 -2.828530456
## tc_LOC100129029 0.0458047063 -0.021983878
## tc_BRE 0.0981447862 -0.110649568
## tc_TC03001220_nc -0.0527078102 0.011683744
## tc_TC04002114_nc 0.0317936012 -0.019863921
## tc_TC04002369_nc -0.0691179554 0.085855582
## tc_BEND4 0.0553478206 -0.055297559
## tc_SLC9A3 0.0008868239 0.036509774
## miR.101.3p -0.0069239088 3.005384349
## miR.125a.5p 0.1875382466 2.797791758
## miR.125b.1.3p 0.0274086795 2.978877334
## miR.127.3p -0.1076287009 0.143970487
## miR.140.5p 0.0908628755 -0.104909847
## miR.142.3p -0.0047845269 -0.008185886
## miR.144.5p 0.0801017723 -0.107648655
## miR.19a.3p 0.0604650359 -0.077380517
## miR.19b.3p 0.1081566400 -0.129435018
## miR.21.5p 0.1022867828 -0.111960669
##
## (3) E: intercept and odds ratio of being assigned to each latent cluster for each exposure
## beta OR
## (Intercept).cluster2 -1.3552504 0.2578827
## g_causal_1.cluster2 0.9900315 2.6913192
## g_causal_2.cluster2 -0.8479809 0.4282788
## g_causal_3.cluster2 0.1918213 1.2114540
## hs_child_age_yrs_None.cluster2 0.1144689 1.1212778
## sex_male.cluster2 0.8429250 2.3231522
set.seed(1106)
early_inputs_bin <- prepare_early_selected_inputs(early_pen_bin, G, Z_early_miss)
early_bin <- list(fit_pen = early_pen_bin, inputs = early_inputs_bin)
early_bin$fit_refit <- refit_selected(
"early",
fit_pen = early_pen_bin,
inputs = early_inputs_bin,
Y = Y_binary,
CoG = CoG,
CoY = CoY,
seed = 1106
)## Fitting LUCID early model (K = 2)...
## Finished LUCID early model.
##
## ====================================================
## LUCID Early Integration: Model Summary
## ====================================================
##
## Model specification
## Family : binary
## Number of observations : 90
## Number of clusters (K) : 2
##
## Missing-data profile
## Listwise missing rows : 1 / 90 (1.1%)
## Sporadic missing rows : 4 / 90 (4.4%)
## Missing cells total : 34 / 2700 (1.3%)
##
## Feature selection overview
## G features selected : 3 / 3 (100.0%)
## Z features selected : 30 / 30 (100.0%)
##
## Model fit statistics
## Log-likelihood : -3844.49
## BIC : 12188.79
## basis: Eq 13, unstructured covariance count; not comparable across lucid_model
## Number of parameters : 1000
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## (1) Y (binary outcome): log odds of Y for cluster 1 (reference) and log OR for rest cluster (and log OR of covariate if included)
## gamma exp(gamma)
## (Intercept) -0.73803742 0.4780512
## LC2 2.18399246 8.8816954
## hs_child_age_yrs_None -0.02422325 0.9760678
## sex_male -0.18292238 0.8328328
##
## (2) Z: mean of omics data for each latent cluster
## mu_cluster1 mu_cluster2
## cg_GRHL3 0.0923554503 2.868818538
## cg_BTF3L4 0.0504117901 2.940262544
## cg_AL358472.7 -0.0682167146 3.111303858
## cg_HDGF 0.1510032083 -0.167508036
## cg_TDRD5 -0.0772691564 0.081265470
## cg_CSRNP3 -0.0551484069 0.069248978
## cg_HSPD1 0.0104684042 -0.028301690
## cg_EPM2AIP1 -0.0117188166 0.012988888
## cg_AC025171.1 -0.0629591771 0.039244080
## cg_VTRNA1_3 0.1298205885 -0.175977806
## tc_TC01006069_nc -0.2003925479 -2.771910188
## tc_SLC9A4 0.0375795289 -3.045362497
## tc_RAB6C_AS1 -0.1683097219 -2.828530456
## tc_LOC100129029 0.0458047063 -0.021983878
## tc_BRE 0.0981447863 -0.110649568
## tc_TC03001220_nc -0.0527078102 0.011683744
## tc_TC04002114_nc 0.0317936013 -0.019863921
## tc_TC04002369_nc -0.0691179554 0.085855582
## tc_BEND4 0.0553478206 -0.055297559
## tc_SLC9A3 0.0008868239 0.036509774
## miR.101.3p -0.0069239088 3.005384349
## miR.125a.5p 0.1875382466 2.797791758
## miR.125b.1.3p 0.0274086795 2.978877334
## miR.127.3p -0.1076287009 0.143970487
## miR.140.5p 0.0908628755 -0.104909847
## miR.142.3p -0.0047845269 -0.008185886
## miR.144.5p 0.0801017723 -0.107648655
## miR.19a.3p 0.0604650359 -0.077380517
## miR.19b.3p 0.1081566400 -0.129435018
## miR.21.5p 0.1022867828 -0.111960669
##
## (3) E: intercept and odds ratio of being assigned to each latent cluster for each exposure
## beta OR
## (Intercept).cluster2 -3.2324024 0.03946258
## g_causal_1.cluster2 1.9553816 7.06661538
## g_causal_2.cluster2 -1.9423675 0.14336414
## g_causal_3.cluster2 0.6702018 1.95463177
## hs_child_age_yrs_None.cluster2 0.3382874 1.40254353
## sex_male.cluster2 1.5433062 4.68003784
set.seed(1107)
early_bin$boot <- boot_lucid(
G = early_inputs_bin$G,
Z = early_inputs_bin$Z,
Y = Y_binary,
CoG = CoG,
CoY = CoY,
model = early_bin$fit_refit,
R = 30,
conf = 0.90
)
summary(early_bin$fit_refit, boot.se = early_bin$boot)##
## ====================================================
## LUCID Early Integration: Model Summary
## ====================================================
##
## Model specification
## Family : binary
## Number of observations : 90
## Number of clusters (K) : 2
##
## Missing-data profile
## Listwise missing rows : 1 / 90 (1.1%)
## Sporadic missing rows : 4 / 90 (4.4%)
## Missing cells total : 34 / 2700 (1.3%)
##
## Feature selection overview
## G features selected : 3 / 3 (100.0%)
## Z features selected : 30 / 30 (100.0%)
##
## Model fit statistics
## Log-likelihood : -3844.49
## BIC : 12188.79
## basis: Eq 13, unstructured covariance count; not comparable across lucid_model
## Number of parameters : 1000
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## Bootstrap 90% confidence limits (normal-theory, bias-corrected: centred on
## 2*t0 - mean(t), so they need not bracket `estimate`). `sig` is assessed on
## the coefficient scale (null = 0); "NA" means no interval could be formed.
## Where an OR column is shown it is exp() of each coefficient column, so the
## intercept row is a baseline odds, not an odds ratio.
## (1) Y (binary outcome): log odds / log OR (coefficient scale) with bootstrap interval, and the odds ratio (exp of each column). `sig` marks intervals excluding the null.
## gamma norm_lower norm_upper OR OR_lower
## (Intercept) -0.73803742 -4.2415768 3.4770506 0.4780512 0.01438489
## LC2 2.18399246 1.1150742 3.0582000 8.8816954 3.04979451
## hs_child_age_yrs_None -0.02422325 -0.5871085 0.4759582 0.9760678 0.55593243
## sex_male -0.18292238 -1.1242269 0.7940127 0.8328328 0.32490355
## OR_upper sig
## (Intercept) 32.364125
## LC2 21.289202 *
## hs_child_age_yrs_None 1.609556
## sex_male 2.212256
##
## (2) Z: mean of omics data for each latent cluster
## estimate norm_lower norm_upper sig
## cg_GRHL3.cluster1 0.0923554503 -0.08950874 0.2419778702
## cg_BTF3L4.cluster1 0.0504117901 -0.13726987 0.2645329663
## cg_AL358472.7.cluster1 -0.0682167146 -0.33933800 0.1469148725
## cg_HDGF.cluster1 0.1510032083 -0.07645178 0.3041641426
## cg_TDRD5.cluster1 -0.0772691564 -0.29680097 0.1470313587
## cg_CSRNP3.cluster1 -0.0551484069 -0.22004155 0.1800145740
## cg_HSPD1.cluster1 0.0104684042 -0.27977038 0.2420975981
## cg_EPM2AIP1.cluster1 -0.0117188166 -0.24172641 0.1908980381
## cg_AC025171.1.cluster1 -0.0629591771 -0.33560055 0.1773865515
## cg_VTRNA1_3.cluster1 0.1298205885 -0.11809192 0.4129245802
## tc_TC01006069_nc.cluster1 -0.2003925479 -0.42761672 0.0224208433
## tc_SLC9A4.cluster1 0.0375795289 -0.22559417 0.3136882747
## tc_RAB6C_AS1.cluster1 -0.1683097219 -0.46768605 0.1096666603
## tc_LOC100129029.cluster1 0.0458047063 -0.13380974 0.2662827216
## tc_BRE.cluster1 0.0981447863 -0.12864478 0.3569299592
## tc_TC03001220_nc.cluster1 -0.0527078102 -0.24329553 0.1864650748
## tc_TC04002114_nc.cluster1 0.0317936013 -0.20933950 0.2837233880
## tc_TC04002369_nc.cluster1 -0.0691179554 -0.28480128 0.2014433944
## tc_BEND4.cluster1 0.0553478206 -0.16993413 0.3614874982
## tc_SLC9A3.cluster1 0.0008868239 -0.26368865 0.2159434488
## miR.101.3p.cluster1 -0.0069239088 -0.28138702 0.2908502891
## miR.125a.5p.cluster1 0.1875382466 -0.08975223 0.4567698033
## miR.125b.1.3p.cluster1 0.0274086795 -0.21898054 0.2503331591
## miR.127.3p.cluster1 -0.1076287009 -0.25713964 0.0563842464
## miR.140.5p.cluster1 0.0908628755 -0.19037220 0.3877782530
## miR.142.3p.cluster1 -0.0047845269 -0.23018813 0.2602177955
## miR.144.5p.cluster1 0.0801017723 -0.14079979 0.3294823278
## miR.19a.3p.cluster1 0.0604650359 -0.15674417 0.3322544473
## miR.19b.3p.cluster1 0.1081566400 -0.11979625 0.3659498501
## miR.21.5p.cluster1 0.1022867828 -0.13496241 0.3442598087
## cg_GRHL3.cluster2 2.8688185382 2.59481568 3.0849120511 *
## cg_BTF3L4.cluster2 2.9402625437 2.67209678 3.1542981984 *
## cg_AL358472.7.cluster2 3.1113038580 2.83442578 3.3306049686 *
## cg_HDGF.cluster2 -0.1675080363 -0.41187939 0.1037256675
## cg_TDRD5.cluster2 0.0812654695 -0.11117535 0.3116192786
## cg_CSRNP3.cluster2 0.0692489775 -0.18016681 0.3253885956
## cg_HSPD1.cluster2 -0.0283016902 -0.33615593 0.1688911057
## cg_EPM2AIP1.cluster2 0.0129888876 -0.25354413 0.2596688150
## cg_AC025171.1.cluster2 0.0392440799 -0.19831988 0.2490456909
## cg_VTRNA1_3.cluster2 -0.1759778064 -0.39416505 0.0003732893
## tc_TC01006069_nc.cluster2 -2.7719101883 -2.94993386 -2.5958103708 *
## tc_SLC9A4.cluster2 -3.0453624968 -3.33860047 -2.6996774421 *
## tc_RAB6C_AS1.cluster2 -2.8285304556 -3.02206771 -2.6458076729 *
## tc_LOC100129029.cluster2 -0.0219838780 -0.34286926 0.1959188092
## tc_BRE.cluster2 -0.1106495683 -0.35190447 0.1831868334
## tc_TC03001220_nc.cluster2 0.0116837437 -0.25676634 0.1688203971
## tc_TC04002114_nc.cluster2 -0.0198639211 -0.29525062 0.2862574449
## tc_TC04002369_nc.cluster2 0.0858555820 -0.12286613 0.4123248511
## tc_BEND4.cluster2 -0.0552975593 -0.30317466 0.2325986547
## tc_SLC9A3.cluster2 0.0365097740 -0.30272964 0.2950107763
## miR.101.3p.cluster2 3.0053843495 2.73425263 3.3080793654 *
## miR.125a.5p.cluster2 2.7977917576 2.61824913 3.0170962774 *
## miR.125b.1.3p.cluster2 2.9788773341 2.69920684 3.1906577979 *
## miR.127.3p.cluster2 0.1439704872 -0.18078305 0.4748195108
## miR.140.5p.cluster2 -0.1049098467 -0.32814769 0.1211974126
## miR.142.3p.cluster2 -0.0081858862 -0.26651785 0.3163924435
## miR.144.5p.cluster2 -0.1076486546 -0.28243846 0.1739067214
## miR.19a.3p.cluster2 -0.0773805165 -0.31610958 0.1808659287
## miR.19b.3p.cluster2 -0.1294350177 -0.37743321 0.1482305667
## miR.21.5p.cluster2 -0.1119606693 -0.37404588 0.1868233668
##
## (3) E: cluster-assignment coefficients (log-odds scale) for each exposure, with bootstrap interval and the odds ratio (exp of each column). `sig` marks intervals excluding the null.
## estimate norm_lower norm_upper OR
## (Intercept).cluster2 -3.2324024 -8.4761152 5.3555057 0.03946258
## g_causal_1.cluster2 1.9553816 0.1705188 2.5956273 7.06661538
## g_causal_2.cluster2 -1.9423675 -2.6189797 -0.2039056 0.14336414
## g_causal_3.cluster2 0.6702018 -0.2858727 1.1837635 1.95463177
## hs_child_age_yrs_None.cluster2 0.3382874 -0.7477767 1.0277257 1.40254353
## sex_male.cluster2 1.5433062 -0.6647401 2.4319474 4.68003784
## OR_lower OR_upper sig
## (Intercept).cluster2 0.0002083867 211.7710370
## g_causal_1.cluster2 1.1859199319 13.4049931 *
## g_causal_2.cluster2 0.0728771781 0.8155394 *
## g_causal_3.cluster2 0.7513582470 3.2666452
## hs_child_age_yrs_None.cluster2 0.4734179450 2.7947027
## sex_male.cluster2 0.5144072018 11.3810235
Every bootstrap CI table now also carries an odds-ratio view
(OR, OR_lower, OR_upper)
alongside the coefficient-scale columns and sig, and the
exposure/assignment (3) E table includes its intercept and
covariate rows. Two things to keep in mind when reading those columns.
The OR column is the elementwise exp() of the
coefficient column, so on the intercept row it is a
baseline odds, not an odds ratio – sig is always assessed
on the coefficient scale, where the null is a single 0. And the
normal-theory limits are bias-corrected (boot::norm.ci
centres them on 2*t0 - mean(t)), so they need not bracket
the printed estimate; that is the method rather than an inconsistency,
and as of 3.3.0 summary() prints a short note above the
tables saying so, together with the confidence level used. A
sig of "NA" means no interval could be formed
for that parameter at all, which used to print as a blank and so looked
like “tested, not significant”. R = 30 keeps the vignette
fast; a real analysis needs R in the hundreds. A poorly
identified coefficient – the exposure-model intercept, or a covariate
nearly collinear with cluster membership – can show a very wide or
off-centre interval; that is the bootstrap being honest, not a bug.
Three differences are worth noting in that output whenever an outcome switches from continuous to binary – they are the whole payload of the outcome-family axis, and apply identically to the parallel and serial models fitted below:
sigma row that appears for a normal outcome is simply
absent.res_Mu and res_Beta mean the same thing
regardless of family – only the X -> Y arm differs.set.seed(1205)
parallel_pen_bin <- estimate_lucid(
lucid_model = "parallel",
G = G,
Z = Z_parallel_miss,
Y = Y_binary,
CoG = CoG,
CoY = CoY,
family = "binary",
K = c(2, 2, 2),
Rho_G = RHO_G,
Rho_Z_Mu = 0,
Rho_Z_Cov = 0,
max_itr = 15,
max_tot.itr = 40,
tol = 1e-2,
seed = 1205,
verbose = FALSE
)## Fitting LUCID parallel model (3 layers)...
## Finished LUCID parallel model. Selected G: 5/9; Selected Z by layer: 10/10, 10/10, 10/10.
##
## ====================================================
## LUCID Parallel: Model Summary
## ====================================================
##
## Model specification
## Family : binomial
## Number of observations : 90
## Clusters per layer : 2, 2, 2
##
## Missing-data profile by layer
## Layer 1 listwise rows : 1 / 90 (1.1%)
## Layer 1 sporadic rows : 0 / 90 (0.0%)
## Layer 1 missing cells : 10 / 900 (1.1%)
## Layer 2 listwise rows : 0 / 90 (0.0%)
## Layer 2 sporadic rows : 1 / 90 (1.1%)
## Layer 2 missing cells : 1 / 900 (0.1%)
## Layer 3 listwise rows : 0 / 90 (0.0%)
## Layer 3 sporadic rows : 1 / 90 (1.1%)
## Layer 3 missing cells : 1 / 900 (0.1%)
##
## Feature selection overview
## G features selected : 5 / 9 (55.6%)
## G features by layer
## Layer 1 : 3 / 9 (33.3%)
## Layer 2 : 3 / 9 (33.3%)
## Layer 3 : 3 / 9 (33.3%)
## Z features
## Layer 1 selected : 10 / 10 (100.0%)
## Layer 1 multi-cluster: 10
## Layer 2 selected : 10 / 10 (100.0%)
## Layer 2 multi-cluster: 10
## Layer 3 selected : 10 / 10 (100.0%)
## Layer 3 multi-cluster: 10
##
## Model fit statistics
## Log-likelihood : -3913.65
## BIC : 9690.22
## basis: Eq 18 (one df credited per deselected variable), unstructured covariance count; not comparable across lucid_model
## Number of parameters : 414
##
## Regularization
## Rho_G : 0.050
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## (1) Y (binary outcome): intercept and log OR for non-reference clusters for each layer (and log OR of covariate if included)
## gamma exp(gamma)
## (Intercept) -2.03023227 0.1313050
## Layer1_LC2 1.12983479 3.0951451
## Layer2_LC2 3.23277134 25.3498126
## Layer3_LC2 0.34601894 1.4134294
## hs_child_age_yrs_None -0.03318884 0.9673559
## sex_male -0.13627642 0.8726014
##
## (2) Z: mean of omics data for each latent cluster of each layer
## Layer 1
##
## mu_cluster1 mu_cluster2
## cg_GRHL3 2.91884345 0.06731655
## cg_BTF3L4 2.95731695 0.02546292
## cg_AL358472.7 3.05076009 -0.06086737
## cg_HDGF -0.17015726 0.15441538
## cg_TDRD5 0.08140314 -0.07795102
## cg_CSRNP3 0.06788418 -0.05441570
## cg_HSPD1 0.03463625 -0.04356801
## cg_EPM2AIP1 -0.02484479 0.02075893
## cg_AC025171.1 0.05996797 -0.08116056
## cg_VTRNA1_3 -0.15805887 0.11548343
##
## Layer 2
##
## mu_cluster1 mu_cluster2
## tc_TC01006069_nc -0.200647757 -2.770968107
## tc_SLC9A4 0.034383668 -3.047762067
## tc_RAB6C_AS1 -0.165718346 -2.810895584
## tc_LOC100129029 0.045221994 -0.051692830
## tc_BRE 0.089724727 -0.102563480
## tc_TC03001220_nc -0.046714766 0.053399203
## tc_TC04002114_nc 0.034859131 -0.039847140
## tc_TC04002369_nc -0.073631781 0.084167786
## tc_BEND4 0.052746802 -0.060294366
## tc_SLC9A3 0.002498115 -0.002855571
##
## Layer 3
##
## mu_cluster1 mu_cluster2
## miR.101.3p 0.28978602 1.91075902
## miR.125a.5p 0.99487409 1.57575586
## miR.125b.1.3p 1.52589575 1.34538262
## miR.127.3p -0.08006055 0.03473268
## miR.140.5p -0.94131728 0.40837188
## miR.142.3p -1.14537293 0.49689738
## miR.144.5p -1.06011622 0.45991044
## miR.19a.3p -1.04878172 0.45499320
## miR.19b.3p -1.13685730 0.49320304
## miR.21.5p -0.99496655 0.43164655
##
## (3) E: intercept and odds ratio of being assigned to each latent cluster for each exposure for each layer
## Layer 1
##
## beta OR
## (Intercept).cluster2 0.90269098 2.4662308
## g_causal_1.cluster2 -0.77854431 0.4590738
## g_causal_2.cluster2 0.72193072 2.0584036
## g_causal_3.cluster2 -0.17437291 0.8399836
## hs_child_age_yrs_None.cluster2 -0.05868294 0.9430057
## sex_male.cluster2 -0.71753941 0.4879514
##
## Layer 2
##
## beta OR
## (Intercept).cluster2 -1.3460165 0.2602750
## g_causal_1.cluster2 0.9878238 2.6853841
## g_causal_2.cluster2 -0.8424478 0.4306551
## g_causal_3.cluster2 0.2019162 1.2237455
## hs_child_age_yrs_None.cluster2 0.1150738 1.1219562
## sex_male.cluster2 0.8167699 2.2631776
##
## Layer 3
##
## beta OR
## (Intercept).cluster2 0.78670204 2.1961417
## g_causal_3.cluster2 -0.08494236 0.9185652
## g_noise_3.cluster2 0.13649471 1.1462488
## g_noise_4.cluster2 0.29818412 1.3474098
## hs_child_age_yrs_None.cluster2 0.03219618 1.0327201
## sex_male.cluster2 -0.30304993 0.7385622
set.seed(1206)
parallel_inputs_bin <- prepare_parallel_selected_inputs(parallel_pen_bin, G, Z_parallel_miss)
parallel_bin <- list(fit_pen = parallel_pen_bin, inputs = parallel_inputs_bin)
parallel_bin$fit_refit <- refit_selected(
"parallel",
fit_pen = parallel_pen_bin,
inputs = parallel_inputs_bin,
Y = Y_binary,
CoG = CoG,
CoY = CoY,
seed = 1206
)## Fitting LUCID parallel model (3 layers)...
## Finished LUCID parallel model.
##
## ====================================================
## LUCID Parallel: Model Summary
## ====================================================
##
## Model specification
## Family : binomial
## Number of observations : 90
## Clusters per layer : 2, 2, 2
##
## Missing-data profile by layer
## Layer 1 listwise rows : 1 / 90 (1.1%)
## Layer 1 sporadic rows : 0 / 90 (0.0%)
## Layer 1 missing cells : 10 / 900 (1.1%)
## Layer 2 listwise rows : 0 / 90 (0.0%)
## Layer 2 sporadic rows : 1 / 90 (1.1%)
## Layer 2 missing cells : 1 / 900 (0.1%)
## Layer 3 listwise rows : 0 / 90 (0.0%)
## Layer 3 sporadic rows : 1 / 90 (1.1%)
## Layer 3 missing cells : 1 / 900 (0.1%)
##
## Feature selection overview
## G features selected : 5 / 5 (100.0%)
## G features by layer
## Layer 1 : 5 / 5 (100.0%)
## Layer 2 : 5 / 5 (100.0%)
## Layer 3 : 5 / 5 (100.0%)
## Z features
## Layer 1 selected : 10 / 10 (100.0%)
## Layer 1 multi-cluster: 10
## Layer 2 selected : 10 / 10 (100.0%)
## Layer 2 multi-cluster: 10
## Layer 3 selected : 10 / 10 (100.0%)
## Layer 3 multi-cluster: 10
##
## Model fit statistics
## Log-likelihood : -3900.36
## BIC : 9690.65
## basis: Eq 13, unstructured covariance count; not comparable across lucid_model
## Number of parameters : 420
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## (1) Y (binary outcome): intercept and log OR for non-reference clusters for each layer (and log OR of covariate if included)
## gamma exp(gamma)
## (Intercept) -4.10886469 0.01642641
## Layer1_LC2 3.12884305 22.84753080
## Layer2_LC2 5.26901218 194.22400951
## Layer3_LC2 0.39028559 1.47740267
## hs_child_age_yrs_None -0.02801259 0.97237612
## sex_male -0.15651909 0.85511519
##
## (2) Z: mean of omics data for each latent cluster of each layer
## Layer 1
##
## mu_cluster1 mu_cluster2
## cg_GRHL3 2.923692378 0.087457136
## cg_BTF3L4 2.963254802 0.045366200
## cg_AL358472.7 3.074392115 -0.054386544
## cg_HDGF -0.179132353 0.159239965
## cg_TDRD5 0.085859955 -0.080362264
## cg_CSRNP3 0.069748482 -0.054951389
## cg_HSPD1 0.009858017 -0.021967174
## cg_EPM2AIP1 0.003710957 -0.003756569
## cg_AC025171.1 0.059826562 -0.079841506
## cg_VTRNA1_3 -0.169320506 0.122673754
##
## Layer 2
##
## mu_cluster1 mu_cluster2
## tc_TC01006069_nc -0.2005735370 -2.770264087
## tc_SLC9A4 0.0374218160 -3.050255369
## tc_RAB6C_AS1 -0.1682029744 -2.807245278
## tc_LOC100129029 0.0453300580 -0.051786543
## tc_BRE 0.0972739899 -0.111128993
## tc_TC03001220_nc -0.0524548169 0.059926101
## tc_TC04002114_nc 0.0326086652 -0.037253207
## tc_TC04002369_nc -0.0696274379 0.079544666
## tc_BEND4 0.0554274490 -0.063322134
## tc_SLC9A3 0.0009244067 -0.001056073
##
## Layer 3
##
## mu_cluster1 mu_cluster2
## miR.101.3p 0.26692862 1.91751340
## miR.125a.5p 0.96866136 1.58588897
## miR.125b.1.3p 1.50272916 1.35572801
## miR.127.3p -0.09389774 0.04046601
## miR.140.5p -0.94043424 0.40528795
## miR.142.3p -1.15108344 0.49606898
## miR.144.5p -1.06582779 0.45932734
## miR.19a.3p -1.04830295 0.45177487
## miR.19b.3p -1.13527362 0.48925560
## miR.21.5p -0.99579943 0.42914804
##
## (3) E: intercept and odds ratio of being assigned to each latent cluster for each exposure for each layer
## Layer 1
##
## beta OR
## (Intercept).cluster2 2.61720487 13.6973840
## g_causal_1.cluster2 -1.57679115 0.2066371
## g_causal_2.cluster2 1.48196397 4.4015818
## g_causal_3.cluster2 -0.62582495 0.5348200
## g_noise_3.cluster2 -0.07217444 0.9303686
## g_noise_4.cluster2 0.19361169 1.2136249
## hs_child_age_yrs_None.cluster2 -0.26669152 0.7659093
## sex_male.cluster2 -1.23076850 0.2920680
##
## Layer 2
##
## beta OR
## (Intercept).cluster2 -3.1284691 0.04378478
## g_causal_1.cluster2 1.9953753 7.35496292
## g_causal_2.cluster2 -1.8640956 0.15503635
## g_causal_3.cluster2 0.6992595 2.01226216
## g_noise_3.cluster2 0.1679361 1.18286098
## g_noise_4.cluster2 -0.1578359 0.85398994
## hs_child_age_yrs_None.cluster2 0.3222822 1.38027426
## sex_male.cluster2 1.5730517 4.82133893
##
## Layer 3
##
## beta OR
## (Intercept).cluster2 1.67127358 5.3189376
## g_causal_1.cluster2 -0.08074332 0.9224304
## g_causal_2.cluster2 -0.26665807 0.7659349
## g_causal_3.cluster2 -0.47597728 0.6212776
## g_noise_3.cluster2 0.49533766 1.6410523
## g_noise_4.cluster2 0.77524110 2.1711155
## hs_child_age_yrs_None.cluster2 -0.06119731 0.9406376
## sex_male.cluster2 -0.37806881 0.6851833
set.seed(1207)
parallel_bin$boot <- boot_lucid(
G = parallel_inputs_bin$G,
Z = parallel_inputs_bin$Z,
Y = Y_binary,
CoG = CoG,
CoY = CoY,
model = parallel_bin$fit_refit,
R = 30,
conf = 0.90
)
summary(parallel_bin$fit_refit, boot.se = parallel_bin$boot)##
## ====================================================
## LUCID Parallel: Model Summary
## ====================================================
##
## Model specification
## Family : binomial
## Number of observations : 90
## Clusters per layer : 2, 2, 2
##
## Missing-data profile by layer
## Layer 1 listwise rows : 1 / 90 (1.1%)
## Layer 1 sporadic rows : 0 / 90 (0.0%)
## Layer 1 missing cells : 10 / 900 (1.1%)
## Layer 2 listwise rows : 0 / 90 (0.0%)
## Layer 2 sporadic rows : 1 / 90 (1.1%)
## Layer 2 missing cells : 1 / 900 (0.1%)
## Layer 3 listwise rows : 0 / 90 (0.0%)
## Layer 3 sporadic rows : 1 / 90 (1.1%)
## Layer 3 missing cells : 1 / 900 (0.1%)
##
## Feature selection overview
## G features selected : 5 / 5 (100.0%)
## G features by layer
## Layer 1 : 5 / 5 (100.0%)
## Layer 2 : 5 / 5 (100.0%)
## Layer 3 : 5 / 5 (100.0%)
## Z features
## Layer 1 selected : 10 / 10 (100.0%)
## Layer 1 multi-cluster: 10
## Layer 2 selected : 10 / 10 (100.0%)
## Layer 2 multi-cluster: 10
## Layer 3 selected : 10 / 10 (100.0%)
## Layer 3 multi-cluster: 10
##
## Model fit statistics
## Log-likelihood : -3900.36
## BIC : 9690.65
## basis: Eq 13, unstructured covariance count; not comparable across lucid_model
## Number of parameters : 420
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## Bootstrap 90% confidence limits (normal-theory, bias-corrected: centred on
## 2*t0 - mean(t), so they need not bracket `estimate`). `sig` is assessed on
## the coefficient scale (null = 0); "NA" means no interval could be formed.
## Where an OR column is shown it is exp() of each coefficient column, so the
## intercept row is a baseline odds, not an odds ratio.
## (1) Y (binary outcome): log odds / log OR (coefficient scale) with bootstrap interval, and the odds ratio (exp of each column). `sig` marks intervals excluding the null.
## gamma norm_lower norm_upper OR
## (Intercept) -4.10886469 -27.5627070 13.8306243 0.01642641
## Layer1_LC2 3.12884305 -13.7551518 25.1376720 22.84753080
## Layer2_LC2 5.26901218 -12.0441011 27.0268623 194.22400951
## Layer3_LC2 0.39028559 -0.7183983 0.8858842 1.47740267
## hs_child_age_yrs_None -0.02801259 -0.4235174 0.5147741 0.97237612
## sex_male -0.15651909 -1.1329467 1.0988189 0.85511519
## OR_lower OR_upper sig
## (Intercept) 1.070702e-12 1.015229e+06
## Layer1_LC2 1.062218e-06 8.263276e+10
## Layer2_LC2 5.879134e-06 5.465340e+11
## Layer3_LC2 4.875325e-01 2.425128e+00
## hs_child_age_yrs_None 6.547398e-01 1.673260e+00
## sex_male 3.220828e-01 3.000620e+00
##
## (2) Z: mean of omics data for each latent cluster of each layer
## Layer 1
##
## estimate norm_lower norm_upper sig
## Layer1.cg_GRHL3.cluster1 2.923692378 2.62526264 3.26368495 *
## Layer1.cg_BTF3L4.cluster1 2.963254802 2.64428905 3.34449062 *
## Layer1.cg_AL358472.7.cluster1 3.074392115 2.75287473 3.38897116 *
## Layer1.cg_HDGF.cluster1 -0.179132353 -0.53277144 0.26378129
## Layer1.cg_TDRD5.cluster1 0.085859955 -0.23941850 0.33709365
## Layer1.cg_CSRNP3.cluster1 0.069748482 -0.19279890 0.37695539
## Layer1.cg_HSPD1.cluster1 0.009858017 -0.19237197 0.34823773
## Layer1.cg_EPM2AIP1.cluster1 0.003710957 -0.30273635 0.30660330
## Layer1.cg_AC025171.1.cluster1 0.059826562 -0.19196128 0.25470956
## Layer1.cg_VTRNA1_3.cluster1 -0.169320506 -0.42070132 0.10443919
## Layer1.cg_GRHL3.cluster2 0.087457136 -0.16047779 0.32522749
## Layer1.cg_BTF3L4.cluster2 0.045366200 -0.23345766 0.26367877
## Layer1.cg_AL358472.7.cluster2 -0.054386544 -0.27664556 0.27812957
## Layer1.cg_HDGF.cluster2 0.159239965 -0.04082687 0.39010307
## Layer1.cg_TDRD5.cluster2 -0.080362264 -0.36559573 0.14274395
## Layer1.cg_CSRNP3.cluster2 -0.054951389 -0.22495034 0.09487568
## Layer1.cg_HSPD1.cluster2 -0.021967174 -0.28808531 0.20282583
## Layer1.cg_EPM2AIP1.cluster2 -0.003756569 -0.24550310 0.21969305
## Layer1.cg_AC025171.1.cluster2 -0.079841506 -0.26914803 0.15390458
## Layer1.cg_VTRNA1_3.cluster2 0.122673754 -0.11754806 0.36306364
##
## Layer 2
##
## estimate norm_lower norm_upper sig
## Layer2.tc_TC01006069_nc.cluster1 -0.2005735370 -0.43929518 0.113758925
## Layer2.tc_SLC9A4.cluster1 0.0374218160 -0.22338173 0.274673386
## Layer2.tc_RAB6C_AS1.cluster1 -0.1682029744 -0.41059041 0.001769777
## Layer2.tc_LOC100129029.cluster1 0.0453300580 -0.20979873 0.341046106
## Layer2.tc_BRE.cluster1 0.0972739899 -0.09844872 0.357213864
## Layer2.tc_TC03001220_nc.cluster1 -0.0524548169 -0.33749596 0.194130048
## Layer2.tc_TC04002114_nc.cluster1 0.0326086652 -0.23190133 0.269458630
## Layer2.tc_TC04002369_nc.cluster1 -0.0696274379 -0.36370880 0.196754680
## Layer2.tc_BEND4.cluster1 0.0554274490 -0.26000082 0.247365844
## Layer2.tc_SLC9A3.cluster1 0.0009244067 -0.17809556 0.212749793
## Layer2.tc_TC01006069_nc.cluster2 -2.7702640871 -2.95439522 -2.474662782 *
## Layer2.tc_SLC9A4.cluster2 -3.0502553694 -3.33503958 -2.795590048 *
## Layer2.tc_RAB6C_AS1.cluster2 -2.8072452784 -3.00377606 -2.584612230 *
## Layer2.tc_LOC100129029.cluster2 -0.0517865434 -0.28074349 0.182435231
## Layer2.tc_BRE.cluster2 -0.1111289930 -0.45503393 0.063386169
## Layer2.tc_TC03001220_nc.cluster2 0.0599261014 -0.16182053 0.348483575
## Layer2.tc_TC04002114_nc.cluster2 -0.0372532075 -0.25524375 0.179149989
## Layer2.tc_TC04002369_nc.cluster2 0.0795446661 -0.20178463 0.324859482
## Layer2.tc_BEND4.cluster2 -0.0633221336 -0.32587416 0.121987636
## Layer2.tc_SLC9A3.cluster2 -0.0010560725 -0.26035559 0.257305906
##
## Layer 3
##
## estimate norm_lower norm_upper sig
## Layer3.miR.101.3p.cluster1 0.26692862 -0.2908093 0.8155812
## Layer3.miR.125a.5p.cluster1 0.96866136 0.5728398 1.3400995 *
## Layer3.miR.125b.1.3p.cluster1 1.50272916 1.0375381 1.9817036 *
## Layer3.miR.127.3p.cluster1 -0.09389774 -0.3308713 0.3116152
## Layer3.miR.140.5p.cluster1 -0.94043424 -1.1639549 -0.7313918 *
## Layer3.miR.142.3p.cluster1 -1.15108344 -1.3836962 -0.8844678 *
## Layer3.miR.144.5p.cluster1 -1.06582779 -1.3568766 -0.6829051 *
## Layer3.miR.19a.3p.cluster1 -1.04830295 -1.3452742 -0.7519299 *
## Layer3.miR.19b.3p.cluster1 -1.13527362 -1.4061317 -0.8374149 *
## Layer3.miR.21.5p.cluster1 -0.99579943 -1.2667127 -0.6414391 *
## Layer3.miR.101.3p.cluster2 1.91751340 1.4471614 2.3369791 *
## Layer3.miR.125a.5p.cluster2 1.58588897 1.1445697 1.9613688 *
## Layer3.miR.125b.1.3p.cluster2 1.35572801 0.9161948 1.7549738 *
## Layer3.miR.127.3p.cluster2 0.04046601 -0.2795909 0.2125445
## Layer3.miR.140.5p.cluster2 0.40528795 0.2141283 0.5925071 *
## Layer3.miR.142.3p.cluster2 0.49606898 0.3380835 0.6461458 *
## Layer3.miR.144.5p.cluster2 0.45932734 0.2892789 0.6229482 *
## Layer3.miR.19a.3p.cluster2 0.45177487 0.2568112 0.6354054 *
## Layer3.miR.19b.3p.cluster2 0.48925560 0.3004317 0.6731546 *
## Layer3.miR.21.5p.cluster2 0.42914804 0.2574498 0.6112230 *
##
## (3) E: cluster-assignment coefficients (log-odds scale) for each exposure for each layer, with bootstrap interval and the odds ratio (exp of each column). `sig` marks intervals excluding the null.
## Layer 1
##
## estimate norm_lower norm_upper OR
## (Intercept).cluster2 2.61720487 -42.722442 37.381671 13.6973840
## g_causal_1.cluster2 -1.57679115 -14.474824 16.176923 0.2066371
## g_causal_2.cluster2 1.48196397 -5.690608 6.168974 4.4015818
## g_causal_3.cluster2 -0.62582495 -3.718057 3.615156 0.5348200
## g_noise_3.cluster2 -0.07217444 -2.884684 2.005842 0.9303686
## g_noise_4.cluster2 0.19361169 -6.150138 5.054864 1.2136249
## hs_child_age_yrs_None.cluster2 -0.26669152 -5.004203 5.942830 0.7659093
## sex_male.cluster2 -1.23076850 -13.488562 14.632786 0.2920680
## OR_lower OR_upper sig
## (Intercept).cluster2 2.791767e-19 1.716538e+16
## g_causal_1.cluster2 5.172063e-07 1.060593e+07
## g_causal_2.cluster2 3.377537e-03 4.776957e+02
## g_causal_3.cluster2 2.428110e-02 3.715715e+01
## g_noise_3.cluster2 5.587245e-02 7.432347e+00
## g_noise_4.cluster2 2.133188e-03 1.567831e+02
## hs_child_age_yrs_None.cluster2 6.709690e-03 3.810115e+02
## sex_male.cluster2 1.386731e-06 2.264322e+06
##
## Layer 2
##
## estimate norm_lower norm_upper OR
## (Intercept).cluster2 -3.1284691 -38.135372 41.607796 0.04378478
## g_causal_1.cluster2 1.9953753 -15.679899 14.828739 7.35496292
## g_causal_2.cluster2 -1.8640956 -6.463868 5.173184 0.15503635
## g_causal_3.cluster2 0.6992595 -3.523864 3.751285 2.01226216
## g_noise_3.cluster2 0.1679361 -1.773487 3.118081 1.18286098
## g_noise_4.cluster2 -0.1578359 -5.316975 6.154211 0.85398994
## hs_child_age_yrs_None.cluster2 0.3222822 -5.829123 5.057194 1.38027426
## sex_male.cluster2 1.5730517 -13.878324 14.212480 4.82133893
## OR_lower OR_upper sig
## (Intercept).cluster2 2.741690e-17 1.174996e+18
## g_causal_1.cluster2 1.549910e-07 2.754480e+06
## g_causal_2.cluster2 1.558755e-03 1.764758e+02
## g_causal_3.cluster2 2.948528e-02 4.257574e+01
## g_noise_3.cluster2 1.697401e-01 2.260297e+01
## g_noise_4.cluster2 4.907577e-03 4.706955e+02
## hs_child_age_yrs_None.cluster2 2.940654e-03 1.571490e+02
## sex_male.cluster2 9.391191e-07 1.487311e+06
##
## Layer 3
##
## estimate norm_lower norm_upper OR
## (Intercept).cluster2 1.67127358 -3.0599344 6.61462279 5.3189376
## g_causal_1.cluster2 -0.08074332 -0.7622380 0.49731986 0.9224304
## g_causal_2.cluster2 -0.26665807 -0.8034771 0.55686557 0.7659349
## g_causal_3.cluster2 -0.47597728 -0.9175700 0.08078411 0.6212776
## g_noise_3.cluster2 0.49533766 0.1345800 0.87404758 1.6410523
## g_noise_4.cluster2 0.77524110 -0.1437717 1.36384201 2.1711155
## hs_child_age_yrs_None.cluster2 -0.06119731 -0.7661408 0.59623102 0.9406376
## sex_male.cluster2 -0.37806881 -1.6290148 0.63317051 0.6851833
## OR_lower OR_upper sig
## (Intercept).cluster2 0.04689077 745.923310
## g_causal_1.cluster2 0.46662094 1.644308
## g_causal_2.cluster2 0.44776930 1.745194
## g_causal_3.cluster2 0.39948861 1.084137
## g_noise_3.cluster2 1.14405618 2.396592 *
## g_noise_4.cluster2 0.86608542 3.911191
## hs_child_age_yrs_None.cluster2 0.46480338 1.815264
## sex_male.cluster2 0.19612270 1.883573
One structural difference between the families is specific to the parallel model and easy to miss. For a normal outcome, the early model estimates a per-cluster residual standard deviation – one value per latent cluster – whereas the parallel model estimates a single pooled standard deviation across the joint cluster configuration. For a binary outcome neither exists. So if you are comparing dispersion across model types, compare like with like.
outcome_penalty = "firth"A binary outcome introduces a failure mode a continuous one cannot:
if a latent cluster ends up almost perfectly aligned with Y
– everyone in the cluster shares (or nearly shares) the same outcome
value – the X -> Y logistic fit has no finite
maximum-likelihood solution in the usual sense. The coefficient keeps
growing without bound as the model chases a perfect fit, and
glm() reports back a technically-finite but wildly extreme
estimate: a log-odds of 20, 30, or more, i.e. an odds ratio in the
billions, with a bootstrap interval spanning just as many orders of
magnitude. This is called (quasi-)complete separation,
and at small N it is a real, expected risk – not a sign
that estimate_lucid() is broken. It is, if anything, a
symptom of LUCID doing exactly its job: it found a cluster that predicts
the outcome almost perfectly.
Two things make this easy to miss. First, unlike a fitted probability
mechanically stuck at 0/1, the responsibility weights
estimate_lucid() optimizes over are continuous, so R’s own
glm() diagnostics for separation
("algorithm did not converge",
"fitted probabilities numerically 0 or 1 occurred")
frequently do not fire even when the resulting coefficient is enormous.
Second, an odds ratio is easy to skim past on a printed table without
noticing quite how large it is.
estimate_lucid() now checks for this directly,
independent of glm()’s own diagnostics: if any cluster’s
outcome coefficient exceeds |log-odds| = 10 (an odds ratio
past ~22,000 – implausible for a real effect), it warns once per
finished fit, naming the mechanism. A small, deliberately separating
example shows both the warning and the fix:
set.seed(2026)
n_sep <- 40
G_sep <- matrix(rnorm(n_sep * 2), n_sep, 2)
Z_sep <- matrix(rnorm(n_sep * 4), n_sep, 4)
grp_sep <- rep(c(0, 1), each = n_sep / 2)
Z_sep[, 1] <- Z_sep[, 1] + 6 * grp_sep # clusters track `grp_sep` closely
Y_sep <- grp_sep
Y_sep[sample(n_sep, 1)] <- 1 - Y_sep[sample(n_sep, 1)] # one flipped label
fit_sep <- estimate_lucid(
G = G_sep, Z = Z_sep, Y = matrix(Y_sep, ncol = 1),
lucid_model = "early", family = "binary", K = 2,
seed = 1, max_itr = 40, max_tot.itr = 80, tol = 1e-4
)## Fitting LUCID early model (K = 2)...
## Warning: LUCID early model: at least one cluster's outcome coefficient is
## extreme (|log-odds| > 10), the classic signature of (quasi-)complete separation
## between cluster membership and Y -- likely at small N. The reported odds ratio
## and its bootstrap CI for that coefficient are not reliable point/interval
## estimates. Consider fewer clusters, more data, or a penalized outcome model.
## Finished LUCID early model.
## (Intercept) LC2
## 5.257545e-02 2.364841e+09
outcome_penalty = "firth" refits the same outcome model
with Firth’s penalized-likelihood logistic regression (via the
logistf package) instead of plain glm().
Firth’s penalty keeps every coefficient finite and well-behaved under
separation, at the cost of a small, principled bias toward the null on
every outcome coefficient – not just the one that would
otherwise blow up. No warning fires because there is nothing left to
warn about:
fit_firth <- estimate_lucid(
G = G_sep, Z = Z_sep, Y = matrix(Y_sep, ncol = 1),
lucid_model = "early", family = "binary", K = 2,
seed = 1, max_itr = 40, max_tot.itr = 80, tol = 1e-4,
outcome_penalty = "firth"
)## Fitting LUCID early model (K = 2)...
## Finished LUCID early model.
## (Intercept) LC2
## 0.07688863 532.49784295
The same outcome_penalty argument works for the parallel
model type and for a serial model’s final (outcome-bearing) stage; it is
rejected with a clear error for family = "normal", which
has no equivalent separation to correct for. boot_lucid()
picks up whichever outcome_penalty the model was fit with
automatically – there is nothing extra to pass when bootstrapping a
Firth-fit model.
# Serial structure: list of early-stage matrices.
Z_serial_all_early <- list(
methylome = Z_parallel_miss[[1]],
transcriptome = Z_parallel_miss[[2]],
miRNA = Z_parallel_miss[[3]]
)
set.seed(1305)
serial_ae_pen_bin <- estimate_lucid(
lucid_model = "serial",
G = G,
Z = Z_serial_all_early,
Y = Y_binary,
CoG = CoG,
CoY = CoY,
family = "binary",
K = list(2, 2, 2),
Rho_G = RHO_G,
Rho_Z_Mu = 0,
Rho_Z_Cov = 0,
max_itr = 15,
max_tot.itr = 40,
tol = 1e-2,
seed = 1305,
verbose = FALSE
)## Fitting LUCID serial model (3 stages)...
## Stage 1/3 (early) finished: log-likelihood = -1287.059. Selected G: 3/9; Selected Z: 10/10.
## Stage 2/3 (early) finished: log-likelihood = -1274.992.
## Stage 3/3 (early) finished: log-likelihood = -1340.704.
## Finished LUCID serial model.
##
## ====================================================
## LUCID Serial: Model Summary
## ====================================================
##
## Model specification
## Family : binary
## Number of observations : 90
## Number of stages : 3
## Stage 1 : early (K = 2)
## Stage 2 : early (K = 2)
## Stage 3 : early (K = 2)
##
## Missing-data profile by stage
## Stage 1
## Listwise rows : 1
## Sporadic rows : 0
## Stage 2
## Listwise rows : 0
## Sporadic rows : 1
## Stage 3
## Listwise rows : 0
## Sporadic rows : 1
##
## Model fit statistics
## Log-likelihood : -3902.75
## BIC : 9623.43
## basis: Eq 26 (sum over stages), unstructured covariance count; not comparable across lucid_model
## Number of parameters : 404
##
## Regularization
## Rho_G : 0.050
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Stage-wise detailed parameter estimates
##
## --- Stage 1 (early) ---
##
## ====================================================
## LUCID Early Integration: Model Summary
## ====================================================
##
## Model specification
## Family : normal
## Number of observations : 90
## Number of clusters (K) : 2
##
## Missing-data profile
## Listwise missing rows : 1 / 90 (1.1%)
## Sporadic missing rows : 0 / 90 (0.0%)
## Missing cells total : 10 / 900 (1.1%)
##
## Feature selection overview
## G features selected : 3 / 9 (33.3%)
## Z features selected : 10 / 10 (100.0%)
##
## Model fit statistics
## Log-likelihood : -1287.06
## BIC : 3186.09
## Number of parameters : 136
##
## Regularization
## Rho_G : 0.050
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## (1) Z: mean of omics data for each latent cluster
## mu_cluster1 mu_cluster2
## cg_GRHL3 0.06820761 2.91940270
## cg_BTF3L4 0.02663495 2.95759437
## cg_AL358472.7 -0.06064781 3.05224580
## cg_HDGF 0.15452614 -0.17046767
## cg_TDRD5 -0.07822662 0.08181282
## cg_CSRNP3 -0.05416285 0.06765855
## cg_HSPD1 -0.04248603 0.03342169
## cg_EPM2AIP1 0.01938202 -0.02326899
## cg_AC025171.1 -0.08161994 0.06058118
## cg_VTRNA1_3 0.11573947 -0.15850969
##
## (2) E: intercept and odds ratio of being assigned to each latent cluster for each exposure
## beta OR
## (Intercept).cluster2 -0.92921003 0.3948655
## g_causal_1.cluster2 0.78286144 2.1877234
## g_causal_2.cluster2 -0.72414056 0.4847410
## g_causal_3.cluster2 0.17561725 1.1919817
## hs_child_age_yrs_None.cluster2 0.06196068 1.0639205
## sex_male.cluster2 0.72247549 2.0595252
##
## --- Stage 2 (early) ---
##
## ====================================================
## LUCID Early Integration: Model Summary
## ====================================================
##
## Model specification
## Family : normal
## Number of observations : 90
## Number of clusters (K) : 2
##
## Missing-data profile
## Listwise missing rows : 0 / 90 (0.0%)
## Sporadic missing rows : 1 / 90 (1.1%)
## Missing cells total : 1 / 900 (0.1%)
##
## Feature selection overview
## G features selected : 1 / 1 (100.0%)
## Z features selected : 10 / 10 (100.0%)
##
## Model fit statistics
## Log-likelihood : -1274.99
## BIC : 3143.96
## Number of parameters : 132
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## (1) Z: mean of omics data for each latent cluster
## mu_cluster1 mu_cluster2
## tc_TC01006069_nc -0.201065468 -2.771338575
## tc_SLC9A4 0.036738145 -3.051490130
## tc_RAB6C_AS1 -0.168261636 -2.808859523
## tc_LOC100129029 0.045893160 -0.052492491
## tc_BRE 0.096758493 -0.110672143
## tc_TC03001220_nc -0.051546320 0.058958563
## tc_TC04002114_nc 0.031861266 -0.036442843
## tc_TC04002369_nc -0.069795149 0.079831532
## tc_BEND4 0.054850664 -0.062738064
## tc_SLC9A3 0.001476431 -0.001688738
##
## (2) E: intercept and odds ratio of being assigned to each latent cluster for each cluster from the previous serial stage
## beta OR
## (Intercept).cluster2 -4.166814 1.550158e-02
## Stage1.cluster2.cluster2 8.148500 3.458188e+03
##
## --- Stage 3 (early) ---
##
## ====================================================
## LUCID Early Integration: Model Summary
## ====================================================
##
## Model specification
## Family : binary
## Number of observations : 90
## Number of clusters (K) : 2
##
## Missing-data profile
## Listwise missing rows : 0 / 90 (0.0%)
## Sporadic missing rows : 1 / 90 (1.1%)
## Missing cells total : 1 / 900 (0.1%)
##
## Feature selection overview
## G features selected : 1 / 1 (100.0%)
## Z features selected : 10 / 10 (100.0%)
##
## Model fit statistics
## Log-likelihood : -1340.70
## BIC : 3293.38
## Number of parameters : 136
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## (1) Y (binary outcome): log odds of Y for cluster 1 (reference) and log OR for rest cluster (and log OR of covariate if included)
## gamma exp(gamma)
## (Intercept) 0.04815399 1.0493322
## LC2 0.40861257 1.5047286
## hs_child_age_yrs_None -0.06033746 0.9414468
## sex_male 0.19153610 1.2111086
##
## (2) Z: mean of omics data for each latent cluster
## mu_cluster1 mu_cluster2
## miR.101.3p 0.27768780 1.9177438
## miR.125a.5p 0.98500594 1.5806107
## miR.125b.1.3p 1.51302548 1.3508099
## miR.127.3p -0.08593751 0.0374011
## miR.140.5p -0.93950153 0.4088831
## miR.142.3p -1.14284517 0.4973808
## miR.144.5p -1.05610663 0.4596311
## miR.19a.3p -1.04625200 0.4553423
## miR.19b.3p -1.13354419 0.4933329
## miR.21.5p -0.99294774 0.4321436
##
## (3) E: intercept and odds ratio of being assigned to each latent cluster for each cluster from the previous serial stage
## beta OR
## (Intercept).cluster2 0.7432047 2.102663
## Stage2.cluster2.cluster2 0.1941445 1.214272
set.seed(1306)
serial_ae_inputs_bin <- prepare_serial_selected_inputs(serial_ae_pen_bin, G, Z_serial_all_early)
serial_ae_bin <- list(fit_pen = serial_ae_pen_bin, inputs = serial_ae_inputs_bin)
serial_ae_bin$fit_refit <- refit_selected(
"serial",
fit_pen = serial_ae_pen_bin,
inputs = serial_ae_inputs_bin,
Y = Y_binary,
CoG = CoG,
CoY = CoY,
seed = 1306
)## Fitting LUCID serial model (3 stages)...
## Stage 1/3 (early) finished: log-likelihood = -1282.610.
## Stage 2/3 (early) finished: log-likelihood = -1269.073.
## Stage 3/3 (early) finished: log-likelihood = -1340.709.
## Finished LUCID serial model.
##
## ====================================================
## LUCID Serial: Model Summary
## ====================================================
##
## Model specification
## Family : binary
## Number of observations : 90
## Number of stages : 3
## Stage 1 : early (K = 2)
## Stage 2 : early (K = 2)
## Stage 3 : early (K = 2)
##
## Missing-data profile by stage
## Stage 1
## Listwise rows : 1
## Sporadic rows : 0
## Stage 2
## Listwise rows : 0
## Sporadic rows : 1
## Stage 3
## Listwise rows : 0
## Sporadic rows : 1
##
## Model fit statistics
## Log-likelihood : -3892.39
## BIC : 9602.71
## basis: Eq 26 (sum over stages), unstructured covariance count; not comparable across lucid_model
## Number of parameters : 404
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Stage-wise detailed parameter estimates
##
## --- Stage 1 (early) ---
##
## ====================================================
## LUCID Early Integration: Model Summary
## ====================================================
##
## Model specification
## Family : normal
## Number of observations : 90
## Number of clusters (K) : 2
##
## Missing-data profile
## Listwise missing rows : 1 / 90 (1.1%)
## Sporadic missing rows : 0 / 90 (0.0%)
## Missing cells total : 10 / 900 (1.1%)
##
## Feature selection overview
## G features selected : 3 / 3 (100.0%)
## Z features selected : 10 / 10 (100.0%)
##
## Model fit statistics
## Log-likelihood : -1282.61
## BIC : 3177.20
## Number of parameters : 136
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## (1) Z: mean of omics data for each latent cluster
## mu_cluster1 mu_cluster2
## cg_GRHL3 0.092729932 2.924084599
## cg_BTF3L4 0.049658036 2.965004764
## cg_AL358472.7 -0.052431428 3.079414792
## cg_HDGF 0.160816888 -0.181801277
## cg_TDRD5 -0.080499093 0.086412900
## cg_CSRNP3 -0.055937851 0.071213839
## cg_HSPD1 -0.016497116 0.003430794
## cg_EPM2AIP1 -0.009417789 0.010457666
## cg_AC025171.1 -0.077589643 0.057477849
## cg_VTRNA1_3 0.124946894 -0.172708086
##
## (2) E: intercept and odds ratio of being assigned to each latent cluster for each exposure
## beta OR
## (Intercept).cluster2 -2.7700220 0.06266063
## g_causal_1.cluster2 1.5849703 4.87914635
## g_causal_2.cluster2 -1.5875889 0.20441789
## g_causal_3.cluster2 0.6151657 1.84996306
## hs_child_age_yrs_None.cluster2 0.2879486 1.33368877
## sex_male.cluster2 1.2091101 3.35050180
##
## --- Stage 2 (early) ---
##
## ====================================================
## LUCID Early Integration: Model Summary
## ====================================================
##
## Model specification
## Family : normal
## Number of observations : 90
## Number of clusters (K) : 2
##
## Missing-data profile
## Listwise missing rows : 0 / 90 (0.0%)
## Sporadic missing rows : 1 / 90 (1.1%)
## Missing cells total : 1 / 900 (0.1%)
##
## Feature selection overview
## G features selected : 1 / 1 (100.0%)
## Z features selected : 10 / 10 (100.0%)
##
## Model fit statistics
## Log-likelihood : -1269.07
## BIC : 3132.12
## Number of parameters : 132
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## (1) Z: mean of omics data for each latent cluster
## mu_cluster1 mu_cluster2
## tc_TC01006069_nc -0.2003365163 -2.7709684361
## tc_SLC9A4 0.0375911796 -3.0509940813
## tc_RAB6C_AS1 -0.1682740763 -2.8076092056
## tc_LOC100129029 0.0458010859 -0.0523412140
## tc_BRE 0.0981279738 -0.1121400764
## tc_TC03001220_nc -0.0526961877 0.0602208961
## tc_TC04002114_nc 0.0318289365 -0.0363739231
## tc_TC04002369_nc -0.0691382902 0.0790108350
## tc_BEND4 0.0553390226 -0.0632411125
## tc_SLC9A3 0.0008660931 -0.0009897661
##
## (2) E: intercept and odds ratio of being assigned to each latent cluster for each cluster from the previous serial stage
## beta OR
## (Intercept).cluster2 -6.247459 1.935365e-03
## Stage1.cluster2.cluster2 19.784408 3.910744e+08
##
## --- Stage 3 (early) ---
##
## ====================================================
## LUCID Early Integration: Model Summary
## ====================================================
##
## Model specification
## Family : binary
## Number of observations : 90
## Number of clusters (K) : 2
##
## Missing-data profile
## Listwise missing rows : 0 / 90 (0.0%)
## Sporadic missing rows : 1 / 90 (1.1%)
## Missing cells total : 1 / 900 (0.1%)
##
## Feature selection overview
## G features selected : 1 / 1 (100.0%)
## Z features selected : 10 / 10 (100.0%)
##
## Model fit statistics
## Log-likelihood : -1340.71
## BIC : 3293.39
## Number of parameters : 136
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## (1) Y (binary outcome): log odds of Y for cluster 1 (reference) and log OR for rest cluster (and log OR of covariate if included)
## gamma exp(gamma)
## (Intercept) 0.05012227 1.0513996
## LC2 0.40901143 1.5053289
## hs_child_age_yrs_None -0.06071080 0.9410954
## sex_male 0.19088824 1.2103242
##
## (2) Z: mean of omics data for each latent cluster
## mu_cluster1 mu_cluster2
## miR.101.3p 0.27341935 1.91522133
## miR.125a.5p 0.98196716 1.58036164
## miR.125b.1.3p 1.51043317 1.35235324
## miR.127.3p -0.08576297 0.03700272
## miR.140.5p -0.94410530 0.40733734
## miR.142.3p -1.14727715 0.49499650
## miR.144.5p -1.06161510 0.45803733
## miR.19a.3p -1.04893067 0.45256459
## miR.19b.3p -1.13793155 0.49096431
## miR.21.5p -0.99829752 0.43071875
##
## (3) E: intercept and odds ratio of being assigned to each latent cluster for each cluster from the previous serial stage
## beta OR
## (Intercept).cluster2 0.752771 2.122874
## Stage2.cluster2.cluster2 0.192112 1.211806
set.seed(1307)
serial_ae_bin$boot <- boot_lucid(
G = serial_ae_inputs_bin$G,
Z = serial_ae_inputs_bin$Z,
Y = Y_binary,
CoG = CoG,
CoY = CoY,
model = serial_ae_bin$fit_refit,
R = 30,
conf = 0.90
)
summary(serial_ae_bin$fit_refit, boot.se = serial_ae_bin$boot)##
## ====================================================
## LUCID Serial: Model Summary
## ====================================================
##
## Model specification
## Family : binary
## Number of observations : 90
## Number of stages : 3
## Stage 1 : early (K = 2)
## Stage 2 : early (K = 2)
## Stage 3 : early (K = 2)
##
## Missing-data profile by stage
## Stage 1
## Listwise rows : 1
## Sporadic rows : 0
## Stage 2
## Listwise rows : 0
## Sporadic rows : 1
## Stage 3
## Listwise rows : 0
## Sporadic rows : 1
##
## Model fit statistics
## Log-likelihood : -3892.39
## BIC : 9602.71
## basis: Eq 26 (sum over stages), unstructured covariance count; not comparable across lucid_model
## Number of parameters : 404
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Stage-wise detailed parameter estimates
## Bootstrap 90% confidence limits (normal-theory, bias-corrected: centred on
## 2*t0 - mean(t), so they need not bracket `estimate`). `sig` is assessed on
## the coefficient scale (null = 0); "NA" means no interval could be formed.
## Where an OR column is shown it is exp() of each coefficient column, so the
## intercept row is a baseline odds, not an odds ratio.
##
## --- Stage 1 (early) ---
##
## ====================================================
## LUCID Early Integration: Model Summary
## ====================================================
##
## Model specification
## Family : normal
## Number of observations : 90
## Number of clusters (K) : 2
##
## Missing-data profile
## Listwise missing rows : 1 / 90 (1.1%)
## Sporadic missing rows : 0 / 90 (0.0%)
## Missing cells total : 10 / 900 (1.1%)
##
## Feature selection overview
## G features selected : 3 / 3 (100.0%)
## Z features selected : 10 / 10 (100.0%)
##
## Model fit statistics
## Log-likelihood : -1282.61
## BIC : 3177.20
## Number of parameters : 136
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## (1) Z: mean of omics data for each latent cluster
## estimate norm_lower norm_upper sig
## cg_GRHL3.cluster1 0.092729932 -0.13807490 0.3242636
## cg_BTF3L4.cluster1 0.049658036 -0.21409101 0.3451444
## cg_AL358472.7.cluster1 -0.052431428 -0.25384689 0.1583762
## cg_HDGF.cluster1 0.160816888 -0.04751966 0.4050466
## cg_TDRD5.cluster1 -0.080499093 -0.29315205 0.1473830
## cg_CSRNP3.cluster1 -0.055937851 -0.26326714 0.1793713
## cg_HSPD1.cluster1 -0.016497116 -0.34784395 0.3103621
## cg_EPM2AIP1.cluster1 -0.009417789 -0.27245577 0.2345533
## cg_AC025171.1.cluster1 -0.077589643 -0.35475735 0.2055902
## cg_VTRNA1_3.cluster1 0.124946894 -0.14150242 0.2893028
## cg_GRHL3.cluster2 2.924084599 2.62910792 3.2467940 *
## cg_BTF3L4.cluster2 2.965004764 2.62065172 3.3133999 *
## cg_AL358472.7.cluster2 3.079414792 2.76087784 3.4808388 *
## cg_HDGF.cluster2 -0.181801277 -0.48470849 0.1510064
## cg_TDRD5.cluster2 0.086412900 -0.19653336 0.4727615
## cg_CSRNP3.cluster2 0.071213839 -0.27250885 0.4276220
## cg_HSPD1.cluster2 0.003430794 -0.27721384 0.3117804
## cg_EPM2AIP1.cluster2 0.010457666 -0.29347514 0.3710709
## cg_AC025171.1.cluster2 0.057477849 -0.20507988 0.2627306
## cg_VTRNA1_3.cluster2 -0.172708086 -0.46910123 0.1144925
##
## (2) E: cluster-assignment coefficients (log-odds scale) for each exposure, with bootstrap interval and the odds ratio (exp of each column). `sig` marks intervals excluding the null.
## estimate norm_lower norm_upper OR
## (Intercept).cluster2 -2.7700220 -7.0671418 3.4756757 0.06266063
## g_causal_1.cluster2 1.5849703 -0.1993842 2.4292687 4.87914635
## g_causal_2.cluster2 -1.5875889 -2.2347201 -0.2774298 0.20441789
## g_causal_3.cluster2 0.6151657 -0.3655569 1.1422268 1.84996306
## hs_child_age_yrs_None.cluster2 0.2879486 -0.5504709 0.8771604 1.33368877
## sex_male.cluster2 1.2091101 -0.5788727 2.7531879 3.35050180
## OR_lower OR_upper sig
## (Intercept).cluster2 0.0008526667 32.3196609
## g_causal_1.cluster2 0.8192350584 11.3505788
## g_causal_2.cluster2 0.1070220840 0.7577287 *
## g_causal_3.cluster2 0.6938101470 3.1337388
## hs_child_age_yrs_None.cluster2 0.5766781921 2.4040635
## sex_male.cluster2 0.5605299153 15.6925788
##
## --- Stage 2 (early) ---
##
## ====================================================
## LUCID Early Integration: Model Summary
## ====================================================
##
## Model specification
## Family : normal
## Number of observations : 90
## Number of clusters (K) : 2
##
## Missing-data profile
## Listwise missing rows : 0 / 90 (0.0%)
## Sporadic missing rows : 1 / 90 (1.1%)
## Missing cells total : 1 / 900 (0.1%)
##
## Feature selection overview
## G features selected : 1 / 1 (100.0%)
## Z features selected : 10 / 10 (100.0%)
##
## Model fit statistics
## Log-likelihood : -1269.07
## BIC : 3132.12
## Number of parameters : 132
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## (1) Z: mean of omics data for each latent cluster
## estimate norm_lower norm_upper sig
## tc_TC01006069_nc.cluster1 -0.2003365163 -0.45299322 0.008181395
## tc_SLC9A4.cluster1 0.0375911796 -0.17246727 0.252336591
## tc_RAB6C_AS1.cluster1 -0.1682740763 -0.36353213 0.074951903
## tc_LOC100129029.cluster1 0.0458010859 -0.12686643 0.234776487
## tc_BRE.cluster1 0.0981279738 -0.06902136 0.331330958
## tc_TC03001220_nc.cluster1 -0.0526961877 -0.27625868 0.133782267
## tc_TC04002114_nc.cluster1 0.0318289365 -0.18982086 0.303408400
## tc_TC04002369_nc.cluster1 -0.0691382902 -0.29853457 0.086811349
## tc_BEND4.cluster1 0.0553390226 -0.18124584 0.229349628
## tc_SLC9A3.cluster1 0.0008660931 -0.20256070 0.217690608
## tc_TC01006069_nc.cluster2 -2.7709684361 -2.94290240 -2.500741892 *
## tc_SLC9A4.cluster2 -3.0509940813 -3.30991493 -2.787537643 *
## tc_RAB6C_AS1.cluster2 -2.8076092056 -3.02065805 -2.567702720 *
## tc_LOC100129029.cluster2 -0.0523412140 -0.30974565 0.279382727
## tc_BRE.cluster2 -0.1121400764 -0.38742618 0.107845196
## tc_TC03001220_nc.cluster2 0.0602208961 -0.29964702 0.398133976
## tc_TC04002114_nc.cluster2 -0.0363739231 -0.18185322 0.233729474
## tc_TC04002369_nc.cluster2 0.0790108350 -0.16795327 0.329880377
## tc_BEND4.cluster2 -0.0632411125 -0.26631226 0.117328142
## tc_SLC9A3.cluster2 -0.0009897661 -0.26059301 0.219973550
##
## (2) E: cluster-assignment coefficients (log-odds scale) for each cluster from the previous serial stage, with bootstrap interval and the odds ratio (exp of each column). `sig` marks intervals excluding the null.
## estimate norm_lower norm_upper OR
## (Intercept).cluster2 -6.247459 -30.30143 36.96363 1.935365e-03
## Stage1.cluster2.cluster2 19.784408 -64.05315 47.94675 3.910744e+08
## OR_lower OR_upper sig
## (Intercept).cluster2 6.922370e-14 1.130056e+16
## Stage1.cluster2.cluster2 1.520793e-28 6.652861e+20
##
## --- Stage 3 (early) ---
##
## ====================================================
## LUCID Early Integration: Model Summary
## ====================================================
##
## Model specification
## Family : binary
## Number of observations : 90
## Number of clusters (K) : 2
##
## Missing-data profile
## Listwise missing rows : 0 / 90 (0.0%)
## Sporadic missing rows : 1 / 90 (1.1%)
## Missing cells total : 1 / 900 (0.1%)
##
## Feature selection overview
## G features selected : 1 / 1 (100.0%)
## Z features selected : 10 / 10 (100.0%)
##
## Model fit statistics
## Log-likelihood : -1340.71
## BIC : 3293.39
## Number of parameters : 136
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## (1) Y (binary outcome): log odds / log OR (coefficient scale) with bootstrap interval, and the odds ratio (exp of each column). `sig` marks intervals excluding the null.
## gamma norm_lower norm_upper OR OR_lower
## (Intercept) 0.05012227 -2.3432267 3.6826674 1.0513996 0.09601731
## LC2 0.40901143 -0.7407253 1.3959886 1.5053289 0.47676801
## hs_child_age_yrs_None -0.06071080 -0.5135645 0.2094228 0.9410954 0.59835891
## sex_male 0.19088824 -0.4751297 1.2525771 1.2103242 0.62180439
## OR_upper sig
## (Intercept) 39.752286
## LC2 4.038966
## hs_child_age_yrs_None 1.232966
## sex_male 3.499350
##
## (2) Z: mean of omics data for each latent cluster
## estimate norm_lower norm_upper sig
## miR.101.3p.cluster1 0.27341935 -0.5303233 1.1564420
## miR.125a.5p.cluster1 0.98196716 0.2423103 1.7614972 *
## miR.125b.1.3p.cluster1 1.51043317 0.7626846 2.3768997 *
## miR.127.3p.cluster1 -0.08576297 -0.4391193 0.3745346
## miR.140.5p.cluster1 -0.94410530 -1.2366874 -0.7198152 *
## miR.142.3p.cluster1 -1.14727715 -1.5752293 -0.7754436 *
## miR.144.5p.cluster1 -1.06161510 -1.5149600 -0.6679634 *
## miR.19a.3p.cluster1 -1.04893067 -1.3833030 -0.7162696 *
## miR.19b.3p.cluster1 -1.13793155 -1.5065029 -0.8033253 *
## miR.21.5p.cluster1 -0.99829752 -1.3850395 -0.6313075 *
## miR.101.3p.cluster2 1.91522133 1.4139428 2.4285612 *
## miR.125a.5p.cluster2 1.58036164 1.1675538 2.0361686 *
## miR.125b.1.3p.cluster2 1.35235324 0.8519763 1.8704345 *
## miR.127.3p.cluster2 0.03700272 -0.2110043 0.1761219
## miR.140.5p.cluster2 0.40733734 0.1773469 0.5379277 *
## miR.142.3p.cluster2 0.49499650 0.3004467 0.6299440 *
## miR.144.5p.cluster2 0.45803733 0.2779391 0.5756512 *
## miR.19a.3p.cluster2 0.45256459 0.2239538 0.5978423 *
## miR.19b.3p.cluster2 0.49096431 0.2912471 0.6127694 *
## miR.21.5p.cluster2 0.43071875 0.2156096 0.5512473 *
##
## (3) E: cluster-assignment coefficients (log-odds scale) for each cluster from the previous serial stage, with bootstrap interval and the odds ratio (exp of each column). `sig` marks intervals excluding the null.
## estimate norm_lower norm_upper OR OR_lower
## (Intercept).cluster2 0.752771 -0.03133885 1.545278 2.122874 0.9691471
## Stage2.cluster2.cluster2 0.192112 -1.33327649 1.673574 1.211806 0.2636121
## OR_upper sig
## (Intercept).cluster2 4.689274
## Stage2.cluster2.cluster2 5.331190
For a serial model the outcome family applies to the final stage only. Upstream stages are fitted unsupervised regardless of what you pass, because the outcome enters the chain once, at the end – so the binary/normal distinction shows up in the last stage’s report and nowhere else.
# Nested list signals a parallel submodel at stage 1, followed by early stage 2.
Z_serial_mixed <- list(
list(
methylome = Z_parallel_miss[[1]],
transcriptome = Z_parallel_miss[[2]]
),
miRNA = Z_parallel_miss[[3]]
)
set.seed(1405)
serial_mixed_pen_bin <- estimate_lucid(
lucid_model = "serial",
G = G,
Z = Z_serial_mixed,
Y = Y_binary,
CoG = CoG,
CoY = CoY,
family = "binary",
K = list(list(2, 2), 2),
Rho_G = RHO_G,
Rho_Z_Mu = 0,
Rho_Z_Cov = 0,
max_itr = 15,
max_tot.itr = 40,
tol = 1e-2,
seed = 1405,
verbose = FALSE
)## Fitting LUCID serial model (2 stages)...
## Stage 1/2 (parallel) finished: log-likelihood = -2587.512. Selected G: 3/9; Selected Z by layer: 10/10, 10/10.
## Stage 2/2 (early) finished: log-likelihood = -1340.392.
## Finished LUCID serial model.
##
## ====================================================
## LUCID Serial: Model Summary
## ====================================================
##
## Model specification
## Family : binary
## Number of observations : 90
## Number of stages : 2
## Stage 1 : parallel (K = 2,2)
## Stage 2 : early (K = 2)
##
## Missing-data profile by stage
## Stage 1
## Layer 1 listwise/sporadic rows : 1 / 0
## Layer 2 listwise/sporadic rows : 0 / 1
## Stage 2
## Listwise rows : 0
## Sporadic rows : 1
##
## Model fit statistics
## Log-likelihood : -3927.90
## BIC : 9696.23
## basis: Eq 26 (sum over stages), unstructured covariance count; not comparable across lucid_model
## Number of parameters : 409
##
## Regularization
## Rho_G : 0.050
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Stage-wise detailed parameter estimates
##
## --- Stage 1 (parallel) ---
##
## ====================================================
## LUCID Parallel: Model Summary
## ====================================================
##
## Model specification
## Family : gaussian
## Number of observations : 90
## Clusters per layer : 2, 2
##
## Missing-data profile by layer
## Layer 1 listwise rows : 1 / 90 (1.1%)
## Layer 1 sporadic rows : 0 / 90 (0.0%)
## Layer 1 missing cells : 10 / 900 (1.1%)
## Layer 2 listwise rows : 0 / 90 (0.0%)
## Layer 2 sporadic rows : 1 / 90 (1.1%)
## Layer 2 missing cells : 1 / 900 (0.1%)
##
## Feature selection overview
## G features selected : 3 / 9 (33.3%)
## G features by layer
## Layer 1 : 3 / 9 (33.3%)
## Layer 2 : 3 / 9 (33.3%)
## Z features
## Layer 1 selected : 10 / 10 (100.0%)
## Layer 1 multi-cluster: 10
## Layer 2 selected : 10 / 10 (100.0%)
## Layer 2 multi-cluster: 10
##
## Model fit statistics
## Log-likelihood : -2587.51
## BIC : 6398.97
## Number of parameters : 272
##
## Regularization
## Rho_G : 0.050
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## (1) Z: mean of omics data for each latent cluster of each layer
## Layer 1
##
## mu_cluster1 mu_cluster2
## cg_GRHL3 0.06824050 2.91943068
## cg_BTF3L4 0.02667506 2.95761581
## cg_AL358472.7 -0.06062902 3.05229627
## cg_HDGF 0.15453861 -0.17048973
## cg_TDRD5 -0.07823464 0.08182587
## cg_CSRNP3 -0.05416083 0.06765904
## cg_HSPD1 -0.04246050 0.03339376
## cg_EPM2AIP1 0.01933596 -0.02321641
## cg_AC025171.1 -0.08163426 0.06060114
## cg_VTRNA1_3 0.11574756 -0.15852548
##
## Layer 2
##
## mu_cluster1 mu_cluster2
## tc_TC01006069_nc -0.199216235 -2.77555529
## tc_SLC9A4 0.025095337 -3.04045464
## tc_RAB6C_AS1 -0.159417468 -2.82114668
## tc_LOC100129029 0.047027325 -0.05387205
## tc_BRE 0.069899207 -0.08007289
## tc_TC03001220_nc -0.029066831 0.03329745
## tc_TC04002114_nc 0.041639885 -0.04770048
## tc_TC04002369_nc -0.086352208 0.09892059
## tc_BEND4 0.043804062 -0.05017965
## tc_SLC9A3 0.006347007 -0.00727080
##
## (2) E: intercept and odds ratio of being assigned to each latent cluster for each exposure for each layer
## Layer 1
##
## beta OR
## (Intercept).cluster2 -0.92988224 0.3946002
## g_causal_1.cluster2 0.78293631 2.1878872
## g_causal_2.cluster2 -0.72417618 0.4847237
## g_causal_3.cluster2 0.17564966 1.1920204
## hs_child_age_yrs_None.cluster2 0.06204425 1.0640094
## sex_male.cluster2 0.72252918 2.0596358
##
## Layer 2
##
## beta OR
## (Intercept).cluster2 -1.1963272 0.3023025
## g_causal_1.cluster2 0.9795259 2.6631933
## g_causal_2.cluster2 -0.8287353 0.4366011
## g_causal_3.cluster2 0.2247956 1.2520668
## hs_child_age_yrs_None.cluster2 0.1003193 1.1055238
## sex_male.cluster2 0.7185225 2.0514000
##
##
## --- Stage 2 (early) ---
##
## ====================================================
## LUCID Early Integration: Model Summary
## ====================================================
##
## Model specification
## Family : binary
## Number of observations : 90
## Number of clusters (K) : 2
##
## Missing-data profile
## Listwise missing rows : 0 / 90 (0.0%)
## Sporadic missing rows : 1 / 90 (1.1%)
## Missing cells total : 1 / 900 (0.1%)
##
## Feature selection overview
## G features selected : 2 / 2 (100.0%)
## Z features selected : 10 / 10 (100.0%)
##
## Model fit statistics
## Log-likelihood : -1340.39
## BIC : 3297.26
## Number of parameters : 137
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## (1) Y (binary outcome): log odds of Y for cluster 1 (reference) and log OR for rest cluster (and log OR of covariate if included)
## gamma exp(gamma)
## (Intercept) 0.04802312 1.0491949
## LC2 0.41125670 1.5087126
## hs_child_age_yrs_None -0.06064382 0.9411584
## sex_male 0.19110988 1.2105925
##
## (2) Z: mean of omics data for each latent cluster
## mu_cluster1 mu_cluster2
## miR.101.3p 0.27233339 1.91608329
## miR.125a.5p 0.98095536 1.58094040
## miR.125b.1.3p 1.50932686 1.35279347
## miR.127.3p -0.08635162 0.03728599
## miR.140.5p -0.94355318 0.40741933
## miR.142.3p -1.14688508 0.49521655
## miR.144.5p -1.06095928 0.45811442
## miR.19a.3p -1.04858347 0.45277063
## miR.19b.3p -1.13734415 0.49109685
## miR.21.5p -0.99769693 0.43079820
##
## (3) E: intercept and odds ratio of being assigned to each latent cluster for each cluster from the previous serial stage
## beta OR
## (Intercept).cluster2 0.7277081 2.0703302
## Stage1.Layer1.cluster2.cluster2 -1.0092655 0.3644866
## Stage1.Layer2.cluster2.cluster2 1.2702035 3.5615772
set.seed(1406)
serial_mixed_inputs_bin <- prepare_serial_selected_inputs(serial_mixed_pen_bin, G, Z_serial_mixed)
serial_mixed_bin <- list(fit_pen = serial_mixed_pen_bin, inputs = serial_mixed_inputs_bin)
serial_mixed_bin$fit_refit <- refit_selected(
"serial",
fit_pen = serial_mixed_pen_bin,
inputs = serial_mixed_inputs_bin,
Y = Y_binary,
CoG = CoG,
CoY = CoY,
seed = 1406
)## Fitting LUCID serial model (2 stages)...
## Stage 1/2 (parallel) finished: log-likelihood = -2577.859.
## Stage 2/2 (early) finished: log-likelihood = -1339.952.
## Finished LUCID serial model.
##
## ====================================================
## LUCID Serial: Model Summary
## ====================================================
##
## Model specification
## Family : binary
## Number of observations : 90
## Number of stages : 2
## Stage 1 : parallel (K = 2,2)
## Stage 2 : early (K = 2)
##
## Missing-data profile by stage
## Stage 1
## Layer 1 listwise/sporadic rows : 1 / 0
## Layer 2 listwise/sporadic rows : 0 / 1
## Stage 2
## Listwise rows : 0
## Sporadic rows : 1
##
## Model fit statistics
## Log-likelihood : -3917.81
## BIC : 9676.04
## basis: Eq 26 (sum over stages), unstructured covariance count; not comparable across lucid_model
## Number of parameters : 409
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Stage-wise detailed parameter estimates
##
## --- Stage 1 (parallel) ---
##
## ====================================================
## LUCID Parallel: Model Summary
## ====================================================
##
## Model specification
## Family : gaussian
## Number of observations : 90
## Clusters per layer : 2, 2
##
## Missing-data profile by layer
## Layer 1 listwise rows : 1 / 90 (1.1%)
## Layer 1 sporadic rows : 0 / 90 (0.0%)
## Layer 1 missing cells : 10 / 900 (1.1%)
## Layer 2 listwise rows : 0 / 90 (0.0%)
## Layer 2 sporadic rows : 1 / 90 (1.1%)
## Layer 2 missing cells : 1 / 900 (0.1%)
##
## Feature selection overview
## G features selected : 3 / 3 (100.0%)
## G features by layer
## Layer 1 : 3 / 3 (100.0%)
## Layer 2 : 3 / 3 (100.0%)
## Z features
## Layer 1 selected : 10 / 10 (100.0%)
## Layer 1 multi-cluster: 10
## Layer 2 selected : 10 / 10 (100.0%)
## Layer 2 multi-cluster: 10
##
## Model fit statistics
## Log-likelihood : -2577.86
## BIC : 6379.67
## Number of parameters : 272
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## (1) Z: mean of omics data for each latent cluster of each layer
## Layer 1
##
## mu_cluster1 mu_cluster2
## cg_GRHL3 0.09201930 2.922671466
## cg_BTF3L4 0.04883100 2.963662840
## cg_AL358472.7 -0.05343181 3.078106064
## cg_HDGF 0.16013492 -0.180718780
## cg_TDRD5 -0.08033188 0.086081410
## cg_CSRNP3 -0.05574867 0.070887963
## cg_HSPD1 -0.01644787 0.003356466
## cg_EPM2AIP1 -0.00841432 0.009250809
## cg_AC025171.1 -0.07734186 0.057076108
## cg_VTRNA1_3 0.12473309 -0.172217085
##
## Layer 2
##
## mu_cluster1 mu_cluster2
## tc_TC01006069_nc -0.1897279409 -2.7729567326
## tc_SLC9A4 0.0304628796 -3.0304024223
## tc_RAB6C_AS1 -0.1562302941 -2.8109571304
## tc_LOC100129029 0.0463491691 -0.0525794207
## tc_BRE 0.0758223483 -0.0860143823
## tc_TC03001220_nc -0.0339947238 0.0385642918
## tc_TC04002114_nc 0.0453792193 -0.0514790904
## tc_TC04002369_nc -0.0849538295 0.0963733165
## tc_BEND4 0.0450913494 -0.0511525250
## tc_SLC9A3 0.0002122488 -0.0002407793
##
## (2) E: intercept and odds ratio of being assigned to each latent cluster for each exposure for each layer
## Layer 1
##
## beta OR
## (Intercept).cluster2 -2.7608558 0.06323762
## g_causal_1.cluster2 1.5893083 4.90035808
## g_causal_2.cluster2 -1.5917584 0.20356734
## g_causal_3.cluster2 0.6144258 1.84859488
## hs_child_age_yrs_None.cluster2 0.2866122 1.33190766
## sex_male.cluster2 1.2173347 3.37817191
##
## Layer 2
##
## beta OR
## (Intercept).cluster2 -2.7601115 0.06328471
## g_causal_1.cluster2 1.9408046 6.96435194
## g_causal_2.cluster2 -1.9072777 0.14848406
## g_causal_3.cluster2 0.6784697 1.97085942
## hs_child_age_yrs_None.cluster2 0.2881334 1.33393521
## sex_male.cluster2 1.3409728 3.82276044
##
##
## --- Stage 2 (early) ---
##
## ====================================================
## LUCID Early Integration: Model Summary
## ====================================================
##
## Model specification
## Family : binary
## Number of observations : 90
## Number of clusters (K) : 2
##
## Missing-data profile
## Listwise missing rows : 0 / 90 (0.0%)
## Sporadic missing rows : 1 / 90 (1.1%)
## Missing cells total : 1 / 900 (0.1%)
##
## Feature selection overview
## G features selected : 2 / 2 (100.0%)
## Z features selected : 10 / 10 (100.0%)
##
## Model fit statistics
## Log-likelihood : -1339.95
## BIC : 3296.38
## Number of parameters : 137
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## (1) Y (binary outcome): log odds of Y for cluster 1 (reference) and log OR for rest cluster (and log OR of covariate if included)
## gamma exp(gamma)
## (Intercept) 0.04623454 1.0473200
## LC2 0.41155464 1.5091622
## hs_child_age_yrs_None -0.06038670 0.9414004
## sex_male 0.19155379 1.2111300
##
## (2) Z: mean of omics data for each latent cluster
## mu_cluster1 mu_cluster2
## miR.101.3p 0.27490929 1.91777766
## miR.125a.5p 0.98271249 1.58118683
## miR.125b.1.3p 1.51070115 1.35193341
## miR.127.3p -0.08670126 0.03764581
## miR.140.5p -0.94061384 0.40841585
## miR.142.3p -1.14404895 0.49674767
## miR.144.5p -1.05742605 0.45913588
## miR.19a.3p -1.04680174 0.45452279
## miR.19b.3p -1.13447595 0.49259106
## miR.21.5p -0.99426120 0.43170961
##
## (3) E: intercept and odds ratio of being assigned to each latent cluster for each cluster from the previous serial stage
## beta OR
## (Intercept).cluster2 0.7314214 2.07803221
## Stage1.Layer1.cluster2.cluster2 -3.3606635 0.03471222
## Stage1.Layer2.cluster2.cluster2 3.5946663 36.40354892
set.seed(1407)
serial_mixed_bin$boot <- boot_lucid(
G = serial_mixed_inputs_bin$G,
Z = serial_mixed_inputs_bin$Z,
Y = Y_binary,
CoG = CoG,
CoY = CoY,
model = serial_mixed_bin$fit_refit,
R = 30,
conf = 0.90
)
summary(serial_mixed_bin$fit_refit, boot.se = serial_mixed_bin$boot)##
## ====================================================
## LUCID Serial: Model Summary
## ====================================================
##
## Model specification
## Family : binary
## Number of observations : 90
## Number of stages : 2
## Stage 1 : parallel (K = 2,2)
## Stage 2 : early (K = 2)
##
## Missing-data profile by stage
## Stage 1
## Layer 1 listwise/sporadic rows : 1 / 0
## Layer 2 listwise/sporadic rows : 0 / 1
## Stage 2
## Listwise rows : 0
## Sporadic rows : 1
##
## Model fit statistics
## Log-likelihood : -3917.81
## BIC : 9676.04
## basis: Eq 26 (sum over stages), unstructured covariance count; not comparable across lucid_model
## Number of parameters : 409
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Stage-wise detailed parameter estimates
## Bootstrap 90% confidence limits (normal-theory, bias-corrected: centred on
## 2*t0 - mean(t), so they need not bracket `estimate`). `sig` is assessed on
## the coefficient scale (null = 0); "NA" means no interval could be formed.
## Where an OR column is shown it is exp() of each coefficient column, so the
## intercept row is a baseline odds, not an odds ratio.
##
## --- Stage 1 (parallel) ---
##
## ====================================================
## LUCID Parallel: Model Summary
## ====================================================
##
## Model specification
## Family : gaussian
## Number of observations : 90
## Clusters per layer : 2, 2
##
## Missing-data profile by layer
## Layer 1 listwise rows : 1 / 90 (1.1%)
## Layer 1 sporadic rows : 0 / 90 (0.0%)
## Layer 1 missing cells : 10 / 900 (1.1%)
## Layer 2 listwise rows : 0 / 90 (0.0%)
## Layer 2 sporadic rows : 1 / 90 (1.1%)
## Layer 2 missing cells : 1 / 900 (0.1%)
##
## Feature selection overview
## G features selected : 3 / 3 (100.0%)
## G features by layer
## Layer 1 : 3 / 3 (100.0%)
## Layer 2 : 3 / 3 (100.0%)
## Z features
## Layer 1 selected : 10 / 10 (100.0%)
## Layer 1 multi-cluster: 10
## Layer 2 selected : 10 / 10 (100.0%)
## Layer 2 multi-cluster: 10
##
## Model fit statistics
## Log-likelihood : -2577.86
## BIC : 6379.67
## Number of parameters : 272
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## (1) Z: mean of omics data for each latent cluster of each layer
## Layer 1
##
## estimate norm_lower norm_upper sig
## Layer1.cg_GRHL3.cluster1 0.092019296 -0.05802525 0.28607690
## Layer1.cg_BTF3L4.cluster1 0.048831003 -0.15116975 0.28606624
## Layer1.cg_AL358472.7.cluster1 -0.053431808 -0.21366042 0.14172609
## Layer1.cg_HDGF.cluster1 0.160134917 -0.08416709 0.38078801
## Layer1.cg_TDRD5.cluster1 -0.080331884 -0.22531468 0.12340726
## Layer1.cg_CSRNP3.cluster1 -0.055748672 -0.25084506 0.14221624
## Layer1.cg_HSPD1.cluster1 -0.016447874 -0.26560147 0.23188498
## Layer1.cg_EPM2AIP1.cluster1 -0.008414320 -0.28110357 0.23395220
## Layer1.cg_AC025171.1.cluster1 -0.077341860 -0.32922056 0.17141079
## Layer1.cg_VTRNA1_3.cluster1 0.124733085 -0.06373113 0.30399400
## Layer1.cg_GRHL3.cluster2 2.922671466 2.66022998 3.13115913 *
## Layer1.cg_BTF3L4.cluster2 2.963662840 2.64049391 3.24709111 *
## Layer1.cg_AL358472.7.cluster2 3.078106064 2.70610533 3.38738528 *
## Layer1.cg_HDGF.cluster2 -0.180718780 -0.48496878 0.07545887
## Layer1.cg_TDRD5.cluster2 0.086081410 -0.12188592 0.36459206
## Layer1.cg_CSRNP3.cluster2 0.070887963 -0.27837931 0.43779444
## Layer1.cg_HSPD1.cluster2 0.003356466 -0.32571835 0.28405834
## Layer1.cg_EPM2AIP1.cluster2 0.009250809 -0.30234421 0.32095591
## Layer1.cg_AC025171.1.cluster2 0.057076108 -0.28075207 0.30378316
## Layer1.cg_VTRNA1_3.cluster2 -0.172217085 -0.37612896 0.09096228
##
## Layer 2
##
## estimate norm_lower norm_upper sig
## Layer2.tc_TC01006069_nc.cluster1 -0.1897279409 -0.4745310 0.13676858
## Layer2.tc_SLC9A4.cluster1 0.0304628796 -0.2805677 0.30693056
## Layer2.tc_RAB6C_AS1.cluster1 -0.1562302941 -0.4570214 0.06632535
## Layer2.tc_LOC100129029.cluster1 0.0463491691 -0.2036613 0.30621743
## Layer2.tc_BRE.cluster1 0.0758223483 -0.1557967 0.27610390
## Layer2.tc_TC03001220_nc.cluster1 -0.0339947238 -0.2831927 0.27079562
## Layer2.tc_TC04002114_nc.cluster1 0.0453792193 -0.2156530 0.32868482
## Layer2.tc_TC04002369_nc.cluster1 -0.0849538295 -0.2949019 0.07087975
## Layer2.tc_BEND4.cluster1 0.0450913494 -0.1359024 0.32787927
## Layer2.tc_SLC9A3.cluster1 0.0002122488 -0.1949481 0.22854089
## Layer2.tc_TC01006069_nc.cluster2 -2.7729567326 -2.9475369 -2.51394912 *
## Layer2.tc_SLC9A4.cluster2 -3.0304024223 -3.3155868 -2.71039842 *
## Layer2.tc_RAB6C_AS1.cluster2 -2.8109571304 -2.9896550 -2.58203675 *
## Layer2.tc_LOC100129029.cluster2 -0.0525794207 -0.3133066 0.15285814
## Layer2.tc_BRE.cluster2 -0.0860143823 -0.3203714 0.14657620
## Layer2.tc_TC03001220_nc.cluster2 0.0385642918 -0.1932285 0.33704160
## Layer2.tc_TC04002114_nc.cluster2 -0.0514790904 -0.2927760 0.22122294
## Layer2.tc_TC04002369_nc.cluster2 0.0963733165 -0.2087161 0.38431867
## Layer2.tc_BEND4.cluster2 -0.0511525250 -0.3291723 0.21083733
## Layer2.tc_SLC9A3.cluster2 -0.0002407793 -0.3008074 0.17149358
##
## (2) E: cluster-assignment coefficients (log-odds scale) for each exposure for each layer, with bootstrap interval and the odds ratio (exp of each column). `sig` marks intervals excluding the null.
## Layer 1
##
## estimate norm_lower norm_upper OR
## (Intercept).cluster2 -2.7608558 -10.22081978 7.4987874 0.06323762
## g_causal_1.cluster2 1.5893083 -0.08408447 2.4906256 4.90035808
## g_causal_2.cluster2 -1.5917584 -2.92379616 0.5894861 0.20356734
## g_causal_3.cluster2 0.6144258 -0.60326089 1.2291647 1.84859488
## hs_child_age_yrs_None.cluster2 0.2866122 -0.96681307 1.2430677 1.33190766
## sex_male.cluster2 1.2173347 -1.23409009 2.9555230 3.37817191
## OR_lower OR_upper sig
## (Intercept).cluster2 3.640444e-05 1805.851243
## g_causal_1.cluster2 9.193536e-01 12.068824
## g_causal_2.cluster2 5.372933e-02 1.803062
## g_causal_3.cluster2 5.470249e-01 3.418373
## hs_child_age_yrs_None.cluster2 3.802931e-01 3.466230
## sex_male.cluster2 2.910995e-01 19.211768
##
## Layer 2
##
## estimate norm_lower norm_upper OR
## (Intercept).cluster2 -2.7601115 -10.84938174 8.1006759 0.06328471
## g_causal_1.cluster2 1.9408046 0.03736763 2.6664622 6.96435194
## g_causal_2.cluster2 -1.9072777 -3.15244458 0.3947398 0.14848406
## g_causal_3.cluster2 0.6784697 -0.82712472 1.4430097 1.97085942
## hs_child_age_yrs_None.cluster2 0.2881334 -1.03577457 1.3099278 1.33393521
## sex_male.cluster2 1.3409728 -1.00644584 2.9260458 3.82276044
## OR_lower OR_upper sig
## (Intercept).cluster2 1.941661e-05 3296.695719
## g_causal_1.cluster2 1.038075e+00 14.388974 *
## g_causal_2.cluster2 4.274750e-02 1.483998
## g_causal_3.cluster2 4.373049e-01 4.233418
## hs_child_age_yrs_None.cluster2 3.549513e-01 3.705906
## sex_male.cluster2 3.655158e-01 18.653724
##
##
## --- Stage 2 (early) ---
##
## ====================================================
## LUCID Early Integration: Model Summary
## ====================================================
##
## Model specification
## Family : binary
## Number of observations : 90
## Number of clusters (K) : 2
##
## Missing-data profile
## Listwise missing rows : 0 / 90 (0.0%)
## Sporadic missing rows : 1 / 90 (1.1%)
## Missing cells total : 1 / 900 (0.1%)
##
## Feature selection overview
## G features selected : 2 / 2 (100.0%)
## Z features selected : 10 / 10 (100.0%)
##
## Model fit statistics
## Log-likelihood : -1339.95
## BIC : 3296.38
## Number of parameters : 137
##
## Regularization
## Rho_G : 0.000
## Rho_Z_Mu : 0.000
## Rho_Z_Cov : 0.000
##
## Detailed parameter estimates
## (1) Y (binary outcome): log odds / log OR (coefficient scale) with bootstrap interval, and the odds ratio (exp of each column). `sig` marks intervals excluding the null.
## gamma norm_lower norm_upper OR OR_lower
## (Intercept) 0.04623454 -3.1205963 4.2553086 1.0473200 0.04413085
## LC2 0.41155464 -0.6056453 1.4226041 1.5091622 0.54572215
## hs_child_age_yrs_None -0.06038670 -0.6184094 0.3724323 0.9414004 0.53880077
## sex_male 0.19155379 -0.7030687 0.8305383 1.2111300 0.49506379
## OR_upper sig
## (Intercept) 70.478566
## LC2 4.147908
## hs_child_age_yrs_None 1.451260
## sex_male 2.294553
##
## (2) Z: mean of omics data for each latent cluster
## estimate norm_lower norm_upper sig
## miR.101.3p.cluster1 0.27490929 -0.4875830 0.9034606
## miR.125a.5p.cluster1 0.98271249 0.2875551 1.5920010 *
## miR.125b.1.3p.cluster1 1.51070115 0.8372887 2.1727013 *
## miR.127.3p.cluster1 -0.08670126 -0.3536203 0.2839231
## miR.140.5p.cluster1 -0.94061384 -1.1923058 -0.7788131 *
## miR.142.3p.cluster1 -1.14404895 -1.5906499 -0.8268737 *
## miR.144.5p.cluster1 -1.05742605 -1.5882987 -0.6747592 *
## miR.19a.3p.cluster1 -1.04680174 -1.4070705 -0.7771913 *
## miR.19b.3p.cluster1 -1.13447595 -1.5305402 -0.8724461 *
## miR.21.5p.cluster1 -0.99426120 -1.4119266 -0.6969507 *
## miR.101.3p.cluster2 1.91777766 1.4879725 2.4169417 *
## miR.125a.5p.cluster2 1.58118683 1.1781699 2.0013319 *
## miR.125b.1.3p.cluster2 1.35193341 0.9310515 1.9346314 *
## miR.127.3p.cluster2 0.03764581 -0.1830760 0.1708694
## miR.140.5p.cluster2 0.40841585 0.1716326 0.5867449 *
## miR.142.3p.cluster2 0.49674767 0.2805341 0.6458581 *
## miR.144.5p.cluster2 0.45913588 0.2368896 0.6469461 *
## miR.19a.3p.cluster2 0.45452279 0.2186242 0.5884157 *
## miR.19b.3p.cluster2 0.49259106 0.2946972 0.6435406 *
## miR.21.5p.cluster2 0.43170961 0.2475107 0.6058048 *
##
## (3) E: cluster-assignment coefficients (log-odds scale) for each cluster from the previous serial stage, with bootstrap interval and the odds ratio (exp of each column). `sig` marks intervals excluding the null.
## estimate norm_lower norm_upper OR
## (Intercept).cluster2 0.7314214 0.04884857 1.589637 2.07803221
## Stage1.Layer1.cluster2.cluster2 -3.3606635 -22.92910952 44.146674 0.03471222
## Stage1.Layer2.cluster2.cluster2 3.5946663 -44.15383895 23.484393 36.40354892
## OR_lower OR_upper sig
## (Intercept).cluster2 1.050061e+00 4.901971e+00 *
## Stage1.Layer1.cluster2.cluster2 1.101575e-10 1.488185e+19
## Stage1.Layer2.cluster2.cluster2 6.671621e-20 1.581766e+10
This is the most general configuration the package supports: a serial chain whose first stage is itself a parallel model over two omics layers, fitted to a binary outcome, with both listwise and sporadic missingness present. If this runs and reports sane estimates, the combination space is covered.
plot() renders an early-integration fit as a Sankey
diagram: exposures flow into the latent clusters, and the clusters flow
on into the omics features and the outcome. Everything about how to read
it – node colour, link width and sign – is exactly as in the
continuous-outcome case (see the companion vignette’s section 14); a
binary outcome only changes what the final cluster -> outcome link
represents (a log-odds effect rather than a mean difference).
As of 3.3.0 plot() works on a parallel or serial fit too
(both previously raised “still under development”). A parallel diagram
draws exposures into each layer’s own clusters and every layer’s
clusters into the shared outcome; a serial diagram follows the chain of
stages, with each stage’s transition coefficients as the links between
consecutive cluster sets, and its omics features not drawn by
default so the chain’s columns stay clean (see the companion
vignette’s section 14, or ?plot.lucid_serial;
omics = "aggregate" brings them back as one node per
stage). For a binary outcome those final cluster -> outcome links are
log-odds effects.
# Serial defaults: the chain alone, with widths scaled within block (the
# transition coefficients regress on a posterior probability in [0, 1] and
# would otherwise dwarf every other block). See the companion vignette's
# section 14 for the full explanation.
plot(serial_ae_bin$fit_refit)plot_cluster_omic_profile() – which shows what the
clusters are, via their fitted omics means – is unaffected by
outcome family entirely: res_Mu and the separation/range/sd
ranking behind it describe the X -> Z arm of the model,
which a binary Y never touches. Every panel, per
architecture:
prof_par_bin <- plot_cluster_omic_profile(
parallel_bin$fit_refit,
layer_names = c("methylome", "transcriptome", "miRNA"),
top_n = 8
)
for (nm in names(prof_par_bin)) print(prof_par_bin[[nm]])prof_ser_bin <- plot_cluster_omic_profile(serial_ae_bin$fit_refit, top_n = 8)
for (nm in names(prof_ser_bin)) print(prof_ser_bin[[nm]])The parallel model’s methylome panel and the serial
model’s stage-1 panel above look almost identical, and that isn’t a
rendering glitch: stage 1 of an all-early serial chain and the
corresponding layer of a parallel fit are both fit as an
early-integration model on the same methylome
matrix, with the same K and the same (default,
mclust-based) initialization. The exposure/outcome coupling
that distinguishes them is comparatively weak, so both converge to
nearly the same cluster solution – which is itself a useful sanity check
that the methylation clustering is robust to which architecture surfaces
it.
For the full discussion of what the importance argument
measures and why (separation vs. range vs. sd), and how to pull the
ranking behind a plot out as a plain table, see
lucid_3models_normal_outcome.Rmd’s section 15 – none of
that changes here, so it isn’t repeated.
predict_lucid()’s response argument
controls whether a binary outcome comes back as class labels or as
probabilities. Both draw on the early-model fit from section 7.
pred_lab <- predict_lucid(model = early_bin$fit_refit,
G = early_bin$inputs$G, Z = early_bin$inputs$Z,
CoG = CoG, CoY = CoY, response = TRUE)
pred_prob <- predict_lucid(model = early_bin$fit_refit,
G = early_bin$inputs$G, Z = early_bin$inputs$Z,
CoG = CoG, CoY = CoY, response = FALSE)
cat("response = TRUE ->", paste(head(pred_lab$pred.y, 8), collapse = " "), "(class labels)\n")## response = TRUE -> 1 1 0 0 1 0 0 1 (class labels)
cat("response = FALSE ->", paste(round(head(pred_prob$pred.y, 8), 3), collapse = " "), "(probabilities)\n")## response = FALSE -> 0.746 0.781 0.244 0.245 0.753 0.253 0.292 0.749 (probabilities)
The two rows describe the same underlying prediction at different
granularities: each label in the first row is simply the second row’s
probability rounded to whichever side of 0.5 it falls on. Use
response = FALSE when the downstream use needs the actual
predicted risk (e.g. computing a mean predicted probability, or a
classification threshold other than 0.5), and
response = TRUE when a hard label is what’s needed.
lucid_3models_normal_outcome.Rmd) one-for-one: same data,
same penalized-screen-then-refit pipeline, same three model
architectures – only Y_binary in place of
Y.Every model this vignette fits is registered below. This is the document checking itself: if a fit failed, its object would be missing or of the wrong class, and it would be listed here rather than passing unnoticed.
check_obj("early_bin", "list", "7 early binary")
check_obj("parallel_bin", "list", "8 parallel binary")
check_obj("serial_ae_bin", "list", "9 serial all-early binary")
check_obj("serial_mixed_bin", "list", "10 serial mixed binary")
check_obj("prof_early_bin", "list", "11 omics profile (early)")
check_obj("prof_par_bin", "list", "11 omics profile (parallel)")
check_obj("prof_ser_bin", "list", "11 omics profile (serial)")
check_obj("pred_lab", "list", "12 predict (labels)")
check_obj("pred_prob", "list", "12 predict (probabilities)")
status <- do.call(rbind, .reg$rows)
print(status, row.names = FALSE)## section object class status
## 7 early binary early_bin list ok
## 8 parallel binary parallel_bin list ok
## 9 serial all-early binary serial_ae_bin list ok
## 10 serial mixed binary serial_mixed_bin list ok
## 11 omics profile (early) prof_early_bin list ok
## 11 omics profile (parallel) prof_par_bin list ok
## 11 omics profile (serial) prof_ser_bin list ok
## 12 predict (labels) pred_lab list ok
## 12 predict (probabilities) pred_prob list ok
cat(sprintf("\n%d of %d registered steps ok; %d not ok\n",
sum(status$status == "ok"), nrow(status),
sum(status$status != "ok")))##
## 9 of 9 registered steps ok; 0 not ok
## R version 4.6.2 (2026-10-29)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 26.04.1 LTS
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.32.so; LAPACK version 3.12.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## time zone: Etc/UTC
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] LUCIDus_3.3.1 rmarkdown_2.32
##
## loaded via a namespace (and not attached):
## [1] gtable_0.3.6 shape_1.4.6.1 xfun_0.63
## [4] bslib_0.12.0 ggplot2_4.0.4 formula.tools_1.7.1
## [7] htmlwidgets_1.6.4 lattice_0.23-1 vctrs_0.7.3
## [10] tools_4.6.2 generics_0.1.4 tibble_3.3.1
## [13] pkgconfig_2.0.3 Matrix_1.7-6 RColorBrewer_1.1-3
## [16] S7_1.0.0 lifecycle_1.0.5 compiler_4.6.2
## [19] farver_2.1.2 progress_1.2.3 data.tree_1.2.0
## [22] codetools_0.2-20 htmltools_0.5.9 sys_3.4.3
## [25] glasso_1.11 buildtools_1.0.0 sass_0.5.0
## [28] yaml_2.3.12 glmnet_5.2 mice_3.20.0
## [31] pillar_1.11.1 crayon_1.5.3 jquerylib_0.1.4
## [34] tidyr_1.3.2 cachem_1.1.0 iterators_1.0.14
## [37] rpart_4.1.27 boot_1.3-32 mclust_6.1.4
## [40] foreach_1.5.2 nlme_3.1-172 tidyselect_1.2.1
## [43] digest_0.6.39 stringi_1.8.9 dplyr_1.2.1
## [46] purrr_1.2.2 maketools_1.3.2 labeling_0.4.3
## [49] splines_4.6.2 operator.tools_1.6.3.1 fastmap_1.2.0
## [52] grid_4.6.2 cli_3.6.6 magrittr_2.0.5
## [55] survival_3.8-13 broom_1.0.13 withr_3.0.3
## [58] prettyunits_1.2.0 scales_1.4.0 backports_1.5.1
## [61] logistf_1.26.1 networkD3_0.4.1 igraph_2.3.4
## [64] otel_0.3.0 nnet_7.3-21 hms_1.1.4
## [67] evaluate_1.0.5 knitr_1.52 mgcv_1.9-5
## [70] rlang_1.3.0 Rcpp_1.1.2 glue_1.8.1
## [73] jsonlite_2.0.0 R6_2.6.1