summary.befa | R Documentation |
Generic function summarizing the posterior results of a 'befa' object. Optional arguments can be specified to customize the summary.
## S3 method for class 'befa'
summary(object, ...)
object |
Object of class 'befa'. |
... |
The following extra arguments can be specified:
|
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.
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:
MHacc
: Metropolis-Hastings acceptance rate.
alpha
: Data frame (or list of data frames if
what = 'hppm'
) containing posterior summary statistics for the
factor loadings.
sigma
: Data frame (or list of matrices if what = 'hppm'
)
containing posterior summary statistics for the idiosyncratic
variances.
R
: Data frame (or list of data frames if what = 'hppm'
)
containing posterior summary statistics for the factor correlations.
beta
: Data frame (or list of data frames if
what = 'hppm'
) containing posterior summary statistics for the
regression coefficients (if any).
nfac
(only if what = 'maxp'
or what = 'all'
):
Table of posterior frequencies of numbers of factors.
hppm
(only if what = 'hppm'
): List of the following
elements summarizing the different HPP models, sorted in decreasing
order of their posterior probabilities:
prob
: Vector of posterior probabilities.
nfac
: Vector of numbers of factors.
dedic
: Data frame of factor indicators.
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.
Rémi Piatek remi.piatek@gmail.com
plot.befa
to plot posterior results.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.