submodel_test_statistics: Test Statistics for the Selection of Submodels of GVAR Model

View source: R/submodel_test_statistics.R

submodel_test_statisticsR Documentation

Test Statistics for the Selection of Submodels of GVAR Model

Description

Calculates test statistics for the the selection of country-specific VARX or VECX models of a GVAR model.

Usage

submodel_test_statistics(object, ...)

Arguments

object

an object of class "bgvarest" or "bgvecest", usually, a result of a call to draw_posterior.gvarsubmodels or draw_posterior.gvecsubmodels, respectively.

...

further arguments passed to or from other methods.

Details

The log-likelihood for the calculation of the information criteria is obtained by

LL = \frac{1}{R} \sum_{i = 1}^{R} \left( \sum_{t = 1}^{T} -\frac{K^{dom}}{2} \ln 2\pi - \frac{1}{2} \ln |\Sigma_t^{(i)}| -\frac{1}{2} (u_t^{{(i)}\prime} (\Sigma_t^{(i)})^{-1} u_t^{(i)} \right)

, where u_t = y_t - \mu_t.

For VAR models the Akaike, Bayesian and Hannan–Quinn (HQ) information criteria are calculated as

AIC = 2 (K^{d}p^{d} + K^{f}p^{f} + Ms + N) - 2 LL

,

BIC = (K^{d}p^{d} + K^{f}p^{f} + Ms + N) ln(T) - 2 LL

and

HQ = 2 (K^{d}p^{d} + K^{f}p^{f} + Ms + N) ln(ln(T)) - 2 LL

, respectively, where K^{d} is the number of endogenous domestic variables, p^{d} the number of lags of endogenous domestic variables, K^{f} is the number of foreign variables, p^{f} the number of lags of foreign variables, M the number of global variables, s the number of lags of global variables, N the number of deterministic terms and T the number of observations.

Value

A list.

Examples

# Load data
data("gvar2019")

# Create regions
temp <- create_regions(country_data = gvar2019$country_data,
             weight_data = gvar2019$weight_data,
             region_weights = gvar2019$region_weights,
             regions = list(EA =  c("AT", "BE", "DE", "ES", "FI", "FR", "IT", "NL")),
             period = 3)

country_data <- temp$country_data
weight_data <- temp$weight_data
global_data = gvar2019$global_data

# Difference series to make them stationary
country_data <- diff_variables(country_data, variables = c("y", "Dp", "r"), multi = 100)
global_data <- diff_variables(global_data, multi = 100)

# Create time varying weights
weight_data <- create_weights(weight_data, period = 3, country_data = country_data)

# Generate specifications
model_specs <- create_specifications(
                 country_data = country_data,
                 global_data = global_data,
                 countries = c("US", "JP", "CA", "NO", "GB", "EA"), 
                 domestic = list(variables = c("y", "Dp", "r"), lags = 1),
                 foreign = list(variables = c("y", "Dp", "r"), lags = 1),
                 global = list(variables = c("poil"), lags = 1),
                 deterministic = list(const = TRUE, trend = FALSE, seasonal = FALSE),
                 iterations = 10,
                 burnin = 10)
# Note that the number of iterations and burnin draws should be much higher!
                                     
# Overwrite country-specific specifications
model_specs[["US"]][["domestic"]][["variables"]] <- c("y", "Dp", "r")
model_specs[["US"]][["foreign"]][["variables"]] <- c("y", "Dp")

# Create estimation objects
country_models <- create_models(country_data = country_data,
                                weight_data = weight_data,
                                global_data = global_data,
                                model_specs = model_specs)

# Add priors
models_with_priors <- add_priors(country_models,
                                 coef = list(v_i = 1 / 9, v_i_det = 1 / 10),
                                 sigma = list(df = 3, scale = .0001))

# Obtain posterior draws
object <- draw_posterior(models_with_priors)

# Obtain test statistics
tests <- submodel_test_statistics(object, ic = "BIC", select = "order")



franzmohr/bgvars documentation built on Sept. 2, 2023, 12:45 p.m.