Learn R Programming

FacPad (version 2.0)

gibbs_sampling: A Collapsed Gibbs Sampling Algorithm for the Inference of Sparse Bayesian Factor Models

Description

In each iteration, the algorithm iteratively updates each entry in the loading matrix W and factor activity matrix X, as well as other model parameters.

Usage

gibbs_sampling(matrixY, matrixL, alpha_tau = 1, 
beta_tau = 0.01, tau_sig = 1, max_iter = 10000, 
thin = 10, alpha_sigma = 0.7, beta_sigma = 0.3, file_name)

Arguments

Value

The algorithm will store the inferred loading matrix W and factor activity matrix X (as well as tau_g if not pre-difined) in each thinned iteration and write them into .RData file with name defined by the user.

Examples

Run this code
data(matrixY)
data(matrixL)
result<-gibbs_sampling(matrixY,matrixL,max_iter=50,thin=10,
file_name="test_50iter.RData")

Run the code above in your browser using DataLab