plot.befa {BayesFM}R Documentation

Plot object of class 'befa'


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.


## S3 method for class 'befa'
plot(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)


This function makes graphs based on the summary results returned by summary.befa. It therefore accepts the same optional arguments as this function.


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


RĂ©mi Piatek

See Also

summary.befa to summarize posterior results.



# 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')

[Package BayesFM version 0.1.5 Index]