Type: | Package |
Title: | Missing Multivariate Bayesian Variable Selection |
Version: | 0.8.0 |
Author: | Tae Kim |
Maintainer: | Tae Kim <tk382@uchicago.edu> |
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>. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Encoding: | UTF-8 |
LazyData: | true |
LinkingTo: | Rcpp, RcppArmadillo |
Imports: | Rcpp, reshape, reshape2, ggplot2, rlang |
RoxygenNote: | 6.1.1 |
Suggests: | testthat, MASS |
NeedsCompilation: | yes |
Packaged: | 2019-12-15 14:34:52 UTC; tae |
Repository: | CRAN |
Date/Publication: | 2019-12-15 15:20:13 UTC |
Plot the posterior distribution of the coefficients
Description
Plot the posterior distribution of the coefficients
Usage
beta_dist(result, title = "")
Arguments
result |
resulting object from mmvbvs function |
title |
A string object for the title of the resulting plot |
Value
ggplot object
Main function for variable selection
Description
Main function for variable selection
Usage
mmvbvs(X, Y, initial_chain, Phi, marcor, niter = 1000L, bgiter = 500L,
hiter = 50L, burnin = 100000L, Vbeta = 1L, smallchange = 1e-04,
verbose = TRUE)
Arguments
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 |
Value
list of posterior beta, gamma, and covariance matrix sigma
Examples
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
Description
Plot the coefficients for each variable for each iteration of MCMC
Usage
plot_beta(result, title = "")
Arguments
result |
Output object from mmvbvs function |
title |
A string object for the title of the resulting plot |
Value
ggplot object
Plot the the inclusion of each variable for each MCMC iteration
Description
Plot the the inclusion of each variable for each MCMC iteration
Usage
plot_gamma(result, title = "")
Arguments
result |
Output object from mmvbvs function |
title |
A string object for the title of the resulting plot |
Value
ggplot object
Plot the posterior mean of the covariance matrix
Description
Plot the posterior mean of the covariance matrix
Usage
plot_sigma(result, title = "")
Arguments
result |
resulting object from mmvbvs function |
title |
A string object for the title of the resulting plot |
Value
ggplot object