Package 'MMVBVS'

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

Help Index


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