Title: | Variational Bayesian Algorithm for Multi-Source Heterogeneous Models |
Version: | 1.0.0 |
Description: | A Variational Bayesian algorithm for high-dimensional multi-source heterogeneous linear models. More details have been written up in a paper submitted to the journal Statistics in Medicine, and the details of variational Bayesian methods can be found in Ray and Szabo (2021) <doi:10.1080/01621459.2020.1847121>. It simultaneously performs parameter estimation and variable selection. The algorithm supports two model settings: (1) local models, where variable selection is only applied to homogeneous coefficients, and (2) global models, where variable selection is also performed on heterogeneous coefficients. Two forms of Spike-and-Slab priors are available: the Laplace distribution and the Gaussian distribution as the Slab component. |
License: | MIT + file LICENSE |
Imports: | pracma, selectiveInference, MASS |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Packaged: | 2025-10-04 02:34:22 UTC; 11877 |
Author: | Lu Luo [aut, cre], Huiqiong Li [aut] |
Maintainer: | Lu Luo <luolu@stu.ynu.edu.cn> |
Repository: | CRAN |
Date/Publication: | 2025-10-08 19:40:13 UTC |
VBMS: Variational Bayesian Algorithm for Multi-Source Heterogeneous Models
Description
A Variational Bayesian algorithm for high-dimensional multi-source heterogeneous linear models. More details have been written up in a paper submitted to the journal Statistics in Medicine, and the details of variational Bayesian methods can be found in Ray and Szabo (2021) doi:10.1080/01621459.2020.1847121. It simultaneously performs parameter estimation and variable selection. The algorithm supports two model settings: (1) local models, where variable selection is only applied to homogeneous coefficients, and (2) global models, where variable selection is also performed on heterogeneous coefficients. Two forms of Spike-and-Slab priors are available: the Laplace distribution and the Gaussian distribution as the Slab component.
Author(s)
Maintainer: Lu Luo luolu@stu.ynu.edu.cn
Authors:
Huiqiong Li
Global Gauss VB
Description
A variational Bayesian algorithm is proposed for multi-source heterogeneous models under the Laplace Spike-and-Slab prior, enabling simultaneous variable selection for both homogeneous and #' heterogeneous covariates.
Usage
vb_gauss_global(
X,
Z,
Y,
max_iter = 1000,
tol = 1e-06,
a = 1,
b = 10,
lambda = 1
)
Arguments
X |
Homogeneous covariates |
Z |
Heterogeneous covariates |
Y |
Response covariates |
max_iter |
Maximum number of iterations, Defaut:1000 |
tol |
Algorithm convergence tolerance, Defaut:1e-6 |
a |
A prior of Beta distribution, Defaut:1 |
b |
A prior of Beta distribution, Defaut:10 |
lambda |
A prior of Laplace distribution, Defaut:1 |
Value
The mean of the homogeneity coefficient:mu1; The variance of homogeneity coefficient:sigma1; Selection coefficient:gamma1; The mean of the heterogeneous coefficient:mu2; The variance of heterogeneous coefficient:sigma2; Selection heterogeneous:gamma2.
Local Gauss VB
Description
A variational Bayesian algorithm, based on the Gauss Spike-and-Slab prior, is tailored for multi-source heterogeneous models and focuses on variable selection exclusively for the homogeneous covariates.
Usage
vb_gauss_local(X, Z, Y, max_iter, tol, a = 1, b = 10, lambda = 1)
Arguments
X |
Homogeneous covariates |
Z |
Heterogeneous covariates |
Y |
Response covariates |
max_iter |
Maximum number of iterations, Defaut:1000 |
tol |
Algorithm convergence tolerance, Defaut:1e-6 |
a |
A prior of Beta distribution, Defaut:1 |
b |
A prior of Beta distribution, Defaut:10 |
lambda |
A prior of Laplace distribution, Defaut:1 |
Value
The mean of the homogeneity coefficient:mu; The variance of homogeneity coefficient:sigma; Selection coefficient:gamma; Mean and covariance of heterogeneity coefficients:m, s2.
Global Laplace VB
Description
A variational Bayesian algorithm is proposed for multi-source heterogeneous models under the Laplace Spike-and-Slab prior, enabling simultaneous variable selection for both homogeneous and #' heterogeneous covariates.
Usage
vb_lap_global(X, Z, Y, max_iter = 1000, tol = 1e-06, a = 1, b = 10, lambda = 1)
Arguments
X |
Homogeneous covariates |
Z |
Heterogeneous covariates |
Y |
Response covariates |
max_iter |
Maximum number of iterations, Defaut:1000 |
tol |
Algorithm convergence tolerance, Defaut:1e-6 |
a |
A prior of Beta distribution, Defaut:1 |
b |
A prior of Beta distribution, Defaut:10 |
lambda |
A prior of Laplace distribution, Defaut:1 |
Value
The mean of the homogeneity coefficient:mu1; The variance of homogeneity coefficient:sigma1; Selection coefficient:gamma1; The mean of the heterogeneous coefficient:mu2; The variance of heterogeneous coefficient:sigma2; Selection heterogeneous:gamma2.
Local Laplace VB
Description
A variational Bayesian algorithm, based on the Laplace Spike-and-Slab prior, is tailored for multi-source heterogeneous models and focuses on variable selection exclusively for the homogeneous covariates.
Usage
vb_lap_local(X, Z, Y, max_iter = 1000, tol = 1e-06, a = 1, b = 10, lambda = 1)
Arguments
X |
Homogeneous covariates |
Z |
Heterogeneous covariates |
Y |
Response covariates |
max_iter |
Maximum number of iterations, Defaut:1000 |
tol |
Algorithm convergence tolerance, Defaut:1e-6 |
a |
A prior of Beta distribution, Defaut:1 |
b |
A prior of Beta distribution, Defaut:10 |
lambda |
A prior of Laplace distribution, Defaut:1 |
Value
The mean of the homogeneity coefficient:mu; The variance of homogeneity coefficient:sigma; Selection coefficient:gamma; Mean and covariance of heterogeneity coefficients:m, s2.
Variational Bayesian Algorithm for Multi-Source Heterogeneous Models.
Description
This package implements a variational Bayesian algorithm for high-dimensional multi-source heterogeneous linear models. It simultaneously performs parameter estimation and variable selection. The algorithm supports two model settings: (1) local models, where variable selection is only #' applied to homogeneous coefficients, and (2) global models, where variable selection is also #' performed on heterogeneous coefficients. Two forms of Spike-and-Slab priors are available: the #' Laplace distribution and the Gaussian distribution as the Slab component.
Usage
vbms(
X,
Z,
Y,
global,
prior,
max_iter = 1000,
tol = 1e-06,
a = 1,
b = 10,
lambda = 1
)
Arguments
X |
Homogeneous covariates |
Z |
Heterogeneous covariates |
Y |
Response covariates |
global |
Indicates whether variable selection is required for het coefficients, if TRUE, Variable selection will be made for het coefficients. |
prior |
Forms of Slab distribution in Spike-and-Slab prior, "laplace" or "gauss". |
max_iter |
Maximum number of iterations, Defaut:1000 |
tol |
Algorithm convergence tolerance, Defaut:1e-6 |
a |
A prior of Beta distribution, Defaut:1 |
b |
A prior of Beta distribution, Defaut:10 |
lambda |
A prior of Laplace distribution, Defaut:1 |
Value
mu_hom |
The mean of the homogeneous coefficients |
sigma_hom |
The variance of homogeneous coefficients |
gamma_hom |
Selection indicators for homogeneous coefficients |
mu_het |
The mean of the heterogeneous coefficients |
sigma_het |
The variance of heterogeneous coefficients |
gamma_het |
Selection indicators for heterogeneous coefficients (NULL for local models) |
Examples
# Simulate multi-source heterogeneous data
n <- 50 # number of samples per source
K <- 3 # number of sources
p <- 100 # number of homogeneous covariates
q <- 5 # number of heterogeneous covariates
set.seed(1)
theta <- matrix(c(c(-1,0.5,1,-0.5,2),rep(0,p-5)), ncol = 1)
beta <- matrix(1, nrow = q, ncol = K)
for (k in 1:K) {
beta[,k] <- matrix(c(rep(log(k+1),5),rep(0,q-5)), ncol = 1)
}
zdata <- MASS::mvrnorm(K*n, rep(0,q), diag(q))
Z <- array(data=zdata,dim=c(n,q,K))
xdata <- MASS::mvrnorm(K*n, rep(0,p), diag(p))
X <- array(data=xdata,dim=c(n,p,K))
Y <- matrix(0, nrow = n, ncol = K)
for (k in 1:K) {
Y[,k] <- MASS::mvrnorm(1, X[,,k]%*%theta+Z[,,k]%*%beta[,k], diag(n))
}
# Fit local model with Laplace prior
res <- vbms(X, Z, Y, global=FALSE, prior='laplace')
# View results
print(head(res$mu_hom)) # Homogeneous coefficients mean
print(head(res$gamma_hom)) # Homogeneous variable selection
print(res$mu_het) # Heterogeneous coefficients mean