Sample the parameters for a linear regression model assuming a
horseshoe prior for the (non-intercept) coefficients. The number of predictors
p
may exceed the number of observations n
.
sample_lm_hs(y, X, params, XtX = NULL, X_test = NULL)
The updated named list params
with draws from the full conditional distributions
of sigma
and coefficients
(along with updated mu
and mu_test
if applicable).
n x 1
vector of data
n x p
matrix of predictors
the named list of parameters containing
mu
n x 1
vector of conditional means (fitted values)
sigma
the conditional standard deviation
coefficients
a named list of parameters that determine mu
the p x p
matrix of crossprod(X)
(one-time cost);
if NULL, compute within the function
matrix of predictors at test points (default is NULL)