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
)
An object inheriting from class flash
.
If order_by_pve = TRUE
, then factor/loadings pairs
will be ordered according to proportion of variance explained, from
highest to lowest. (By default, they are plotted in the same order as
kset
; or, if kset
is NULL
, then they are plotted in
the same order as they are found in fl
.)
A vector of integers specifying the factor/loadings pairs to be
plotted. If order_by_pve = FALSE
, then kset
also specifies the
order in which they are to be plotted.
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.
The size of the label text (in millimeters).
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.
A ggplot
object.
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.
data(gtex)
fl <- flash(gtex, greedy_Kmax = 4L, backfit = FALSE)
#> Adding factor 1 to flash object...
#> Adding factor 2 to flash object...
#> Adding factor 3 to flash object...
#> Adding factor 4 to flash object...
#> Wrapping up...
#> Done.
#> Nullchecking 4 factors...
#> Done.
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)