| bootstrap_orthoMTL | R Documentation |
Estimates coefficient variability and statistical relevance by comparing bootstrapped models (real signal) against null models (permuted outcomes). This two-pronged approach answers: (1) how stable is each coefficient across resamples, and (2) is each coefficient distinguishable from what would be obtained by chance.
bootstrap_orthoMTL(
X,
Y,
lambda = 1,
alpha = 0,
step_size = 0.1,
K = NULL,
disjoint = FALSE,
schedule = c("sqrt", "log", "const", "linear"),
survival = FALSE,
censored.mat = NULL,
n_repeats = 100,
n_cores = 2,
seed = NULL,
verbose = TRUE
)
X |
A numeric matrix of predictor variables with dimensions
|
Y |
A numeric matrix of response labels with dimensions
|
lambda |
Regularisation parameter for the orthogonal penalty. |
alpha |
Elastic-net mixing parameter in |
step_size |
Step size for gradient descent. Default: |
K |
Constraint matrix of dimensions
|
disjoint |
Logical. Enforce disjoint supports? Default:
|
schedule |
Character; the gradient-step decay schedule passed to
|
survival |
Logical. Use censored survival loss? Default:
|
censored.mat |
A numeric indicator matrix of dimensions
|
n_repeats |
Number of bootstrap/permutation repeats. Default:
|
n_cores |
Number of cores for parallel execution. Default:
|
seed |
Optional base random seed. Default: |
verbose |
Logical. Print progress information? Default:
|
Real bootstrap: For each repeat, rows of X, Y,
and censored.mat are resampled with replacement. The
model is refit with identical hyperparameters. This produces a
distribution of coefficient values reflecting estimation variability.
Null permutation: For each repeat, rows of Y and
censored.mat are permuted without replacement while
X remains fixed. This breaks the association between features
and outcomes, producing a null distribution of coefficients.
Comparing real vs null distributions for each feature and task
indicates whether observed coefficients are distinguishable from
noise. Visualise with plot_bootstrap.
An object of class "bootstrap_orthoMTL" containing:
A tidy data.frame with columns id
(feature name), time (task/threshold), coeff
(coefficient value), group ("real" or
"null"), and repeat_id (integer).
A list of n_repeats coefficient
matrices (each p x numTasks).
A list of n_repeats coefficient
matrices from permuted outcomes.
Numeric vector of final objective values for real bootstrap models.
Numeric vector of final objective values for null permutation models.
Number of repeats.
Number of features.
Number of tasks.
Character vector of feature names.
Character vector of task names.
The matched function call.
orthoMTL, plot_bootstrap
set.seed(42)
n <- 30; p <- 5; n_tasks <- 3
X <- matrix(rnorm(n * p), n, p)
colnames(X) <- paste0("V", seq_len(p))
SurvTime <- rexp(n, rate = 0.1)
Event <- rbinom(n, 1, 0.7)
thresholds <- c(4, 6, 10)
Y <- create_longitudinal_labels(SurvTime, Event, thresholds)
W <- create_indicator_matrix(Y)
K <- create_constraint_matrix(n_tasks)
boot_res <- bootstrap_orthoMTL(
X = X, Y = Y, lambda = 1e-3, step_size = 0.1,
K = K, survival = TRUE, censored.mat = W,
n_repeats = 5, n_cores = 1, verbose = FALSE
)
print(boot_res)
head(boot_res$results)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.