summary.befa {BayesFM}R Documentation

Summarize 'befa' object

Description

Generic function summarizing the posterior results of a 'befa' object. Optional arguments can be specified to customize the summary.

Usage

## S3 method for class 'befa'
summary(object, ...)

Arguments

object

Object of class 'befa'.

...

The following extra arguments can be specified:

  • what: How to summarize the posterior distribution?

    • what = 'maxp' (default): Only factor loadings with highest posterior probability of being different from zero or discarded from the model (if dedic = 0) are summarized.

    • what = 'all': All factor loadings with corresponding posterior probability to be allocated to a given factor (or to be discarded from the model) larger than min.prob are summarized.

    • what = 'hppm': Highest posterior probability models with probability larger than min.prob are summarized.

  • byfac: Sort factor loadings by factors if TRUE, otherwise by manifest variables if FALSE (default).

  • hpd.prob: Probability used to compute the highest posterior density intervals of the posterior distribution of the model parameters (default: 0.95).

  • min.prob: If what = 'all', only factor loadings with posterior probability of being dedicated to a given factor (or discarded from the model) larger than this value are displayed. If what = 'hppm', only highest posterior probability models with probability larger than this value are displayed. (default: 0.20)

Details

This function summarizes the posterior distribution of the parameters. The algorithm may visit different configurations of the indicator matrix \Delta during sampling, where the manifest variables are allocated to different latent factors. When the posterior distribution of the factor loadings is summarized separately for each manifest variable (what = 'maxp' or what = 'all'), the function provides the latent factor each manifest variable is allocated to (dedic), and the corresponding posterior probability (prob). If dedic = 0, then prob corresponds to the posterior probability that the manifest variable is discarded. Discarded variables are listed last if byfac = TRUE. Low probability cases can be discarded by setting min.prob appropriately (default is 0.20).

Idiosyncratic variances, factor correlation matrix and regression coefficients (if any) are summarized across all MCMC iterations if what = 'all' or what = 'maxp', and within each HPP model if what = 'hppm'.

Highest posterior probability model. The HPP model is the model with a given allocation of the measurements to the latent factors (i.e., a given indicator matrix \Delta) that is visited most often by the algorithm.

When specifying what = 'hppm', the function sorts the models according to the posterior frequencies of their indicator matrices in decreasing order. Therefore, the first model returned (labeled 'm1') corresponds to the HPP model. Low probability models can be discarded by setting min.prob appropriately(default is 0.20, implying that only models with a posterior probability larger than 0.20 are displayed).

HPP models can only be found if identification with respect to column switching has been restored a posteriori. An error message is returned if this is not the case.

Value

If called directly, the summary is formatted and displayed on the standard output. Otherwise if saved in an object, a list of the following elements is returned:

Data frames of posterior summary statistics include the means (mean), standard deviations (sd) and highest posterior density intervals (hpd.lo and hpd.up, for the probability specified in hpd.prob) of the corresponding parameters.

For the factor loadings, the matrix may also include a column labeled 'dedic' indicating to which factors the corresponding manifest variables are dedicated (a zero value means that the manifest variable does not load on any factor), as well as a column labeled 'prob' showing the corresponding posterior probabilities that the manifest variables load on these factors.

Summary results are returned as lists of data frames for HPP models, where the elements of the list are labeled as 'm1, 'm2', etc.

Author(s)

RĂ©mi Piatek remi.piatek@gmail.com

See Also

plot.befa to plot posterior results.

Examples

set.seed(6)

# generate fake data with 15 manifest variables and 3 factors
Y <- simul.dedic.facmod(N = 100, dedic = rep(1:3, each = 5))

# run MCMC sampler and post process output
# notice: 1000 MCMC iterations for illustration purposes only,
#  increase this number to obtain reliable posterior results!
mcmc <- befa(Y, Kmax = 5, iter = 1000)
mcmc <- post.column.switch(mcmc)
mcmc <- post.sign.switch(mcmc)

# summarize posterior results
summary(mcmc)

# summarize highest posterior probability (HPP) model
hppm.sum <- summary(mcmc, what = 'hppm')

# print summary with 6-digit precision
print(hppm.sum, digits = 6)

# extract posterior means of the factor loadings in HPP model
alpha.mean <- hppm.sum$alpha$m1$mean
print(alpha.mean)




[Package BayesFM version 0.1.7 Index]