Description Usage Arguments Value
View source: R/factor_analysis.R
The model is as follows:
y_i = Λ η_i + ε_i
ε_i \sim N_p(0, Σ)
where Σ = diag(σ_1^2, ..., σ_p^2).
See Joyee Ghosh & David B. Dunson (2009) Default Prior Distributions and Efficient Posterior Computation in Bayesian Factor Analysis, Journal of Computational and Graphical Statistics, 18:2, 306-320, DOI: 10.1198/jcgs.2009.07145 for conditional posteriors.
| 1 2 3 4 5 6 7 8 9 | factor_analysis <- function(
  Y,
  k,
  niter = 1000,
  shape_psi = 1/2,
  rate_psi = 1/2,
  shape_sigma2 = 1,
  rate_sigma2 = 0.2,
  nonzero_structure = NULL)
 | 
| Y | n by p matrix | 
| k | number of factors | 
| niter | number of iterations for the gibbs sampler to run. | 
| shape_psi | shape parameter for psi. Can be a scalar or a k vector | 
| rate_psi | rate parameter for psi. Can be a k vector | 
| shape_sigma2 | shape parameter for sigma2. Can be a p vector | 
| rate_sigma2 | rate parameter for sigma2. Can be a p vector | 
| nonzero_structure | A boolean p x k matrix. If the i, jth spot is TRUE, then λ_{ij} is free. If the i, jth spot is FALSE, then λ_{ij} is zero. If not set, then a lower triangular matrix is used. | 
| sigma | An niter x p matrix of posterior values | 
| eta | An niter x n x k array of posterior values | 
| lambda | An niter x p x k array of posterior values | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.