Learn R Programming

spBayes (version 0.0-7)

bayes.lm.ref: Simple Bayesian linear model with non-informative priors

Description

Given an lm object, the bayes.lm.ref function fits a simple Bayesian linear model with reference (non-informative) priors.

Usage

bayes.lm.ref(lm.obj, n.samples, ...)

Arguments

lm.obj
an object returned by lm.
n.samples
the number of posterior samples to collect.
...
currently no additional arguments.

Value

  • A CODA mcmc matrix object with columns corresponding to each parameter and posterior samples held in the rows.

Details

See page 355 in Gelman et al. (2004).

References

Gelman, A., Carlin, J.B., Stern, H.S., and Rubin, D.B. (2004). Bayesian Data Analysis. 2nd ed. Boca Raton, FL: Chapman and Hall/CRC Press.

Examples

Run this code
data(FORMGMT.dat)

lm.obj <- lm(Y ~ X1+X2+X3+X4+X5+X6, data = FORMGMT.dat)

summary(lm.obj)

##Now with bayes.lm.ref
n.samples <- 500

out.bayes.lm.ref <- bayes.lm.ref(lm.obj, n.samples)

summary(out.bayes.lm.ref)

Run the code above in your browser using DataLab