mean_comparison_anchor: High-dimensional two-sample mean comparison with anchored...

View source: R/41_refined_anchored_lasso.R

mean_comparison_anchorR Documentation

High-dimensional two-sample mean comparison with anchored projection

Description

Performs a cross-validated, projection-based mean comparison between two high-dimensional groups using sparse or dense PCA and (group) Lasso classifiers.

Usage

mean_comparison_anchor(
  control,
  treatment,
  pca_method = c("dense_pca", "sparse_pca"),
  classifier_method = c("lasso", "group_lasso"),
  lambda_type = "lambda.1se",
  n_folds = 10,
  group = NULL,
  standardize_feature = TRUE,
  verbose = TRUE
)

Arguments

control

A matrix or data frame for the control group. Rows are samples; columns are features.

treatment

A matrix or data frame for the treatment group. Rows are samples; columns are features.

pca_method

Character. Method for estimating the projection direction. Options are "dense_pca" or "sparse_pca". Default is "sparse_pca".

classifier_method

Character. Classifier to guide the projection. Options are "lasso" or "group_lasso". Default is "lasso".

lambda_type

Character. Regularization parameter choice in Lasso. Options are "lambda.min" or "lambda.1se". Default is "lambda.1se".

n_folds

Integer. Number of cross-validation folds. Default is 10.

group

Optional. A grouping vector (required for group_lasso), same length as the number of columns in control.

standardize_feature

Logical. Whether to standardize features using pooled mean and standard deviation. Default is TRUE.

verbose

Logical. Whether to print messages during execution. Default is TRUE.

Details

This function applies a projection-based method for high-dimensional mean testing. The projection direction is computed by anchoring the leading principal component with a regularized classifier (Lasso or group Lasso), and test statistics are aggregated across folds.

Value

A list with:

p_value

Two-sided p-value for the overall test.

test_statistic

Standardized test statistic.

fold_data

Per-fold results, including projections and scores.

See Also

process_fold_mean_diff, combine_folds_mean_diff, estimate_leading_pc, fit_lasso

Examples

## Not run: 
X <- matrix(rnorm(200 * 100), nrow = 100)
Y <- matrix(rnorm(200 * 100), nrow = 100)
result <- mean_comparison_anchor(X, Y, pca_method = "dense_pca", classifier_method = "lasso")

## End(Not run)


HMC documentation built on June 8, 2025, 10:32 a.m.