Sample the parameters for an additive model, which may contain both linear and nonlinear predictors. The nonlinear terms are modeled using orthogonalized splines. The sampler draws the linear terms jointly and then samples each vector of nonlinear coefficients using Bayesian backfitting (i.e., conditional on all other nonlinear and linear terms).
sample_bam_orthog(
y,
X_lin,
X_nonlin,
params,
A = 10^4,
B_all = NULL,
diagBtB_all = NULL,
XtX = NULL
)
The updated named list params
with draws from the full conditional distributions
of sigma
and coefficients
(and updated mu
).
n x 1
vector of data
n x pL
matrix of predictors to be modelled as linear
n x pNL
matrix of predictors to be modelled as nonlinear
the named list of parameters containing
mu
: vector of conditional means (fitted values)
sigma
: the conditional standard deviation
coefficients
: a named list of parameters that determine mu
the prior scale for sigma_beta
, which we assume follows a Uniform(0, A) prior.
optional pNL
-dimensional list of n x L[j]
dimensional
basis matrices for each nonlinear term j=1,...,pNL; if NULL, compute internally
optional pNL
-dimensional list of diag(crossprod(B_all[[j]]))
;
if NULL, compute internally
optional p x p
matrix of crossprod(X)
(one-time cost);
if NULL, compute internally