g_regression_fast: Fast regression with g prior

View source: R/g_regression_fast.R

g_regression_fastR Documentation

Fast regression with g prior

Description

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

Usage

g_regression_fast(data, g = 0.5)

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. Default value: g = 0.5.

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_fast(data, g = 0.99)
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_fast(data, g = 1.1)
g_result[[1]]
g_result[[2]]


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