plot.flash: Plot method for flash objects

View source: R/flash_methods.R

plot.flashR Documentation

Plot method for flash objects

Description

Given a flash object, produces up to two figures: one showing the proportion of variance explained per factor/loadings pair, and one that plots posterior means for either factors or loadings (depending on the argument to parameter pm_which).

Usage

## S3 method for class 'flash'
plot(
  x,
  include_scree = TRUE,
  include_pm = TRUE,
  order_by_pve = TRUE,
  kset = NULL,
  pm_which = c("factors", "loadings"),
  pm_subset = NULL,
  pm_groups = NULL,
  pm_colors = NULL,
  ...
)

Arguments

x

An object inheriting from class flash.

include_scree

Whether to include a figure ("scree plot") showing the proportion of variance explained by each factor/loadings pair.

include_pm

Whether to include a figure showing the posterior means for either loadings L or factors F (depending on the argument to parameter pm_which). One plot panel is produced for each factor/loadings pair k. If argument pm_groups is left unspecified, then bar plots will be produced, with each bar corresponding to a single value \ell_{ik} or f_{jk}. Otherwise, overlapping histograms will be produced, with each histogram corresponding to one of the groups specified by pm_groups.

order_by_pve

If TRUE, then the factor/loadings pairs will be re-ordered according to proportion of variance explained (from highest to lowest).

kset

A vector of integers specifying the factor/loadings pairs to be plotted. If kset = NULL, then all will be plotted.

pm_which

Whether to plot loadings L or factors F in the plots of posterior means. This parameter is ignored when include_pm = FALSE.

pm_subset

A vector of row indices i or column indices j (depending on the argument to pm_which) specifying which values \ell_{i \cdot} or f_{j \cdot} are to be shown in the plots of posterior means. If the dataset has row or column names, then names rather than indices may be specified. If pm_subset = NULL, then all values will be plotted. This parameter is ignored when include_pm = FALSE.

pm_groups

A vector specifying the group to which each row of the data y_{i \cdot} or column y_{\cdot j} belongs (groups may be numeric indices or strings). If pm_groups = NULL, then a bar plot of the ungrouped data is produced (see include_pm above). Otherwise, a group must be provided for each plotted row i or column j, so that the length of pm_groups is exactly equal to the number of rows or columns in the full dataset or, if pm_subset is specified, in the subsetted dataset. When pm_groups is not NULL, a set of overlapping histograms is produced for each factor/loadings pair, with one histogram per group (again see include_pm). This parameter is ignored when include_pm = FALSE.

pm_colors

A vector specifying a color for each bar (if pm_groups = NULL) or histogram (if pm_groups is not NULL). Passed directly to parameter values in ggplot2 function scale_color_manual. This parameter is ignored when include_pm = FALSE.

...

Additional parameters are ignored.

Value

If arguments include_scree and include_pm specify that only one figure be produced, then plot.flash() returns a ggplot2 object. If both figures are to be produced, then plot.flash() prints both plots but does not return a value.


flashier documentation built on Oct. 17, 2023, 5:07 p.m.