sample_params_lm | R Documentation |
Sample the parameters for a linear regression model assuming a
ridge prior for the (non-intercept) coefficients. The number of predictors
p
may exceed the number of observations n
.
sample_params_lm(y, X, params, A = 10^4, XtX = NULL)
y |
|
X |
|
params |
the named list of parameters containing
|
A |
the prior scale for |
XtX |
the |
The updated named list params
with draws from the full conditional distributions
of sigma
and coefficients
(and updated mu
).
The parameters in coefficients
are:
beta
: the p x 1
vector of regression coefficients
sigma_beta
: the prior standard deviation for the (non-intercept)
components of beta
# Simulate data for illustration:
sim_dat = simulate_nb_lm(n = 100, p = 5)
y = sim_dat$y; X = sim_dat$X
# Initialize:
params = init_params_lm(y = y, X = X)
# Sample:
params = sample_params_lm(y = y, X = X, params = params)
names(params)
names(params$coefficients)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.