BVCfit {spinBayes} | R Documentation |
fit a Semi-parametric Bayesian variable selection
Description
fit a Bayesian semi-parametric model for both linear and non-linear G×E interactions. Users can also specify all the interactions as linear and fit a Bayesian LASSO type of model.
Usage
BVCfit(
X,
Y,
Z,
E = NULL,
clin = NULL,
iterations = 10000,
burn.in = NULL,
sparse = TRUE,
structural = TRUE,
VC = TRUE,
kn = 2,
degree = 2,
hyper = NULL,
debugging = FALSE
)
Arguments
X |
the matrix of predictors (genetic factors) without intercept. Each row should be an observation vector. A column of 1 will be added to the X matrix as the intercept. |
Y |
the response variable. The current version of BVCfit only supports continuous response. |
Z |
a vector of environmental factor for non-linear G×E interactions. |
E |
a vector of environmental factor for linear G×E interactions. |
clin |
a matrix of clinical variables. Clinical variables are not subject to penalty. |
iterations |
the number of MCMC iterations. |
burn.in |
the number of iterations for burn-in. |
sparse |
logical flag. If TRUE, spike-and-slab priors will be used to shrink coefficients of irrelevant covariates to zero exactly. 'sparse' has effect only when VC=TRUE. |
structural |
logical flag. If TRUE, the coefficient functions with varying effects and constant effects will be penalized separately. 'structural' has effect only when VC=TRUE. |
VC |
logical flag. If TRUE, varying coefficient functions will be used for modeling the interactions between Z and X. If FALSE, interactions between Z and X will be modeled as linear interactions. |
kn |
the number of interior knots for B-spline. |
degree |
the degree of B spline basis. |
hyper |
a named list of hyperparameters. |
debugging |
logical flag. If TRUE, progress will be output to the console and extra information will be returned. |
Details
By default, varying coefficient functions are used for modeling the nonlinear interactions between Z and X. Assuming both E and clin are NULL, the model can be expressed as
Y = \beta_{0}(Z)+\sum\beta_{j}(Z)X_{j} + \epsilon
The basis expansion and changing of basis with B splines will be done automatically:
\beta_{j}(\cdot)\approx \gamma_{j1} + \sum_{k=2}^{q}{B}_{jk}(\cdot)\gamma_{jk}
where B_{jk}(\cdot)
represents B spline basis. \gamma_{j1}
and (\gamma_{j2}, \ldots, \gamma_{jq})^\top
correspond to the constant and varying parts of the coefficient functional, respectively.
q=kn+degree+1 is the number of basis functions. By default, kn=degree=2. User can change the values of kn and degree to any other positive integers.
If E is provided, the linear interactions between E and X will be added modeled as pairwise-products:
Y = \beta_{0}(Z)+\sum\beta_{j}(Z)X_{j} + \zeta_{0}E + \sum \zeta_{j}EX_{j} + \epsilon
If clin is provided, clinical variables will be added to the model.
If VC=FALSE, all interactions are treated as linear and a Bayesian LASSO model will be used. With non-null values of E and clin, the full linear model is:
Y \sim Z + ZX + clin + E + EX
Please check the references for more details about the model.
Users can modify the hyper-parameters by providing a named list of hyper-parameters via the argument 'hyper'. The list can have the following named components
a.c, a.v, a.e: shape parameters of the Gamma priors on
\lambda_{c}
,\lambda_{v}
and\lambda_{e}
, respectively.b.c, b.v, b.e: rate parameters of the Gamma priors on
\lambda_{c}
,\lambda_{v}
and\lambda_{e}
, respectively.r.c, r.v, r.e: shape parameters of the Beta priors (
\pi^{r-1}(1-\pi)^{w-1}
) on\pi_{c}
,\pi_{v}
and\pi_{e}
, respectively.w.c, w.v, w.e: shape parameters of the Beta priors on
\pi_{c}
,\pi_{v}
and\pi_{e}
, respectively.s: shape parameters of the Inverse-gamma prior on
\sigma^{2}
.h: scale parameters of the Inverse-gamma prior on
\sigma^{2}
.
Please check the references for more details about the prior distributions.
Value
an object of class "BVCfit" is returned, which is a list with components:
posterior: posterior samples from the MCMC
coefficients: a list of posterior estimates of coefficients
burn.in: the number of iterations for burn-in
iterations: the number of MCMC iterations.
References
Ren, J., Zhou, F., Li, X., Chen, Q., Zhang, H., Ma, S., Jiang, Y., Wu, C. (2020) Semiparametric Bayesian variable selection for gene-environment interactions. Statistics in Medicine, 39(5): 617– 638 doi:10.1002/sim.8434
Examples
data(gExp)
## default method
spbayes=BVCfit(X, Y, Z, E, clin)
spbayes
## non-structural
structural=FALSE
spbayes=BVCfit(X, Y, Z, E, clin, structural=structural)
spbayes
## non-sparse
sparse=FALSE
spbayes=BVCfit(X, Y, Z, E, clin, sparse=sparse)
spbayes