View source: R/create_specifications.R
create_specifications | R Documentation |
Produces a list of model specifications for each country in a GVAR model.
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
)
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 |
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 |
tvp |
logical indicating whether the coefficients of the model are time varying (default is |
sv |
logical indicating whether the error variances are time varying and should be estimated using a stochastic volatility algorithm (default is |
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. |
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.
A list of model specifications for each country.
# 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!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.