| boot_lucid | R Documentation |
Generate R bootstrap replicates of LUCID parameters and
derive confidence interval (CI) based on bootstrap. Bootstrap replicates are
generated by nonparametric resampling, implemented with the ordinary
method of boot::boot. Supports lucid_model = "early",
lucid_model = "parallel", and lucid_model = "serial".
boot_lucid(
G,
Z,
Y,
lucid_model = NULL,
CoG = NULL,
CoY = NULL,
model,
conf = 0.95,
R = 100,
verbose = FALSE,
min_valid = 2L
)
G |
Exposures, a numeric vector, matrix, or data frame. Categorical variable should be transformed into dummy variables. If a matrix or data frame, rows represent observations and columns correspond to variables. |
Z |
Omics data: for LUCID early integration, a numeric matrix/data frame; for LUCID in parallel, a list of numeric matrices/data frames. Rows correspond to observations and columns correspond to variables. |
Y |
Outcome, a numeric vector. Categorical variable is not allowed. Binary outcome should be coded as 0 and 1. |
lucid_model |
Optional; "early", "parallel", or "serial". Auto-detected
from |
CoG |
Optional, covariates to be adjusted for estimating the latent cluster. A numeric vector, matrix or data frame. Categorical variable should be transformed into dummy variables. |
CoY |
Optional, covariates to be adjusted for estimating the association between latent cluster and the outcome. A numeric vector, matrix or data frame. Categorical variable should be transformed into dummy variables. |
model |
A LUCID model fitted by |
conf |
A numeric scalar between 0 and 1 to specify confidence level(s) of the required interval(s). |
R |
An integer to specify number of bootstrap replicates for LUCID model. If feasible, it is recommended to set R >= 1000. |
verbose |
A flag indicates whether detailed information is printed in console. Default is FALSE. |
min_valid |
Minimum number of bootstrap replicates that must yield finite
estimates before confidence limits can be formed. The default, 2, is the
mathematical floor. Replicates that fail are counted and warned about, and a
small number of replicates raises a warning that the limits are unstable, but
neither suppresses the limits; only fewer than |
A list containing:
beta |
Bootstrap CI table(s) for G-to-X effects. For
|
mu |
Bootstrap CI table(s) for cluster-specific means of omics features.
For |
gamma |
Bootstrap CI table for X-to-Y parameters. |
stage |
For |
bootstrap |
The |
# use simulated data (a small subset keeps the example quick)
G <- sim_data$G[1:150, , drop = FALSE]
Z <- sim_data$Z[1:150, , drop = FALSE]
Y_normal <- sim_data$Y_normal[1:150]
# fit lucid model
fit1 <- estimate_lucid(G = G, Z = Z, Y = Y_normal, lucid_model = "early",
family = "normal", K = 2,
seed = 1008, max_itr = 20, max_tot.itr = 50)
# conduct bootstrap resampling (lucid_model is auto-detected from fit1's class)
# a small R keeps the example quick; `conf` sets the CI level (default 0.95)
boot1 <- suppressWarnings(
boot_lucid(G = G, Z = Z, Y = Y_normal, model = fit1, R = 3, conf = 0.9)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.