simul.R.prior: Simulate prior distribution of factor correlation matrix

View source: R/simul.R.prior.R

simul.R.priorR Documentation

Simulate prior distribution of factor correlation matrix

Description

This function produces a sample of correlation matrices drawn from their prior distribution induced in the identified version of the factor model, given the prior distribution specified on the corresponding covariance matrices of the factors in the expanded model.

Usage

simul.R.prior(Kmax, nu0 = Kmax + 1, S0 = 1, HW.prior = TRUE,
  nrep = 10^5, verbose = TRUE)

Arguments

Kmax

Maximum number of latent factors.

nu0

Degrees of freedom of the Inverse-Wishart prior on the covariance matrix of the latent factors in the expanded model.

S0

Scale parameters of the Inverse-Wishart prior on the covariance matrix of latent factors in the expanded model:

  • if HW.prior = TRUE, scale parameter of the Gamma hyperprior distribution on the individual scales of the Inverse-Wishart prior.

  • if HW.prior = FALSE, diagonal elements of the scale matrix of the Inverse-Wishart prior on the covariance matrix of the latent factors in the expanded model.

Either a scalar or a numeric vector of length equal to Kmax.

HW.prior

If TRUE, implement Huang-Wand (2013) prior on the covariance matrix of the factors in the expanded model, otherwise use an Inverse-Wishart prior if FALSE, see CFSHP section 2.3.5.

nrep

Number of Monte Carlo replications.

verbose

If TRUE, display information on the progress of the function.

Details

Covariance matrices are sampled from the prior distribution in the expanded model, and transformed to produce the corresponding correlation matrices. See section 2.3.5 of CFSHP (p.36-37), as well as the details of the function befa.

To compare several prior specifications, different values of the parameters nu0 and S0 can be specified. The function then simulates for each pair of these parameters. nu0 and S0 should therefore be scalars or vectors of same length.

Value

A list of length equal to the number of pairs of parameters nu0 and S0, where each element of the list is an array of dimension (Kmax, Kmax, nrep) that contains the correlation matrices of the latent factors drawn from the prior.

Author(s)

Rémi Piatek remi.piatek@gmail.com

References

G. Conti, S. Frühwirth-Schnatter, J.J. Heckman, R. Piatek (2014): “Bayesian Exploratory Factor Analysis”, Journal of Econometrics, 183(1), pages 31-57, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.jeconom.2014.06.008")}.

Examples

# partial reproduction of figure 1 in CFSHP (p.38)
# note: use larger number of replications nrep to increase smoothness
Kmax <- 10
Rsim <- simul.R.prior(Kmax, nu0 = Kmax + c(1, 2, 5), S0 = .5, nrep = 1000)
summary(Rsim)
plot(Rsim)


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