plotSelectionProb: Plot selection probabilities of predictors

View source: R/plotting.R

plotSelectionProbR Documentation

Plot selection probabilities of predictors

Description

This function plots the selection probabilities of predictors (for example the selected motifs), optionally multiplied with either +1 or -1 to give a sense of both the strength and the directionality of the associated effects. The directionality is estimated from the sign of the correlation coefficient between each predictor and the response vector.

Usage

plotSelectionProb(
  se,
  directional = TRUE,
  selProbMin = metadata(se)$stabsel.params.cutoff,
  selProbMinPlot = 0.4,
  showSelProbMin = TRUE,
  col = c("cadetblue", "grey", "red"),
  method = c("pearson", "kendall", "spearman"),
  ylimext = 0.25,
  legend = "topright",
  legend.cex = 1,
  ...
)

Arguments

se

The SummarizedExperiment object with the results from stability selection (typically returned by randLassoStabSel).

directional

A logical scalar. If TRUE, selection probabilities are plotted with the sign of the marginal correlation between a predictor and the response.

selProbMin

A numerical scalar in [0,1]. Predictors with a selection probability greater than selProbMin are shown as colored bars. The color is defined by col[1]. By default, selProbMin is extracted from the parameters stored in se.

selProbMinPlot

A numerical scalar in [0,1] less than selProbMin. Predictors with a selection probability greater than selProbMinPlot but less than selProbMin are shown as bars with color col[2]. selProbMinPlot is useful to include additional predictors in the plot that were not selected according to selProbMin but may be close to that cutoff. Setting selProbMinPlot = 0 will create a plot including all predictors.

showSelProbMin

A logical scalar. If TRUE, the value of selProbMin is shown by a horizontal dashed line of color col[3].

col

A color vector giving the three colors used for predictors with selection probability greater than selProbMin, additional predictors with selection probability greater than selProbMinPlot, and the selection probability cutoff line.

method

A character scalar with the correlation method to use in the calculation of predictor-response marginal correlations. One of "pearson", "kendall" or "spearman" (see cor).

ylimext

A numeric scalar defining how much the y axis limits should be expanded beyond the plotted probabilities to allow for space for the bar labels.

legend

the position of the legend in the bar plot (will be passed to legend(x=legend) to control legend position).

legend.cex

A scalar that controls the text size in the legend relative to the current par("cex") (see legend).

...

additional parameters passed to barplot.

Details

This function creates a bar plot using the barplot function. Each bar corresponds to a predictor (motif) and the colors correspond to whether or not it was selected. The y-axis shows the selection probabilities (directional=FALSE) or selection probabilities with the sign of the marginal correlation to the response (directional=TRUE).

Value

a matrix with one column, containing the coordinates of the bar midpoints, or NULL if no bar plot is drawn.

Examples

## create data set
Y <- rnorm(n = 500, mean = 2, sd = 1)
X <- matrix(data = NA, nrow = length(Y), ncol = 50)
for (i in seq_len(ncol(X))) {
  X[ ,i] <- runif(n = 500, min = 0, max = 3)
}
s_cols <- sample(x = seq_len(ncol(X)), size = 10, 
  replace = FALSE)
for (i in seq_along(s_cols)) {
  X[ ,s_cols[i]] <- X[ ,s_cols[i]] + Y
}
  
## reproducible randLassoStabSel() with 1 core
set.seed(123)
ss <- randLassoStabSel(x = X, y = Y)
plotSelectionProb(ss)


fmicompbio/monaLisa documentation built on Nov. 2, 2024, 1:33 p.m.