powered by
Initialize the parameters for a linear regression model assuming a g-prior for the coefficients.
init_lm_gprior(y, X, X_test = NULL)
a named list params containing at least
params
mu: vector of conditional means (fitted values)
mu
sigma: the conditional standard deviation
sigma
coefficients: a named list of parameters that determine mu
coefficients
Additionally, if X_test is not NULL, then the list includes an element mu_test, the vector of conditional means at the test points
mu_test
n x 1 vector of data
n x 1
n x p matrix of predictors
n x p
n0 x p matrix of predictors at test points (default is NULL)
n0 x p
# Simulate data for illustration: sim_dat = simulate_nb_lm(n = 100, p = 5) y = sim_dat$y; X = sim_dat$X # Initialize: params = init_lm_gprior(y = y, X = X) names(params) names(params$coefficients)
Run the code above in your browser using DataLab