View source: R/analyzeImportantFeaturesFBM.R
computeEffectSizes | R Documentation |
This function computes effect sizes for each feature in the feature matrix 'X', using different methods based on the specified mode ('classification' or ‘regression'). For classification tasks, it calculates Cliff’s delta and performs a Wilcoxon test for each feature, assuming binary classes '1' and ‘-1'. For regression tasks, it computes Spearman’s rank correlation coefficient.
computeEffectSizes(X, y, mode)
X |
A feature matrix with rows representing features and columns representing samples. |
y |
The response variable, either a binary factor for classification (with levels '1' and '-1') or a continuous variable for regression. |
mode |
A character string indicating the task type, either '"classification"' or '"regression"'. |
**Classification Mode**: - Checks that 'y' contains only binary values ('1' and '-1'). - Calculates Cliff's delta to measure effect size and performs a Wilcoxon rank-sum test to assess the significance of feature values between the two classes.
**Regression Mode**: - Computes Spearman's rank correlation coefficient ('rho') to assess monotonic relationships between each feature and the continuous response variable 'y'.
A data frame with effect size metrics for each feature: - For ‘classification' mode: columns 'feature', 'cdelta' (Cliff’s delta), and 'pval.wilcox' (p-value from Wilcoxon test). - For ‘regression' mode: columns 'feature', 'rho' (Spearman’s correlation coefficient), and 'pval' (p-value).
## Not run:
# For classification
effect_sizes <- computeEffectSizes(X = my_data, y = my_labels, mode = "classification")
# For regression
effect_sizes <- computeEffectSizes(X = my_data, y = my_continuous_response, mode = "regression")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.