View source: R/SelectFeaturesRW.R
| SelectFeaturesRW | R Documentation |
Finds the important variables presenting a coordinated response across all specified replicate-blocks for a given ComDim component.
SelectFeaturesRW(
RW = RW,
results = results,
ndim = NULL,
blocks = NULL,
threshold_cor = 1,
threshold_cov = 1,
mean.RW = TRUE,
plots = "NO"
)
RW |
The object used as input in the ComDim analysis. |
results |
The output object obtained in the ComDim analysis. |
ndim |
The number of the component for which the important variables are to be identified. |
blocks |
A vector with the indices or the names for the replicate blocks of the same data type. |
threshold_cor |
The "times" parameter used to calculate the threshold in the following formula: cor(variable) > times * sd(cor(variables)). Minimal value that can be assigned to threshold_cor is 1. |
threshold_cov |
The "times" parameter used to calculate the threshold in the following formula: cov(variable) > times * sd(cov(variables)). Minimal value that can be assigned to threshold_cov is 1. |
mean.RW |
Logical value to indicate whether the RW data must be mean-centered (TRUE) or not (FALSE). |
plots |
Parameter to indicate whether S-plots (covariance vs. correlation with the Q scores)
must be produced. Possible values are |
The function applies an S-plot approach to identify variables that are both strongly covarying
and strongly correlated with the Q scores of the chosen component. For each block in
blocks, covariance (s1) and correlation (s2) of every variable with the
(pseudo-inverse-scaled) Q scores are computed. A variable is considered important in a block if
its absolute covariance exceeds threshold_cov * sd(s1) and its absolute correlation
exceeds threshold_cor * sd(s2). Only variables that satisfy both criteria in all
specified blocks simultaneously are returned. The sign of the local P-loadings is used to
separate variables into positive and negative groups.
A named list with two elements:
$positiveInteger indices (named by variable name) of the important variables presenting a positive relationship with the Q scores (positive covariance, positive correlation, and positive local P-loading) across all specified blocks.
$negativeInteger indices (named by variable name) of the important variables presenting a negative relationship with the Q scores (negative covariance, negative correlation, and negative local P-loading) across all specified blocks.
When plots is not "NO", S-plots are also displayed as a side effect: each plot
shows covariance on the x-axis and correlation on the y-axis, with selected variables
highlighted in red.
SplitRW, ComDim_PCA
b1 <- matrix(rnorm(500), 10, 50)
batch_b1 <- rep(1, 10)
b2 <- matrix(rnorm(800), 30, 80)
batch_b2 <- c(rep(1, 10), rep(2, 10), rep(3, 10))
mb <- MultiBlock(
Data = list(b1 = b1, b2 = b2),
Batch = list(b1 = batch_b1, b2 = batch_b2),
ignore.names = TRUE, ignore.size = TRUE
)
rw <- SplitRW(mb)
results <- ComDim_PCA(rw, 2)
# Identify important variables for component 1 across replicate blocks 2, 3, and 4
features <- SelectFeaturesRW(RW = rw, results = results, ndim = 1, blocks = c(2, 3, 4))
# Use stricter thresholds and display S-plots side by side
features <- SelectFeaturesRW(RW = rw, results = results, ndim = 1, blocks = c(2, 3, 4),
threshold_cor = 2, threshold_cov = 2, plots = "together")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.