Generates inputs necessary to build the likelihood function for the ATSM model
Source:R/InputsForOpt.R
InputsForOpt.Rd
Generates 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
A character vector indicating the model type to be estimated. Available options: "JPS original", "JPS global", "GVAR single", "JPS multi", "GVAR multi", "JLL original", "JLL No DomUnit", "JLL joint Sigma".
- Yields
A numerical matrix with time series of yields (J x T or CJ x T)
- GlobalMacro
A numerical matrix with time series of the global risk factors (G x T)
- DomMacro
A numerical matrix with time series of the country-specific risk factors for all C countries (CM x T)
- FactorLabels
A list of character vectors with labels for all variables in the model.
- Economies
A character vector containing the names of the economies included in the system.
- DataFrequency
A character vector specifying the frequency of the data. Available options are: "Daily All Days", "Daily Business Days", "Weekly", "Monthly", "Quarterly", or "Annually".
- GVARlist
A list containing the necessary inputs for the estimation of GVAR-based models
- JLLlist
A list of necessary inputs for the estimation of JLL-based models. If the chosen model is "JLL original" or "JLL joint Sigma", then a dominant unit economy must be chosen. Otherwise, this list must be set as 'None'.
- WishBRW
Logical. Whether to estimate the physical parameter model with bias correction, based on the method by Bauer, Rudebusch and Wu (2012). Default is FALSE.
- BRWlist
List of necessary inputs for performing the bias-corrected estimation.
- UnitYields
A character string indicating the maturity unit of yields. Options are: "Month" for yields expressed in months, or "Year" for yields expressed in years. 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 flag controlling function messaging. Default is TRUE.
Value
An object of class 'ATSMModelInputs' containing the necessary inputs for performing the model optimization.
Examples
# \donttest{
# Example 1:
data(CM_GlobalMacroFactors)
data(CM_DomMacroFactors)
data(CM_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, GlobalMacroVar, DomesticMacroVar,
FactorLabels, Economies, DataFreq, CheckInputs = FALSE)
#> 1) PREPARING INPUTS FOR THE ESTIMATION OF THE MODEL: JPS original . SAMPLE PERIOD: 01-05-2007 - 01-12-2018
#> 1.1) Constructing the time-series of the risk factors
#> 1.2) Estimating model P-dynamics parameters:
#> - Without the bias-correction procedure
# 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, GlobalMacroVar, DomesticMacroVar,
FactorLabels, Economies, DataFreq, GVARlist, CheckInputs = FALSE)
#> 1) PREPARING INPUTS FOR THE ESTIMATION OF THE MODEL: GVAR multi . SAMPLE PERIOD: 01-05-2007 - 01-12-2019
#> 1.1) Constructing the time-series of the risk factors
#> 1.2) Estimating model P-dynamics parameters:
#> - Without the bias-correction procedure
# Example 3:
if (requireNamespace('neldermead', quietly = TRUE)) {
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, GlobalMacroVar, DomesticMacroVar,
FactorLabels, Economies, DataFreq, JLLlist = JLLinputs,
CheckInputs = FALSE)
} else {
message("skipping functionality due to missing Suggested dependency")
}
#> 1) PREPARING INPUTS FOR THE ESTIMATION OF THE MODEL: JLL original . SAMPLE PERIOD: 01-05-2007 - 01-12-2019
#> 1.1) Constructing the time-series of the risk factors
#> 1.2) Estimating model P-dynamics parameters:
#> - Without the bias-correction procedure
#> JLL-based setup in progress: Estimating the variance-covariance matrix numerically.
#> This may take some time.
# }