Perform the optimization of the log-likelihood function of the chosen ATSM
Source:R/Optimization.R
Optimization.Rd
Perform the optimization of the log-likelihood function of the chosen ATSM
Usage
Optimization(
MLEinputs,
StatQ,
DataFreq,
FactorLabels,
Economies,
ModelType,
tol = 1e-04,
TimeCount = TRUE,
BS_outputs = FALSE,
verbose = TRUE
)
Arguments
- MLEinputs
A list containing the necessary inputs for building the log-likelihood function (see
InputsForOpt
function).- StatQ
A binary variable (1 or 0) indicating whether to impose that the largest eigenvalue under Q is strictly smaller than 1. Set to 1 to impose the restriction, or 0 otherwise.
- DataFreq
A character vector specifying the data frequency. Available options: "Daily All Days", "Daily Business Days", "Weekly", "Monthly", "Quarterly", "Annually".
- 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.
- ModelType
A character vector indicating the model type to be estimated.
- tol
Convergence tolerance (scalar). The default is 1e-4.
- TimeCount
Logical. If TRUE, computes the time required for model estimation. Default is TRUE.
- BS_outputs
Logical. If TRUE, generates a simplified output list in the bootstrap setting. Default is FALSE.
- verbose
Logical flag controlling function messaging. Default is TRUE.
Value
An object of class 'ATSMModelOutputs' containing model outputs after the optimization of the chosen ATSM specification.
References
This function is partially adapted from the LS__opt
function by Le and Singleton (2018).
"A Small Package of Matlab Routines for the Estimation of Some Term Structure Models."
(Euro Area Business Cycle Network Training School - Term Structure Modelling).
Available at: https://cepr.org/40029
Examples
LoadData("CM_2024")
ModelType <- "JPS original"
Economy <- "Brazil"
t0 <- "01-05-2007" # Initial Sample Date (Format: "dd-mm-yyyy")
tF <- "01-12-2018" # Final Sample Date (Format: "dd-mm-yyyy")
N <- 1
GlobalVar <- "Gl_Eco_Act" # Global Variables
DomVar <- "Eco_Act" # Domestic Variables
DataFreq <- "Monthly"
StatQ <- 0
FacLab <- LabFac(N, DomVar, GlobalVar, Economy, ModelType)
ATSMInputs <- InputsForOpt(t0, tF, ModelType, Yields, GlobalMacroVar, DomesticMacroVar,
FacLab, Economy, 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
OptPara <- Optimization(ATSMInputs, StatQ, DataFreq, FacLab, Economy, ModelType)
#> 2) ATSM ESTIMATION : POINT ESTIMATE ANALYSIS
#> 2.1) Estimating ATSM ...
#> ... for country: Brazil . This may take several minutes.
#> *** Estimation round 1 completed ***
#> *** Estimation round 2 completed ***
#> -- Done!
#> Elapsed time: 2.68 seconds