Blend: fit a robust Bayesian longitudinal regularized...

View source: R/Blend.R

BlendR Documentation

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 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 (q), the number of interior knots (kn), the degree of B-splines (degree), the original observation times (t), the number of covariates excluding the intercept (m), and the transformed observation times (u).

See Also

data

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




Blend documentation built on Dec. 1, 2026, 1:07 a.m.