flash_fit: Extract a flash_fit object

View source: R/flash_fit_object.R

flash_fitR Documentation

Extract a flash_fit object

Description

flash_fit objects are the "internal" objects used by flash functions to fit an EBMF model. Whereas flash objects (the end results of the fitting process) include user-friendly fields and methods, flash_fit objects were not designed for public consumption and can be unwieldy. Nonetheless, some advanced flash functionality requires the wielding of flash_fit objects. In particular, initialization, convergence, and "verbose" display functions all take one or more flash_fit objects as input (see parameter init_fn in function flash_greedy; parameter fn in flash_set_conv_crit; and parameter fns in flash_set_verbose). For users who would like to write custom functions, the accessor functions and methods enumerated below may prove useful. See flash_set_verbose for an example.

Usage

flash_fit(flash)

flash_fit_get_pm(f, n)

flash_fit_get_p2m(f, n)

flash_fit_get_est_tau(f)

flash_fit_get_fixed_tau(f)

flash_fit_get_tau(f)

flash_fit_get_elbo(f)

flash_fit_get_KL(f, n)

flash_fit_get_g(f, n)

Arguments

flash

A flash object.

f

A flash_fit object.

n

Set n = 1 to access loadings L and n = 2 to access factors F).

Details

The following S3 methods are available for flash_fit objects at all times except while optimizing new factor/loadings pairs as part of a "greedy" fit:

fitted.flash_fit

Returns the "fitted values" E(LF') = E(L) E(F)'.

residuals.flash_fit

Returns the expected residuals Y - E(LF') = Y - E(L) E(F)'.

ldf.flash_fit

Returns an LDF decomposition, with columns of L and F scaled as specified by the user.

Value

See function descriptions below.

Functions

  • flash_fit_get_pm(): The posterior means for the loadings matrix L (when parameter n is equal to 1) or factor matrix F (when n = 2). While optimizing new factor/loadings pairs as part of a "greedy" fit, only the posterior means for the new loadings \ell_{\cdot k} or factor f_{\cdot k} will be returned.

  • flash_fit_get_p2m(): The posterior second moments for the loadings matrix L (when parameter n is equal to 1) or factor matrix F (when n = 2). While optimizing new factor/loadings pairs, only the posterior second moments for the new loadings \ell_{\cdot k} or factor f_{\cdot k} will be returned.

  • flash_fit_get_est_tau(): Equal to 1 / \sigma^2, where \sigma^2 is the estimated portion of the residual variance (total, by row, or by column, depending on the variance type).

  • flash_fit_get_fixed_tau(): Equal to 1 / s^2, where s^2 is the fixed portion of the residual variance (total, by row, or by column).

  • flash_fit_get_tau(): The overall precision 1 / (\sigma^2 + s^2).

  • flash_fit_get_elbo(): The variational lower bound (ELBO).

  • flash_fit_get_KL(): A vector containing the KL-divergence portions of the ELBO, with one value for each factor (when n = 2) or set of loadings (when n = 1). While optimizing new factor/loadings pairs, only the KL-divergence for the new factor or loadings will be returned.

  • flash_fit_get_g(): A list containing estimated priors on loadings \hat{g}_\ell (when n = 1) or factors \hat{g}_f (when n = 2). While optimizing new factor/loadings pairs, only the estimated prior on the new factor or loadings will be returned.


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