mixedBayes: fit a Bayesian longitudinal regularized quantile mixed model

View source: R/mixedBayes.R

mixedBayesR Documentation

fit a Bayesian longitudinal regularized quantile mixed model

Description

fit a Bayesian longitudinal regularized quantile mixed model

Usage

mixedBayes(
  y,
  e,
  X,
  g,
  w,
  k,
  iterations = 10000,
  burn.in = NULL,
  slope = TRUE,
  robust = TRUE,
  quant = 0.5,
  sparse = TRUE,
  structure = c("bi-level", "individual")
)

Arguments

y

the vector of repeated measured responses. The current version of mixedBayes only supports continuous response.

e

the long format matrix of environment (treatment) factors (a group of dummy variables).

X

the long format matrix of the intercept and time effects (time effects are optional).

g

the long format matrix of predictors (genetic factors) without intercept. Each row should be an observation vector.

w

the long format matrix of interactions between genetic factors and environment (treatment) factors.

k

the number of repeated measurements.

iterations

the number of MCMC iterations. The default value is 10,000.

burn.in

the number of iterations for burn-in. If NULL, the first half of MCMC iterations will be used as burn-ins.

slope

logical flag. If TRUE, random intercept-and-slope model will be used. Otherwise, random intercept model will be used. The default value is TRUE.

robust

logical flag. If TRUE, robust methods will be used. Otherwise, non-robust methods will be used. The default value is TRUE.

quant

the quantile level specified by users. The default value is 0.5.

sparse

logical flag. If TRUE, spike-and-slab priors will be adopted to impose exact sparsity on regression coefficients. Otherwise, Laplacian shrinkage will be adopted. The default value is TRUE.

structure

two choices are available. "bi-level" for selection on both the main and interaction effects corresponding to individual and group levels. "individual" for selections on individual-level only.

Details

Consider the data model described in "data":

Y_{ij} = X_{ij}^\top\gamma_{0}+E_{ij}^\top\gamma_{1}+\sum_{l=1}^{p}G_{ijl}\gamma_{2l}+\sum_{l=1}^{p}W_{ijl}^\top\gamma_{3l}+Z_{ij}^\top\alpha_{i}+\epsilon_{ij}.

, with W_{ij} = G_{ij}\bigotimes E_{ij}.

where \gamma_{0} is the coefficient vector for X_{ij}, \gamma_{1} is the coefficient vector for E_{ij}, \gamma_{2l} is the coefficient for the main effect of the lth genetic variant, and \gamma_{3l} is the coefficient vector for the interaction effect of the lth genetic variant with environment factors.

For random intercept-and-slope model, Z_{ij}^\top = (1,j) and \alpha_{i} = (\alpha_{i1},\alpha_{i2})^\top. For random intercept model, Z_{ij}^\top = 1 and \alpha_{i} = \alpha_{i1}.

When 'structure="bi-level"', bi-level selection will be conducted. If 'structure="individual"', individual-level selection will be conducted.

When 'slope=TRUE' (default), random intercept-and-slope model will be used as the mixed effects model.

When 'sparse=TRUE' (default), spike-and-slab priors are imposed to identify important main and interaction effects. Otherwise, Laplacian shrinkage will be used.

When 'robust=TRUE' (default), the distribution of \epsilon_{ij} is defined as an asymmetric Laplace distribution with density.

f(\epsilon_{ij}|\theta,\tau) = \theta(1-\theta)\exp\left\{-\tau\rho_{\theta}(\epsilon_{ij})\right\} , (i=1,\dots,n,j=1,\dots,k ), which leads to a Bayesian formulation of quantile regression. If 'robust=FALSE', \epsilon_{ij} follows a normal distribution.

Please check the references for more details about the prior distributions.

Value

an object of class ‘mixedBayes’ is returned, which is a list with component:

posterior

the posteriors of coefficients.

coefficient

the estimated coefficients.

burn.in

the total number of burn-ins.

iterations

the total number of iterations.

See Also

data

Examples

data(data)

## default method (robust sparse bi-level selection under random intercept-and-slope model)
fit = mixedBayes(y,e,X,g,w,k,structure=c("bi-level"))
fit$coefficient

## Compute TP and FP
b = selection(fit,sparse=TRUE)
index = which(coeff!=0)
pos = which(b != 0)
tp = length(intersect(index, pos))
fp = length(pos) - tp
list(tp=tp, fp=fp)

## alternative: robust sparse individual level selections under random intercept-and-slope model
fit = mixedBayes(y,e,X,g,w,k,structure=c("individual"))
fit$coefficient

## alternative: non-robust sparse bi-level selection under random intercept-and-slope model
fit = mixedBayes(y,e,X,g,w,k,robust=FALSE, structure=c("bi-level"))
fit$coefficient

## alternative: robust sparse bi-level selection under random intercept model
fit = mixedBayes(y,e,X,g,w,k,slope=FALSE, structure=c("bi-level"))
fit$coefficient




mixedBayes documentation built on June 8, 2025, 11:04 a.m.