emBayes {emBayes} | R Documentation |
This function performs penalized variable selection based on spike-and-slab quantile LASSO (ssQLASSO), spike-and-slab LASSO (ssLASSO), spike-and-slab quantile group LASSO varying coefficient mixed model (ssQVCM) and spike-and-slab group LASSO varying coefficient mixed model (ssVCM). Typical usage is to first obtain the optimal spike scale and slab scale using cross-validation, then specify them in the 'emBayes' function.
emBayes(
y,
clin = NULL,
X,
W = NULL,
nt = NULL,
group = NULL,
quant,
s0,
s1,
func,
error = 0.01,
maxiter = 100
)
y |
a vector of response variable. |
clin |
a matrix of clinical factors. It has default value NULL. |
X |
a matrix of genetic factors. |
W |
a matrix of random factors. |
nt |
a vector of number of repeated measurements for each subject. They can be same or different. |
group |
a vector of group sizes. They can be same or different. |
quant |
value of quantile. |
s0 |
value of the spike scale |
s1 |
value of the slab scale |
func |
methods to perform variable selection. Four choices are available. For non longitudinal analysis: "ssLASSO" and "ssQLASSO". For longitudinal varying-coefficient analysis: "ssVCM" and "ssQVCM". |
error |
cutoff value for determining convergence. The algorithm reaches convergence if the difference in the expected log-likelihood of two iterations is less than the value of error. The default value is 0.01. |
maxiter |
the maximum number of iterations that is used in the estimation algorithm. The default value is 200. |
The current version of emBayes supports four types of methods: "ssLASSO", "ssQLASSO", "ssVCM" and "ssQVCM".
ssLASSO: spike-and-slab LASSO fits a Bayesian linear regression through the EM algorithm.
ssQLASSO: spike-and-slab quantile LASSO fits a Bayesian quantile regression (based on asymmetric Laplace distribution) through the EM algorithm.
ssVCM: spike-and-slab group LASSO varying coefficient mixed model fits a Bayesian linear mixed model through the EM algorithm.
ssQVCM: spike-and-slab quantile group LASSO varying coefficient mixed model fits a Bayesian quantile mixed model through the EM algorithm.
Users can choose the desired method by setting func="ssLASSO", "ssQLASSO", "ssVCM" or "ssQVCM".
A list with components:
alpha |
a vector containing the estimated intercept and clinical coefficients. |
intercept |
value of the estimated intercept. |
clin.coe |
a vector of estimated clinical coefficients. |
r |
a vector of estimated ranodm effect coefficients. |
beta |
a vector of estimated beta coefficients. |
sigma |
value of estimated asymmetric Laplace distribution scale parameter |
theta |
value of estimated probability parameter |
iter |
value of number of iterations. |
ll |
a vector of expectation of likelihood at each iteration. |
data(data)
##load the clinical factors, genetic factors, response and quantile data
clin=data$clin
X=data$X
y=data$y
quant=data$quant
##generate tuning vectors of desired range
t0 <- seq(0.01,0.015,length.out=2)
t1 <- seq(0.1,0.5,length.out=2)
##perform cross-validation and obtain tuning parameters based on check loss
CV <- cv.emBayes(y,clin,X,W=NULL,nt=NULL,group=NULL,quant,t0,t1,k=5,
func="ssQLASSO",error=0.01,maxiter=200)
s0 <- CV$CL.s0
s1 <- CV$CL.s1
##perform BQLSS under optimal tuning and calculate value of TP and FP for selecting beta
EM <- emBayes(y,clin,X,W=NULL,nt=NULL,group=NULL,quant,s0,s1,func="ssQLASSO",
error=0.01,maxiter=200)
fit <- EM$beta
coef <- data$coef
tp <- sum(fit[coef!=0]!=0)
fp <- sum(fit[coef==0]!=0)
list(tp=tp,fp=fp)