g_regression_fast_const: Fast regression with g prior for a model with just a constant

View source: R/g_regression_fast_const.R

g_regression_fast_constR Documentation

Fast regression with g prior for a model with just a constant

Description

The function implements Bayesian regression with g prior (Zellner, 1986) for a model with just a constant

Usage

g_regression_fast_const(y, g = 0.5)

Arguments

y

A vector with data - only the dependent variable.

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
g_result <- g_regression_fast_const(y, 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
g_result <- g_regression_fast_const(y, g = 1.1)
g_result[[1]]
g_result[[2]]


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