#'@importFrom Rcpp evalCpp sourceCpp
#'@importFrom mvtnorm rmvnorm
#'@useDynLib PhDPack
# Full conditionals for alpha: cluster parameter
alpha_update <- function(V,H,priors) {
max(rgamma(1,priors$a+H-1,priors$a - sum(log(1 - V[-H]))),1e-15)
}
# Global error in case of regression
sigma_update <- function(y,theta,cluster,a,b){
residuals <- y - theta[cluster,]
sqrt(1/rgamma(1, a + length(residuals)/2, b + sum(residuals^2)/2))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.