g_regression: Regression with g prior

View source: R/g_regression.R

g_regressionR Documentation

Regression with g prior

Description

The function implements Bayesian regression with g prior (Zellner, 1986)

Usage

g_regression(data, g = "UIP")

Arguments

data

A matrix with data. The first column is interpreted as with the dependent variable, while the remaining columns are interpreted as regressors.

g

Value for g in the g prior. Either a number above zero specified by the user or:
a) "UIP" for Unit Information Prior (Kass and Wasserman, 1995)
b) "RIC" for Risk Inflation Criterion (Foster and George, 1994)
c) "Benchmark" for benchmark prior of Fernandez, Ley and Steel (2001)
d) "HQ" for prior mimicking Hannan-Quinn information criterion
e) "rootUIP" for prior given by the square root of Unit Information Prior

Value

A list with g_regression objects:

  1. Expected values of coefficients

  2. Posterior standard errors

  3. Natural logarithm of marginal likelihood

  4. R^2 form ols model

  5. Degrees of freedom

  6. Determinant of the regressors' matrix

Examples

x1 <- rnorm(100, mean = 0, sd = 1)
x2 <- rnorm(100, mean = 0, sd = 2)
e <- rnorm(100, mean = 0, sd = 5)
y <- 2 + x1 + 2*x2 + e
data <- cbind(y,x1,x2)
g_result <- g_regression(data, g = "UIP")
g_result[[1]]
g_result[[2]]

x1 <- rnorm(50, mean = 0, sd = 1)
x2 <- rnorm(50, mean = 0, sd = 2)
e <- rnorm(50, mean = 0, sd = 0.5)
y <- 2 + x1 + 2*x2 + e
data <- cbind(y,x1,x2)
g_result <- g_regression(data, g = "benchmark")
g_result[[1]]
g_result[[2]]


rmsBMA documentation built on March 14, 2026, 5:06 p.m.