Skip to contents

Runs a module in two different ways depending on whether the module is endogenously modelled or endogenous by identity/definition.

Usage

run_module(
  module,
  data,
  classification,
  use_logs = c("both", "y", "x"),
  trend = TRUE,
  ardl_or_ecm = "ardl",
  max.ar = 4,
  max.dl = 2,
  saturation = c("IIS", "SIS"),
  saturation.tpval = 0.01,
  max.block.size = 20,
  gets_selection = TRUE,
  selection.tpval = 0.01
)

Arguments

module

A row of the specification table.

data

A tibble or data.frame containing the full data for the aggregate model.

classification

A data.frame with two columns: 'var' stores the Eurostat variable code and 'class' the classification code (one of "n", "d", or "x") reflecting whether the variable is endogenous by modelling, endogenous by identity/definition, or exogenous. As returned by classify_variables.

use_logs

Character vector. Either "both", "x", or "y" to decide whether to use logs.

trend

Logical. Should a trend be added? Default is TRUE.

ardl_or_ecm

Either 'ardl' or 'ecm' to determine whether to estimate the model as an Autoregressive Distributed Lag Function (ardl) or as an Equilibrium Correction Model (ecm).

max.ar

Integer. The maximum number of lags to use for the AR terms. as well as for the independent variables.

max.dl

Integer. The maximum number of lags to use for the independent variables (the distributed lags).

saturation

Carry out Indicator Saturation using the 'isat' function in the 'gets' package. Needes is a character vector or string. Default is 'c("IIS","SIS")' to carry out Impulse Indicator Saturation and Step Indicator Saturation. Other possible values are 'NULL' to disable or 'TIS' or Trend Indicator Saturation. When disabled, estimation will be carried out using the 'arx' function from the 'gets' package.

saturation.tpval

The target p-value of the saturation methods (e.g. SIS and IIS, see the 'isat' function in the 'gets' package). Default is 0.01.

max.block.size

Integer. Maximum size of block of variables to be selected over, default = 20.

gets_selection

Logical. Whether general-to-specific selection using the 'getsm' function from the 'gets' package should be done on the final saturation model. Default is TRUE.

selection.tpval

Numeric. The target p-value of the model selection methods (i.e. general-to-specific modelling, see the 'getsm' function in the 'gets' package). Default is 0.01.

Value

Returns a list with two named elements.

model

For endogenously modeled modules (type == "n"), an object of class isat or arx. For identity/definition modules (type == "d"), NULL.

data

The data (including transformations) that was used to estimate the model and the fitted values of the dependent variable.