plot.befa: Plot object of class 'befa'

View source: R/plot.befa.R

plot.befaR Documentation

Plot object of class 'befa'

Description

This function makes different plots that are useful to assess the posterior results: a trace plot of the number of latent factors (also showing Metropolis-Hastings acceptance across MCMC replications), a histogram of the posterior probabilities of the number of factors, heatmaps for the inficator probabilities, the factor loading matrix, and the correlation matrix of the latent factors.

Usage

## S3 method for class 'befa'
plot(x, ...)

Arguments

x

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 makes graphs based on the summary results returned by summary.befa. It therefore accepts the same optional arguments as this function.

Value

No return value, called for side effects (plots the posterior results returned by summary.befa).

Author(s)

Rémi Piatek remi.piatek@gmail.com

See Also

summary.befa to summarize 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)

# plot results for highest posterior probability model
plot(mcmc, what = 'hppm')


BayesFM documentation built on June 22, 2024, 10:24 a.m.