simul.nfac.prior {BayesFM} | R Documentation |
This function produces a sample from the prior distribution of the number of latent factors. It depends on the prior parameters used for the distribution of the indicators, on the size of the model (number of manifest variables and maximum number of latent factors), and on the identification restriction (minimum number of manifest variables dedicated to each factor).
simul.nfac.prior(nvar, Kmax, Nid = 3, kappa = 1/Kmax, nrep = 10^6)
nvar |
Number of manifest variables. |
Kmax |
Maximum number of latent factors. |
Nid |
Minimum number of manifest variables dedicated to each latent factor for identification. |
kappa |
Concentration parameter of the Dirichlet prior distribution on the indicators. |
nrep |
Number of Monte Carlo replications. |
This function simulates the prior distribution of the number of
latent factors for models that fulfill the identification restriction
restriction that at least Nid
manifest variables (or no variables) are
loading on each latent factor. Several (scalar) parameters kappa
can
be passed to the function to simulate the prior for different prior parameter
values and compare the results.
An accept/reject sampling scheme is used: a vector of probabilities is drawn
from a Dirichlet distribution with concentration parameter kappa
, and
the nvar
manifest variables are randomly allocated to the Kmax
latent factors. If each latent factor has at least Nid
dedicated
variables or no variables at all, the identification requirement is fulfilled
and the draw is accepted. The number of factors loaded by at least Nid
manifest variables is returned as a draw from the prior distribution.
Note that this function does not use the two-level prior distribution implemented in CFSHP, where manifest variables can be discarded from the model according to a given probability. Therefore, this function only help understand the prior distribution conditional on all the manifest variables being included into the model.
A list of length equal to the number of parameters specified in
kappa
is returned, where each element of the list contains:
nfac
: Vector of integers of length equal to the number of
accepted draws.
acc
: Acceptance rate of the accept/reject sampling scheme.
Rémi Piatek remi.piatek@gmail.com
G. Conti, S. Frühwirth-Schnatter, J.J. Heckman, R. Piatek (2014): “Bayesian Exploratory Factor Analysis”, Journal of Econometrics, 183(1), pages 31-57, doi: 10.1016/j.jeconom.2014.06.008.
# replicate first row of table 2 in CFSHP (p.44) # note: use larger number of replications nrep to improve accuracy prior.nfac <- simul.nfac.prior(nvar = 15, Kmax = 5, kappa = c(.3, .7, 1), nrep = 10000) summary(prior.nfac) plot(prior.nfac)