Title: | Missing Multivariate Bayesian Variable Selection |
---|---|
Description: | A variable selection tool for multivariate normal variables with missing-at-random values using Bayesian Hierarchical Model. Visualization functions show the posterior distribution of gamma (inclusion variables) and beta (coefficients). Users can also visualize the heatmap of the posterior mean of covariance matrix. Kim, T. Nicolae, D. (2019)<https://github.com/tk382/MMVBVS/blob/master/workingpaper.pdf>. Guan, Y. Stephens, M. (2011)<doi:10.1214/11-AOAS455>. |
Authors: | Tae Kim |
Maintainer: | Tae Kim <[email protected]> |
License: | GPL (>=2) |
Version: | 0.8.0 |
Built: | 2024-11-04 04:34:16 UTC |
Source: | https://github.com/tk382/mmvbvs |
Plot the posterior distribution of the coefficients
beta_dist(result, title = "")
beta_dist(result, title = "")
result |
resulting object from mmvbvs function |
title |
A string object for the title of the resulting plot |
ggplot object
Main function for variable selection
mmvbvs(X, Y, initial_chain, Phi, marcor, niter = 1000L, bgiter = 500L, hiter = 50L, burnin = 100000L, Vbeta = 1L, smallchange = 1e-04, verbose = TRUE)
mmvbvs(X, Y, initial_chain, Phi, marcor, niter = 1000L, bgiter = 500L, hiter = 50L, burnin = 100000L, Vbeta = 1L, smallchange = 1e-04, verbose = TRUE)
X |
covariate with length N, sample size |
Y |
multivariate normal response variable N by P |
initial_chain |
list of starting points for beta, gamma, sigma, and sigmabeta. beta is length P for the coefficients, gamma is length P inclusion vector where each element is 0 or 1. sigma should be P x P covariance matrix, and sigmabeta should be the expected variance of the betas. |
Phi |
prior for the covariance matrix. We suggest identity matrix if there is no appropriate prior information |
marcor |
length P vector of correlation between X and each variable of Y |
niter |
total number of iteration for MCMC |
bgiter |
number of MH iterations within one iteration of MCMC to fit Beta and Gamma |
hiter |
number of first iterations to ignore |
burnin |
number of MH iterations for h, proportion of variance explained |
Vbeta |
variance of beta |
smallchange |
perturbation size for MH algorithm |
verbose |
if set TRUE, print gamma for each iteration |
list of posterior beta, gamma, and covariance matrix sigma
beta = c(rep(0.5, 3), rep(0,3)) n = 200; T = length(beta); nu = T+5 Sigma = matrix(0.8, T, T); diag(Sigma) = 1 X = as.numeric(scale(rnorm(n))) error = MASS::mvrnorm(n, rep(0,T), Sigma) gamma = c(rep(1,3), rep(0,3)) Y = X %*% t(beta) + error; Y = scale(Y) Phi = matrix(0.5, T, T); diag(Phi) = 1 initial_chain = list(beta = rep(0,T), gamma = rep(0,T), Sigma = Phi, sigmabeta = 1) result = mmvbvs(X = X, Y = Y, initial_chain = initial_chain, Phi = Phi, marcor = colMeans(X*Y, na.rm=TRUE), niter=10, verbose = FALSE)
beta = c(rep(0.5, 3), rep(0,3)) n = 200; T = length(beta); nu = T+5 Sigma = matrix(0.8, T, T); diag(Sigma) = 1 X = as.numeric(scale(rnorm(n))) error = MASS::mvrnorm(n, rep(0,T), Sigma) gamma = c(rep(1,3), rep(0,3)) Y = X %*% t(beta) + error; Y = scale(Y) Phi = matrix(0.5, T, T); diag(Phi) = 1 initial_chain = list(beta = rep(0,T), gamma = rep(0,T), Sigma = Phi, sigmabeta = 1) result = mmvbvs(X = X, Y = Y, initial_chain = initial_chain, Phi = Phi, marcor = colMeans(X*Y, na.rm=TRUE), niter=10, verbose = FALSE)
Plot the coefficients for each variable for each iteration of MCMC
plot_beta(result, title = "")
plot_beta(result, title = "")
result |
Output object from mmvbvs function |
title |
A string object for the title of the resulting plot |
ggplot object
Plot the the inclusion of each variable for each MCMC iteration
plot_gamma(result, title = "")
plot_gamma(result, title = "")
result |
Output object from mmvbvs function |
title |
A string object for the title of the resulting plot |
ggplot object
Plot the posterior mean of the covariance matrix
plot_sigma(result, title = "")
plot_sigma(result, title = "")
result |
resulting object from mmvbvs function |
title |
A string object for the title of the resulting plot |
ggplot object