flash_plot_scree | R Documentation |
A scree plot is a line plot showing the proportion of variance explained by each factor/loadings pair in a flash fit. Note that since EBMF does not require factors and loadings to be orthogonal, "PVE" should be interpreted loosely: for example, the total proportion of variance explained could be larger than 1.
flash_plot_scree(
fl,
order_by_pve = FALSE,
kset = NULL,
labels = FALSE,
label_size = 3,
max_overlaps = Inf
)
fl |
An object inheriting from class |
order_by_pve |
If |
kset |
A vector of integers specifying the factor/loadings pairs to be
plotted. If |
labels |
Whether to label the points in the scree plot with the indices of the factor/loading pairs they correspond to. Labels appear as "k1", "k2", "k3", etc. |
label_size |
The size of the label text (in millimeters). |
max_overlaps |
A (nonnegative) integer. For each text label, the number of overlaps with other text labels or other data points are counted, and the text label is excluded if it has too many overlaps. |
Unlike scree plots for PCA, a scree plot for a flash fit is not in general
monotonically decreasing. To ensure a monotonically decreasing scree
plot, set order_by_pve = TRUE
. Note, however, that if this is done
then the numbers on the x
-axis will no longer match the indices of
the components in the flash fit. This can also be true if argument
kset
has been specified. Thus one should consider setting
labels = TRUE
when order_by_pve = TRUE
or when kset
has been specified.
A ggplot
object.
data(gtex)
fl <- flash(gtex, greedy_Kmax = 4L, backfit = FALSE)
flash_plot_scree(fl)
# For the full range of labelling options provided by the ggrepel package, set
# labels = FALSE (the default setting) and add geom_text_repel() manually:
library(ggrepel)
flash_plot_scree(fl) + geom_text_repel(min.segment.length = 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.