lm_proper: Fit a linear model with a proper prior.

Description Usage Arguments Value Examples

View source: R/lm_proper.R

Description

Fits a Bayesian linear regression model with a normal prior on beta and a gamma prior on the precision tau. 'Wide' priors are used by default.

Usage

1
2
3
lm_proper(data, formula, burnin = 5000, iterations = 5000, thin = 1,
  beta_prior_mean, beta_prior_cov, tau_prior_shape, tau_prior_rate,
  start_beta)

Arguments

data

A data frame.

formula

A formula describing the model fit. Passed to stats::lm() to construct the model matrix.

burnin

Number of burn in iterations.

iterations

Number of sampling iterations.

thin

Number of thinning iterations.

beta_prior_mean

(Optional) Mean vector for the prior on beta. Defaults to zero.

beta_prior_cov

(Optional) Covariance matrix for the prior on beta. Defaults to diag(p) * 100 where p is the number of predictors.

tau_prior_shape

(Optional) Shape parameter for the prior on tau. Defaults to 0.001.

tau_prior_rate

(Optional) Rate parameter for the prior on tau. Defaults to 0.001.

start_beta

(Optional) Beta starting vector. Defaults to beta hat, the frequentist estimate.

Value

An object of class geblm containing samples from the posterior distributions of beta and sigma.

Examples

1
fit <- lm_proper(mtcars, mpg ~ wt)

asbates/geblm documentation built on Nov. 12, 2019, 5:23 p.m.