create_specifications: Create Country Model Specifications

View source: R/create_specifications.R

create_specificationsR Documentation

Create Country Model Specifications

Description

Produces a list of model specifications for each country in a GVAR model.

Usage

create_specifications(
  country_data,
  global_data = NULL,
  countries = NULL,
  domestic,
  foreign,
  global = NULL,
  deterministic = NULL,
  type = "VAR",
  r = NULL,
  structural = NULL,
  tvp = FALSE,
  sv = FALSE,
  iterations = 50000,
  burnin = 5000
)

Arguments

country_data

a named list of time-series objects of country-specific data.

global_data

a named time-series object of global data.

countries

a character vector of country names, which should enter the GVAR model. The names must correspond to the names of the elements in country_data. If NULL (default), all countries are included.

domestic

a named list of specificatios for domestic variables. See also 'Details'.

foreign

a named list of specificatios for foreign variables. See also 'Details'.

global

a named list of specificatios for global variables. See also 'Details'.

deterministic

a named list of specifications for deterministic terms. See alos 'Details'.

type

a character specifying if the country models are estimated as vector autoregressive "VAR" (default) or vector error correction "VEC" models.

r

an integer or vector for the cointegration rank of VEC models. See also 'Details'.

structural

a character vector of country names, for which structural models should be estimated. If NULL (default), no country-model will be structural.

tvp

logical indicating whether the coefficients of the model are time varying (default is FALSE).

sv

logical indicating whether the error variances are time varying and should be estimated using a stochastic volatility algorithm (default is FALSE).

iterations

an integer of MCMC draws excluding burn-in draws (defaults to 50000).

burnin

an integer of MCMC draws used to initialize the sampler (defaults to 5000). These draws do not enter the computation of posterior moments, forecasts etc.

Details

For arguments domestic, foreign or global a list should be provided, which contains a vector of the names of used variables in element "variables", i.e., variables = c("var1", "var2", ...), where "var1" is the name of a column in object "country_data" or "global_data". Similarly, the lag order of each variable group can be changed by adding an element "lags" with an integer or integer vector, i.e. lags = 1. If a vector is provided, create_models will produce a distinct model for all possible specifications.

If a list is provided as argument deterministic, it can contain the following elements:

const

either logical for VAR models or a character specifying whether a constant term enters the error correction term ("restricted") or the non-cointegration term ("unrestricted") of a VEC model. If 'NULL' (default) no constant term will be added.

trend

either logical for VAR models or a character specifying whether a trend term enters the error correction term ("restricted") or the non-cointegration term ("unrestricted") of a VEC model. If 'NULL' (default) no trend term will be added.

seasonal

either logical for VAR models or a character specifying whether seasonal dummies enter the error correction term ("restricted") or the non-cointegreation term ("unrestricted"). If 'NULL' (default) no seasonal terms will be added. The amount of dummy variables depends on the frequency of the time series data in each list element.

The argument rank is only used when type = "VEC". Otherwise, the rank is set to zero. If a vector is provided, create_models will produce a distinct model for all possible specifications.

Value

A list of model specifications for each country.

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!


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