Generates inputs necessary to build the likelihood function for the ATSM model
Source:R/InputsForOpt.R
InputsForOpt.RdGenerates inputs necessary to build the likelihood function for the ATSM model
Usage
InputsForOpt(
InitialSampleDate,
FinalSampleDate,
ModelType,
Yields,
GlobalMacro,
DomMacro,
FactorLabels,
Economies,
DataFrequency,
GVARlist = NULL,
JLLlist = NULL,
WishBRW = FALSE,
BRWlist = NULL,
UnitYields = "Month",
CheckInputs = TRUE,
BS_Adj = FALSE,
verbose = TRUE
)Arguments
- InitialSampleDate
Start date of the sample period in the format "dd-mm-yyyy"
- FinalSampleDate
End date of the sample period in the format "dd-mm-yyyy"
- ModelType
character. Model type to be estimated. Permissible choices: "JPS original", "JPS global", "GVAR single", "JPS multi", "GVAR multi", "JLL original", "JLL No DomUnit", "JLL joint Sigma".
- Yields
numerical matrix with time series of yields (
J x TdorCJ x Td)- GlobalMacro
numerical matrix with time series of the global risk factors (
G x Td)- DomMacro
numerical matrix with time series of the country-specific risk factors for all
Ccountries (C X TdorCM x Td)- FactorLabels
list. Labels for all variables present in the model, as returned by
LabFac.- Economies
character vector. Names of the
Ceconomies included in the system.- DataFrequency
character. Data frequency. Permissible choices: "Daily All Days", "Daily Business Days", "Weekly", "Monthly", "Quarterly", "Annually".
- GVARlist
list. Inputs for GVAR model estimation. See details below.
- JLLlist
list. Inputs for JLL model estimation. See details below.
- WishBRW
logical. Whether to estimate the physical parameter model with bias correction (see
Bias_Correc_VAR). Default is FALSE.- BRWlist
list. Inputs for bias-corrected estimation.
- UnitYields
character. Maturity unit of yields. Permissible choices: "Month" or "Year". Default is "Month".
- CheckInputs
logical. Whether to perform a prior check on the consistency of the provided input list. Default is TRUE.
- BS_Adj
logical. Whether to adjust the global series for the sepQ models in the Bootstrap setting. Default is FALSE.
- verbose
logical. Print progress messages. Default is TRUE.
Value
An object of class 'ATSMModelInputs' containing the necessary inputs for performing the model optimization.
Permissible options for GVARlist
VARXtype: "unconstrained" or "constrained"W_type: "Time-varying" or "Sample Mean"t_First_Wgvar,t_Last_Wgvar: year as character
Permissible options for JLLlist
DomUnit: name of the dominant economy orNoneWishSigmas: TRUE (estimate variance-covariance matrices) or FALSESigmaNonOrtho: NULL orK x Kmatrix
Permissible options for BRWlist
BiasCorrection: TRUE (bias-corrected) or FALSEflag_mean: TRUE (mean) or FALSE (median)gamma: numeric adjustment parameterN_iter: number of iterationsN_burn: number of burn-in iterationsB: number of bootstrap samplescheckBRW: TRUE or FALSEB_check: number of bootstrap samples for closeness check
General Notation
Tdmodel time series dimension.Cnumber of countries in the system.Gnumber of global unspanned factors.Mnumber of country-specific unspanned factors.Ktotal number of risk factors.Jnumber of bond yields per country used in estimation.
Examples
# \donttest{
# Example 1:
data(GlobalMacro)
data(DomMacro)
data(Yields)
ModelType <- "JPS original"
Economies <- "Mexico"
t0 <- "01-05-2007" # Initial Sample Date (Format: "dd-mm-yyyy")
tF <- "01-12-2018" # Final Sample Date (Format: "dd-mm-yyyy")
N <- 3
GlobalVar <- c("Gl_Eco_Act") # Global Variables
DomVar <- c("Eco_Act") # Domestic Variables
FactorLabels <- LabFac(N, DomVar, GlobalVar, Economies, ModelType)
DataFreq <- "Monthly"
ATSMInputs <- InputsForOpt(t0, tF, ModelType, Yields, GlobalMacro, DomMacro,
FactorLabels, Economies, DataFreq,
CheckInputs = FALSE, verbose = FALSE
)
# Example 2:
LoadData("CM_2024")
ModelType <- "GVAR multi"
Economies <- c("China", "Brazil", "Mexico", "Uruguay")
t0 <- "01-05-2007" # InitialSampleDate (Format: "dd-mm-yyyy")
tF <- "01-12-2019" # FinalSampleDate (Format: "dd-mm-yyyy")
N <- 2
GlobalVar <- c("Gl_Eco_Act", "Gl_Inflation") # Global Variables
DomVar <- c("Inflation") # Domestic Variables
FactorLabels <- LabFac(N, DomVar, GlobalVar, Economies, ModelType)
DataFreq <- "Monthly"
GVARlist <- list(
VARXtype = "unconstrained", W_type = "Sample Mean",
t_First_Wgvar = "2007", t_Last_Wgvar = "2019", DataConnectedness = TradeFlows
)
ATSMInputs <- InputsForOpt(t0, tF, ModelType, Yields, GlobalMacro, DomMacro,
FactorLabels, Economies, DataFreq, GVARlist,
CheckInputs = FALSE, verbose = FALSE
)
# Example 3:
LoadData("CM_2024")
ModelType <- "JLL original"
Economies <- c("China", "Brazil", "Uruguay")
t0 <- "01-05-2007" # InitialSampleDate (Format: "dd-mm-yyyy")
tF <- "01-12-2019" # FinalSampleDate (Format: "dd-mm-yyyy")
N <- 2
GlobalVar <- c("Gl_Eco_Act", "Gl_Inflation") # Global Variables
DomVar <- c("Eco_Act", "Inflation") # Domestic Variables
FactorLabels <- LabFac(N, DomVar, GlobalVar, Economies, ModelType)
JLLinputs <- list(DomUnit = "China")
DataFrequency <- "Monthly"
ATSMInputs <- InputsForOpt(t0, tF, ModelType, Yields, GlobalMacro, DomMacro,
FactorLabels, Economies, DataFreq,
JLLlist = JLLinputs,
CheckInputs = FALSE, verbose = FALSE
)
# }