BayesReg: Bayesian linear regression output

View source: R/BayesReg.R

BayesRegR Documentation

Bayesian linear regression output

Description

This function contains the R code for the implementation of Zellner's G-prior analysis of the regression model as described in Chapter 3. The purpose of BayesRef is dual: first, this R function shows how easily automated this approach can be. Second, it also illustrates how it is possible to get exactly the same type of output as the standard R function summary(lm(y~X)). In particular, it calculates the Bayes factors for variable selection, more precisely single variable exclusion.

Usage

BayesReg(y, X, g = length(y), betatilde = rep(0, dim(X)[2]), prt = TRUE)

Arguments

y

response variable

X

matrix of regressors

g

constant g for the G-prior

betatilde

prior mean on beta

prt

boolean variable for printing out the standard output

Value

postmeancoeff

posterior mean of the regression coefficients

postsqrtcoeff

posterior standard deviation of the regression coefficients

log10bf

log-Bayes factors against the full model

postmeansigma2

posterior mean of the variance of the model

postvarsigma2

posterior variance of the variance of the model

Examples

data(faithful)
BayesReg(faithful[,1],faithful[,2])

bayess documentation built on Aug. 11, 2022, 5:07 p.m.

Related to BayesReg in bayess...