bayesLm: MCMC algorithm for Bayesian Linear Model

Description Usage Arguments Details Value

View source: R/fn_bayesLm.R

Description

Fits the linear regression model β~N(μ_0, Σ_0), σ^2~IG(a0, b0), y~N(Xβ, σ^2 I)

Usage

1
bayesLm(y, X, mu0, Sigma0, a0, b0, sigma2Int, nkeep = 10000, nburn = 1000)

Arguments

y

vector of repsonse

X

design matrix for regression. If intercept is desired, a column of 1's is needed

mu0

prior mean for beta

Sigma0

prior var-cov matrix for β

a0

prior shape parameter for σ^2

nkeep

number of iterations to keep

nburn

number of iterations to toss

a0, b0

prior scale parameter for σ^2

sigma2Init

initial value for σ^2 in MCMC

Details

Uses Gibbs sampling to sample from the posterior under the above linear regression model.

Value

list with mcmc sample and mean fitted values


jrlewi/brlm documentation built on March 17, 2021, 1:10 a.m.