| Type: | Package |
| Title: | Robust Bayesian Longitudinal Regularized Semiparametric Mixed Models |
| Version: | 0.1.4 |
| Date: | 2026-11-24 |
| Description: | Our recently developed fully robust Bayesian semiparametric mixed-effect model for high-dimensional longitudinal studies with heterogeneous observations can be implemented through this package. This model can distinguish between time-varying interactions and constant-effect-only cases to avoid model misspecifications. Facilitated by spike-and-slab priors, this model leads to superior performance in estimation, identification and statistical inference. In particular, robust Bayesian inferences in terms of valid Bayesian credible intervals on both parametric and nonparametric effects can be validated on finite samples. The Markov chain Monte Carlo algorithms of the proposed and alternative models are efficiently implemented in 'C++'. |
| Depends: | R (≥ 4.2.0) |
| License: | GPL-2 |
| Encoding: | UTF-8 |
| URL: | https://github.com/kunfa/Blend |
| BugReports: | https://github.com/kunfa/Blend/issues |
| LinkingTo: | Rcpp, RcppArmadillo |
| Imports: | Rcpp, splines, stats, ggplot2 |
| Config/roxygen2/version: | 8.1.1 |
| NeedsCompilation: | yes |
| Packaged: | 2026-11-24 22:29:02 UTC; kfan |
| Author: | Kun Fan [aut, cre], Cen Wu [aut] |
| Maintainer: | Kun Fan <fzt0428@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-11-24 22:50:07 UTC |
Robust Bayesian Longitudinal Regularized Semiparametric Mixed Model
Description
In this package, we further extend the sparse robust Bayesian mixed models to nonlinear longitudinal interactions. Specifically, the proposed Bayesian semiparametric model is robust not only to outliers and heavy‐tailed distributions of the response variable, but also to the misspecification of interaction effect in the forms other than non-linear interactions. We have developed the Gibbs sampler with the spike‐and‐slab priors to promote sparse identification of appropriate forms of main and interaction effects. In addition to the default method, users can also choose different selection structures for separation of constant and varying effects or not, methods without spike–and–slab priors and non-robust methods. In total, Blend provides 8 different methods (4 robust and 4 non-robust) under the random intercept and slope model. All the methods in this package are developed for the first time. Please read the Details below for how to configure the method used.
Details
The user friendly, integrated interface Blend() allows users to flexibly choose the fitting methods by specifying the following parameter:
| robust: | whether to use robust methods for modelling. |
| structural: | whether to incorporate structural identification(separation of constant and varying effects) . |
| sparse: | whether to use the spike-and-slab priors to impose sparsity. |
The function Blend() returns a Blend object that contains the posterior estimates of each coefficients and other useful information for selection(). S3 generic functions selection() and print() are implemented for Blend objects. selection() takes a Blend object and returns the variable selection results.
References
Fan, K., Ren, J., Ma, S. and Wu, C. (2026). Robust Bayesian Variable Selection and Inference Under Misspecified Nonparametric Mixed Models in Longitudinal Studies.Statistics in Medicine, 45(25-27), e70830 doi:10.1002/sim.70830
Fan, K., Srijana, S., Dissanayake, V. and Wu, C. (2026). Robust Bayesian high-dimensional variable selection and inference with the horseshoe family of priors. Computational Statistics & Data Analysis, 219, 108358 doi:10.1016/j.csda.2026.108358
Fan, K., Jiang, Y., Ma, S., Wang, W. and Wu, C. (2025). Robust Sparse Bayesian Regression for Longitudinal Gene-Environment Interactions. Journal of the Royal Statistical Society Series C: Applied Statistics, 74(5), 1372–1394 doi:10.1093/jrsssc/qlaf027
Fan, K., Subedi, S., Yang, G., Lu, X., Ren, J. and Wu, C. (2024). Is Seeing Believing? A Practitioner's Perspective on High-dimensional Statistical Inference in Cancer Genomics Studies. Entropy, 26(9).794 doi:10.3390/e26090794
Ren, J., Zhou, F., Li, X., Ma, S., Jiang, Y. and Wu, C. (2023). Robust Bayesian variable selection for gene-environment interactions. Biometrics, 79(2), 684-694 doi:10.1111/biom.13670
Zhou, F., Ren, J., Ma, S. and Wu, C. (2023). The Bayesian regularized quantile varying coefficient model. Computational Statistics & Data Analysis, 187, 107808 doi:10.1016/j.csda.2023.107808
Zhou, F., Lu, X., Ren, J., Fan, K., Ma, S., and Wu, C. (2022). Sparse group variable selection for gene–environment interactions in the longitudinal study. Genetic epidemiology, 46(5-6), 317-340 doi:10.1002/gepi.22461
Zhou, F., Ren, J., Li, G., Jiang, Y., Li, X., Wang, W. and Wu, C. (2019). Penalized Variable Selection for Lipid-Environment Interactions in a Longitudinal Lipidomics Study. Genes, 10(12), 1002 doi:10.3390/genes10121002
Ren, J., Zhou, F., Li, X., Ma, S., Jiang, Y. and Wu, C. (2020). roben: Robust Bayesian Variable Selection for Gene-Environment Interactions. R package version 0.1.1. https://CRAN.R-project.org/package=roben
Zhou, F., Ren, J., Lu, X., Ma, S. and Wu, C. (2021). Gene–Environment Interaction: a Variable Selection Perspective. Epistasis. Methods in Molecular Biology. 2212:191–223 doi:10.1007/978-1-0716-0947-7_13
Ren, J., Zhou, F., Li, X., Chen, Q., Zhang, H., Ma, S., Jiang, Y. and Wu, C. (2020) Semi-parametric Bayesian variable selection for gene-environment interactions. Statistics in Medicine, 39: 617– 638 doi:10.1002/sim.8434
Ren, J., Zhou, F., Li, X., Wu, C. and Jiang, Y. (2019) spinBayes: Semi-Parametric Gene-Environment Interaction via Bayesian Variable Selection. R package version 0.1.0. https://CRAN.R-project.org/package=spinBayes
Wu, C., Jiang, Y., Ren, J., Cui, Y. and Ma, S. (2018). Dissecting gene-environment interactions: A penalized robust approach accounting for hierarchical structures. Statistics in Medicine, 37:437–456 doi:10.1002/sim.7518
Wu, C., Cui, Y., and Ma, S. (2014). Integrative analysis of gene–environment interactions under a multi–response partially linear varying coefficient model. Statistics in Medicine, 33(28), 4988–4998 doi:10.1002/sim.6287
Wu, C., Zhong, P.S. and Cui, Y. (2013). High dimensional variable selection for gene-environment interactions. Technical Report. Michigan State University.
See Also
fit a robust Bayesian longitudinal regularized semi-parametric mixed model
Description
fit a robust Bayesian longitudinal regularized semi-parametric mixed model
Usage
Blend(
y,
x,
t,
J,
kn,
degree,
iterations = 10000,
burn.in = NULL,
robust = TRUE,
sparse = TRUE,
structural = TRUE
)
Arguments
y |
the vector of repeated measurements of the response variable. The current version supports only continuous responses. |
x |
the matrix of predictors for repeated measurements, including an intercept in the first column. |
t |
the vector of observation time points corresponding to the repeated measurements of all subjects. |
J |
the vector specifying the number of repeated measurements for each subject. |
kn |
the number of interior knots for B-spline. |
degree |
the degree of B spline basis. |
iterations |
the number of MCMC iterations. |
burn.in |
the number of iterations for burn-in. If NULL (default), the first half of the iterations are discarded as burn-in. |
robust |
logical flag. If TRUE, robust methods will be used. |
sparse |
logical flag. If TRUE, spike-and-slab priors will be used to shrink coefficients of irrelevant covariates to zero exactly. |
structural |
logical flag. If TRUE, the coefficient functions with varying effects and constant effects will be penalized separately. |
Details
Consider the data model described in data:
Y_{ij} = \alpha_0(t_{ij}) +
\sum_{k=1}^{m}\beta_k(t_{ij})X_{ijk} +
Z_{ij}^\top\zeta_i + \epsilon_{ij}.
The coefficient functions are approximated using B-spline
basis expansions. When structural=TRUE (default),
an equivalent change of basis is performed automatically:
\beta_k(\cdot) \approx \gamma_{k1} +
\sum_{u=2}^{q} B_{ku}(\cdot)\gamma_{ku},
where B_{ku}(\cdot) denotes the B-spline basis function,
and \gamma_{k1} and
(\gamma_{k2}, \ldots, \gamma_{kq})^\top
represent the constant and varying components of the
coefficient function, respectively.
The number of basis functions is q=kn+degree+1.
By default, kn=2 and degree=2.
When structural=TRUE (default), constant and
time-varying effects are regularized separately.
Otherwise, each coefficient function is regularized
as a whole without separating constant and
time-varying effects.
When sparse=TRUE (default), spike-and-slab priors
are imposed at the individual and/or group levels for
variable selection. Otherwise, Laplacian shrinkage priors
are used without inducing exact sparsity.
When robust=TRUE (default), the error terms
\epsilon_{ij} are modeled using a Laplace distribution
with density
f(\epsilon_{ij}\mid\tau) =
\frac{\tau}{4}\exp\left\{-\frac{\tau}{2}
|\epsilon_{ij}|\right\},
where \tau>0 and 2/\tau is the scale parameter.
When robust=FALSE, the error terms are modeled
using a Gaussian distribution.
Posterior inference is conducted through Gibbs sampling.
Please check the references for more details about the prior distributions.
Value
an object of class ‘Blend’ is returned, which is a list with component:
posterior |
the posteriors of coefficients. |
coefficient |
the posterior estimates of the model coefficients. |
burn.in |
the total number of burn-ins. |
iterations |
the total number of iterations. |
structural |
a logical value indicating whether the structural model is used. |
basis |
a list containing the number of B-spline basis
functions ( |
See Also
Examples
data(dat)
## default method
fit = Blend(y,x,t,J,kn,degree)
fit$coefficient
## alternative: robust non-structural
fit = Blend(y,x,t,J,kn,degree, structural=FALSE)
fit$coefficient
## alternative: non-robust structural
fit = Blend(y,x,t,J,kn,degree, robust=FALSE)
fit$coefficient
## alternative: non-robust non-structural
fit = Blend(y,x,t,J,kn,degree, robust=FALSE, structural=FALSE)
fit$coefficient
Coverage indicators for a Blend object
Description
Calculate coverage indicators for varying and constant effects based on posterior credible intervals.
Usage
Coverage(x, truth, level = 0.95, n.grid = 200)
Arguments
x |
A fitted Blend object. |
truth |
A list of true coefficient functions and constant coefficients, including the intercept. |
level |
The credible interval level. The default is 0.95. |
n.grid |
The number of equally spaced grid points used to evaluate coefficient function coverage. The default is 200. |
Value
A named list of binary coverage indicators, with one element for each coefficient, including the intercept.
See Also
Examples
data(dat)
fit = Blend(y, x, t, J, kn, degree)
u = as.numeric(fit$basis$u)
truth = list(
gamma0 = function(u) 2+2*sin(2*pi*u),
gamma1 = function(u) 2.5*exp(2.5*u-1),
gamma2 = function(u) 3*u^2-2*u+2,
gamma3 = function(u) -4*u^3+3,
gamma4 = function(u) 3-2*u,
gamma5 = 0.8,
gamma6 = -1.2,
gamma7 = 0.7,
gamma8 = -1.1,
gamma9 = 0,
gamma10 = 0,
gamma11 = 0,
gamma12 = 0,
gamma13 = 0,
gamma14 = 0,
gamma15 = 0
)
out = Coverage(fit, truth)
print(out)
simulated data for demonstrating the features of Blend
Description
Simulated gene expression data for demonstrating the features of Blend.
Format
The data object consists of 8 components: y, x, t, J, kn and degree.
Details
The data and model setting
Consider a longitudinal study of n subjects with
J_i repeated measurements for the i-th subject.
Let Y_{ij} denote the response for the i-th subject
at observation time t_{ij}, where 1 \leq i \leq n
and 1 \leq j \leq J_i.
Let X_{ij} = (X_{ij1}, \ldots, X_{ijm})^\top
denote an m-dimensional vector of predictors.
We consider the following varying coefficient mixed-effects model:
Y_{ij} = \alpha_0(t_{ij}) +
\sum_{k=1}^{m} \beta_k(t_{ij}) X_{ijk} +
Z_{ij}^\top \zeta_i + \epsilon_{ij},
where \alpha_0(t_{ij}) is the varying intercept,
\beta_k(t_{ij}) is the coefficient function for the
k-th predictor, and \zeta_i \sim N(0,\Lambda)
is the vector of random effects.
The coefficient functions are approximated using B-spline basis expansions. Under structured identification, an equivalent change of basis leads to
\beta_k(t_{ij}) \approx \gamma_{k1} +
\sum_{l=2}^{L} B_l(t_{ij}) \gamma_{kl},
where L=kn+degree+1 is the number of basis functions.
The scalar \gamma_{k1} and the coefficient vector
(\gamma_{k2}, \ldots, \gamma_{kL})^\top correspond
to the constant and time-varying components, respectively.
This formulation allows the identification of constant
and time-varying effects.
Without structured identification, constant and
time-varying effects are not separated.
For the random intercept and slope model,
Z_{ij}^\top = (1,j) and
\zeta_i = (\zeta_{i1}, \zeta_{i2})^\top.
Through Cholesky decomposition
\Lambda = \Delta \Delta^\top, the random effects
are reparameterized as \zeta_i = \Delta b_i,
where b_i \sim N(0,I_2). Consequently,
Z_{ij}^\top \zeta_i =
(b_i^\top \otimes Z_{ij}^\top) J_2 \delta,
where \delta contains the lower triangular elements
of \Delta, and J_2 is a transformation matrix
satisfying \mathrm{vec}(\Delta) = J_2 \delta.
In the simulated data,
Y = \alpha_{0}(t)+\beta_{1}(t)X_{1} + \beta_{2}(t)X_{2} + \beta_{3}(t)X_{3}+ \beta_{4}(t)X_{4}+0.8X_{5} -1.2 X_{6} + 0.7X_{7}-1.1 X_{8}+\epsilon
where \epsilon\sim N(0,1), \alpha_{0}(t)=2+\sin(2\pi t), \beta_{1}(t)=2.5\exp(2.5t-1) ,\beta_{2}(t)=3t^2-2t+2,\beta_{3}(t)=-4t^3+3 and \beta_{4}(t)=3-2t
See Also
Examples
data(dat)
length(y)
dim(x)
length(t)
length(J)
print(t)
print(J)
print(kn)
print(degree)
Plot a Blend object
Description
Plot the intercept function and the identified varying effects with pointwise posterior credible intervals.
Usage
plot_Blend(x, sparse, prob=0.95, n.grid=200)
Arguments
x |
A fitted Blend object. |
sparse |
Logical value indicating whether a sparse model is used. |
prob |
probability for credible interval, between 0 and 1. e.g. prob=0.95 leads to 95% credible interval. |
n.grid |
The number of evaluation grid points. The default is 200. |
Value
Plots of the intercept function and selected coefficient functions.
See Also
Examples
data(dat)
fit = Blend(y,x,t,J,kn,degree)
plot_Blend(fit,sparse=TRUE)
Variable selection for a Blend object
Description
Variable selection for a Blend object
Usage
selection(obj, sparse)
Arguments
obj |
Blend object. |
sparse |
logical flag. If TRUE, spike-and-slab priors will be used to shrink coefficients of irrelevant covariates to zero exactly. |
Details
If sparse, the median probability model (MPM) (Barbieri and Berger, 2004) is used to identify predictors that are significantly associated with the response variable. Otherwise, variable selection is based on 95% credible interval. Please check the references for more details about the variable selection.
Value
an object of class ‘selection’ is returned, which is a list with component:
method |
posterior samples from the MCMC |
indices |
a list of indices and names of selected variables |
summary |
a summary of selected variables |
References
Ren, J., Zhou, F., Li, X., Ma, S., Jiang, Y. and Wu, C. (2023). Robust Bayesian variable selection for gene-environment interactions. Biometrics, 79(2), 684-694 doi:10.1111/biom.13670
Barbieri, M.M. and Berger, J.O. (2004). Optimal predictive model selection. Ann. Statist, 32(3):870–897
See Also
Examples
data(dat)
## sparse
fit = Blend(y,x,t,J,kn,degree)
selected=selection(fit,sparse=TRUE)
selected
## non-sparse
fit = Blend(y,x,t,J,kn,degree,sparse="FALSE")
selected=selection(fit,sparse=FALSE)
selected