Given an lm
object, the bayesLMConjugate
function fits a
simple Bayesian linear model with Normal and inverseGamma priors.
1 2 3  bayesLMConjugate(formula, data = parent.frame(), n.samples,
beta.prior.mean, beta.prior.precision,
prior.shape, prior.rate, ...)

formula 
for a univariate model, this is a symbolic description of the regression model to be fit. See example below. 
data 
an optional data frame containing the variables in the
model. If not found in data, the variables are taken from

n.samples 
the number of posterior samples to collect. 
beta.prior.mean 
beta multivariate normal mean vector hyperprior. 
beta.prior.precision 
beta multivariate normal precision matrix hyperprior. 
prior.shape 
sigma.sq inverseGamma shape hyperprior. 
prior.rate 
sigma.sq inverseGamma 1/scale hyperprior. 
... 
currently no additional arguments. 
An object of class bayesLMConjugate
, which is a list with at
least the following tag:
p.samples 
a 
Sudipto Banerjee sudiptob@biostat.umn.edu,
Andrew O. Finley finleya@msu.edu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27  ## Not run:
data(FORMGMT.dat)
n = nrow(FORMGMT.dat)
p = 7 ##an intercept and six covariates
n.samples < 500
## Below we demonstrate the conjugate function in the special case
## with improper priors. The results are the same as for the above,
## up to MC error.
beta.prior.mean < rep(0, times=p)
beta.prior.precision < matrix(0, nrow=p, ncol=p)
prior.shape < p/2
prior.rate < 0
m.1 <
bayesLMConjugate(Y ~ X1+X2+X3+X4+X5+X6, data = FORMGMT.dat,
n.samples, beta.prior.mean,
beta.prior.precision,
prior.shape, prior.rate)
summary(m.1$p.samples)
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.