Skip to contents

Comprehensive evaluation of cell type deconvolution predictions against ground truth fractions. Calculates multiple performance metrics including RMSE, MAE, MRE, Pearson correlation, and accuracy at different thresholds.

Usage

EvaluateDeconvolution(
  predictions,
  truth,
  by_celltype = TRUE,
  accuracy_thresholds = c(0.01, 0.05, 0.1)
)

Arguments

predictions

Data frame or matrix of predicted cell type fractions (samples x cell types).

truth

Data frame or matrix of true cell type fractions (samples x cell types).

by_celltype

Logical. Calculate metrics per cell type. Default is TRUE.

accuracy_thresholds

Numeric vector. Thresholds for accuracy calculation. Default is c(0.01, 0.05, 0.1).

Value

A list containing:

overall

Data frame with overall metrics (RMSE, MAE, MRE, correlation)

by_celltype

Data frame with per-celltype metrics (if by_celltype = TRUE)

accuracy

Data frame with accuracy at different thresholds

sample_correlations

Numeric vector of per-sample correlations

Details

Metrics calculated:

  • RMSE: Root Mean Squared Error

  • MAE: Mean Absolute Error

  • MRE: Mean Relative Error (relative to true values)

  • Pearson: Pearson correlation coefficient

  • Spearman: Spearman rank correlation

  • Accuracy: Fraction of predictions within threshold of truth

Examples

if (FALSE) { # \dontrun{
# Evaluate predictions
eval_results <- EvaluateDeconvolution(predictions, true_fractions)

# View overall metrics
print(eval_results$overall)

# View per-celltype metrics
print(eval_results$by_celltype)
} # }