model_space: Calculation of the model space

View source: R/model_space.R

model_spaceR Documentation

Calculation of the model space

Description

This function calculates all possible models with M regressors that can be constructed out of K regressors.

Usage

model_space(data, M = NULL, g = "UIP", HC = FALSE)

Arguments

data

Data set to work with. The first column is the data for the dependent variable, and the other columns is the data for the regressors.

M

Maximum number of regressor in the estimated models (default is K - total number of 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
f) "None" for the case with no g prior and simple ols regression. In this case the marginal likelihood is calculated according to formula proposed by Leamer (1978).

HC

Logical indicator (default = FALSE) specifying whether a heteroscedasticity-consistent covariance matrix should be used for the estimation of standard errors (MacKinnon & White 1985).

Value

A list with model_space objects:

  1. x_names - vector with names of the regressors

  2. ols_results - table with the model space - contains ols objects for all the estimated models

  3. MS - size of the mode space

  4. M - maximum number of regressors in a model

  5. K- total number of regressors

Examples

x1 <- rnorm(20, mean = 0, sd = 1)
x2 <- rnorm(20, mean = 0, sd = 2)
x3 <- rnorm(20, mean = 0, sd = 3)
x4 <- rnorm(20, mean = 0, sd = 1)
x5 <- rnorm(20, mean = 0, sd = 2)
x6 <- rnorm(20, mean = 0, sd = 4)
e <- rnorm(20, mean = 0, sd = 0.5)
y <- 2 + x1 + 2*x2 + e
data <- cbind(y,x1,x2,x3,x4,x5,x6)
modelSpace <- model_space(data, M = 3)


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