View source: R/create_models.R
create_models | R Documentation |
Produces a list of country models for each model specification that should be estimated.
create_models(
country_data,
weight_data,
global_data = NULL,
model_specs = NULL
)
country_data |
a named list of time-series objects of country-specific data. |
weight_data |
a matrix or an array of weights, usually, the output of a call to |
global_data |
a named time-series object of global data. |
model_specs |
a list of model specifications, usuall, the output of a call to |
A list of country data and model specifications.
# 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:2),
foreign = list(variables = c("y", "Dp", "r"), lags = 1:2),
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 the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.