Unlimited learning, half price | 50% off
Get 50% off unlimited learning

⚠️There's a newer version (1.3.1) of this package.Take me there.

MultiATSM (version 1.1.0)

Multicountry Term Structure of Interest Rates Models

Description

Estimation routines for several classes of affine term structure of interest rates models. All the models are based on the single-country unspanned macroeconomic risk framework from Joslin, Priebsch, and Singleton (2014, JF) . Multicountry extensions such as the ones of Jotikasthira, Le, and Lundblad (2015, JFE) , Candelon and Moura (2023, EM) , and Candelon and Moura (Forthcoming, JFEC) are also available.

Copy Link

Version

Install

install.packages('MultiATSM')

Monthly Downloads

324

Version

1.1.0

License

GPL-2 | GPL-3

Maintainer

Rubens Moura

Last Published

December 16th, 2024

Functions in MultiATSM (1.1.0)

Bias_Correc_VAR

Estimates an unbiased VAR(1) using stochastic approximation (Bauer, Rudebusch and Wu, 2012)
BUnspannedAdapJoint

Transform B_spanned into B_unspanned for jointQ models
BUnspannedAdapSep

Transform B_spanned into B_unspanned for sepQ models
BR_jps_out

Replications of the JPS (2014) outputs by Bauer and Rudebusch (2017)
Bootstrap

Generates the bootstrap-related outputs
CheckJLLinputs

Check consistency of the inputs provided in JLL-based models
BuildGVAR

Build the GVAR(1) from the country-specific VARX(1,1,1)
Check_comparison__OLS

check whether mean/median of OLS is close to actual OLS estimates
DataForEstimation

Retrieves data from Excel and build the database used in the model estimation
DataSet_BS

Prepare the factor set for GVAR models (Bootstrap version)
CheckInputsGVAR

Check consistency of the inputs provided in GVARinputs
BuildRiskFactors_BS

Build the time-series of the risk factors in each bootstrap draw
BUnspannedAdapSep_BS

Obtain the full form of B unspanned for "sep Q" models within the bootstrap setting
CheckInputsForMLE

Check consistence of inputs
BuildLinkMat

Build country-specific link matrices
BuildIRFlist

Build the list of IRF and GIRF for both factors and bond yields
BuildYields_BS

Build the time-series of bond yields for each bootstrap draw
Compute_BnX_AnX

Compute the latent loading AnX and BnX
FEVDandGFEVDbs_jointQ_Ortho

Creates the confidence bounds and the graphs of FEVDs and GFEVDs after bootstrap (JLL-based models)
Build_xvec

Obtain the auxiliary values corresponding to each parameter, its size and its name
Convert2JordanForm

Convert a generic matrix to its Jordan form
FEVDandGFEVDbs_sepQ

Creates the confidence bounds and the graphs of FEVDs and GFEVDs after bootstrap ("sep Q" models)
DatabasePrep

Gather data of several countries in a list. Particularly useful for GVAR-based setups (Compute "GVARFactors")
ComputeIRFs

Compute IRFs of all models
FEVDgraphsJLLOrtho

FEVDs graphs for orthogonalized risk factors of JLL-based models
Check_label_consistency

Check consistency of labels (economies, domestic and global variables)
FEVDgraphsSep

FEVDs graphs for ("sep Q" models)
ComputeGIRFs

Compute GIRFs for all models
FEVDjoint

FEVDs for "joint Q" models
DomMacro

Data: Risk Factors for the GVAR - Candelon and Moura (2023)
GVAR

Estimates a GVAR(1) and a VARX(1,1,1) models
GFEVDsep_BS

GFEVDs after bootstrap for "sep Q" models
FFtemporary

Mean of the llk function used in the estimation of the selected ATSM
ChecksOOS

Preliminary checks for inputs provided for the performing out-of-sample forecasting
EstimationSigma_GVARrest

Estimate numerically the variance-covariance matrix from the GVAR-based models
FEVDgraphsJoint

FEVDs graphs for ("joint Q" models)
FMN__Rotate

Performs state rotations
DomesticMacroVar

Data: Risk Factors - Candelon and Moura (forthcoming, JFEC)
FactorsGVAR

Data: Risk Factors for the GVAR - Candelon and Moura (forthcoming, JFEC)
ForecastYields

Generates forecasts of bond yields for all model types
FolderPrep_IRFs

Create folders for storing IRFs and GIRFs
Functionf

Set up the vector-valued objective function (Point estimate)
FEVDsep_BS

FEVDs after bootstrap for "sep Q" models
CholRestrictionsJLL

Impose the zero-restrictions on the Cholesky-factorization from JLL-based models.
Factors_NonOrtho

Makes the pre-allocation of the factors set for JLL-based models
GetLabels_sepQ

Generate the factor labels for models estimated on a country-by-country bases
FEVDjoint_BS

FEVDs after bootstrap for "joint Q" models
FF

mean of the llk function used in the estimation of the selected ATSM
Functionf_vectorized

Use function f to generate the outputs from a ATSM
GFEVDgraphsJoint

GFEVDs graphs for "joint Q" models
GFEVDjointOrthoJLL_BS

GFEVDs after bootstrap for JLL-based models
FeedbackMatrixRestrictionsJLL

Set the zero-restrictions on the feedback matrix of JLL's P-dynamics
GFEVDgraphsJLLOrtho

GFEVDs graphs for orthogonalized risk factors of JLL-based models
EstimationSigma_Ye

Estimate numerically the Cholesky-factorization from the JLL-based models
CleanOrthoJLL_Boot

Clean unnecessary outputs of JLL models in the bootstrap setup
FEVDsep

FEVDs for "sep Q" models
FeedbackMat_BS

Compute the Feedback matrix of each bootstrap draw
GFEVDjointOrthoJLL

Orthogonalized GFEVDs for JLL models
Gen_Forecast_Yields

compute the bond yield forecast for any model type
GetPdynPara_BC

Compute P-dynamics parameters using the bias correction method from BRW (2012)
FolderCreationBoot

Creates the folders and the path in which the graphical outputs are stored (Bootstrap version)
GetPdynPara_NoBC

Compute P-dynamics parameters without using the bias correction method from BRW (2012)
GFEVDgraphsSep

GFEVDs graphs for ("sep Q" models)
GetAuxPara

Map constrained parameters b to unconstrained auxiliary parameters a.
FolderCreationPoint

Creates the folders and the path in which the graphical outputs are stored (point estimate version)
GFEVDjoint

GFEVDs for "joint Q" models
GetTruePara

Map auxiliary (unconstrained) parameters a to constrained parameters b
GetYields_AllCountries

Gather all country-specific yields in a single matrix of dimension CJ x T
Gather_Forecasts

Gather several forecast dates
GVAR_PrepFactors

Prepare risk factors for the estimation of the GVAR model
Get_SigmaYields

Compute the variance-covariance matrix of the bond yields
Get_Unspanned

Collect both the domestic and global unspanned factors of all countries in single matrices
GetLabels_JLL

Generate the variable labels of the JLL models
FEVDandGFEVDbs_jointQ

Creates the confidence bounds and the graphs of FEVDs and GFEVDs after bootstrap ("joint Q" models)
Get_G0G1Sigma

Get the intercept, feedback matrix and the variance-covariance matrix from GVAR without global factors
Get_Bs

BUild the B loadings
IRFandGIRFgraphs

IRFs graphs for all models
FEVDjointOrthogoJLL

Orthogonalized FEVDs for JLL models
Get_As

Compute the A loadings
IRFandGIRFs_Format_Fac

Gather data for IRFs and GIRFs grahs (version "Factors")
GetPdynPara

Compute the parameters used in the P-dynamics of the model
FEVDjointOrthogoJLL_BS

FEVDs after bootstrap for JLL-based models
GeneralMLEInputs

Gathers the general inputs for model estimation
Get_BFull

Compute the B matrix of loadings
Fitgraphs

Model fit graphs for ("sep Q" models)
IdxSpanned

Extract the indexes related to the spanned factors in the variance-covariance matrix
Fit_Subplot

Build subplot for fitted yields
Idx_UnspanFact

Obtain the indexes of both the domestic and global unspanned factors
GFEVDsep

GFEVDs for "sep Q" models
GFEVDjoint_BS

GFEVDs after bootstrap for "joint Q" models
MultiATSM

ATSM Package
GlobalMacroVar

Data: Risk Factors - Candelon and Moura (forthcoming, JFEC)
Get_V_tilde_BC

Compute the variance-covariance matrix after the bias correction procedure
Get_llk

Compute the log-likelihood function
Get_r0

Compute r0 for the various models
GaussianDensity

computes the density function of a gaussian process
ModelPara

Replications of the JPS (2014) outputs by the MultiATSM package
JLL

Estimates the P-dynamics from JLL-based models
Gen_Artificial_Series

Generate artificial time-series in the bootstrap setup
Get_Gy1

Compute the feedback matrix from a GVAR model with global factors
GraphicalOutputs

Generate the graphical outputs for the selected models (Point estimate)
IRFandGIRFs_Format_Yields

Gather data for IRFs and GIRFs grahs (version "Yields")
Get_a0

Obtain the country-specific a0
Get_Sigama_JLL

Compute Sigmas/Cholesky factorizations
IRFandGIRF

IRFs and GIRFs for all models
IDXZeroRestrictionsJLLVarCovOrtho

Find the indexes of zero-restrictions from the orthogonalized variance-covariance matrix from the JLL-based models
InputsForOpt

Generates several inputs that are necessary to build the likelihood function
IRFandGIRF_BS

IRFs and GIRFs after bootstrap for all models
IRFandGIRFbs_jointQ

Creates the confidence bounds and the graphs of IRFs and GIRFs after bootstrap ("joint Q" models)
IdxAllSpanned

Find the indexes of the spanned factors
Getdt

Get delta t
Jordan_JLL

Check for JLL models for Jordan restrictions (auxiliary form)
GlobalMacro

Data: Risk Factors - Candelon and Moura (2023)
InputsForOutputs

Collects the inputs that are used to construct the numerical and the graphical outputs
LabelsSpanned

Generate the labels of the spanned factors
RMSEjoint

Compute the root mean square error ("joint Q" models)
LabelsStar

Generate the labels of the star variables
OrthoReg_JLL

Get coefficients from the orthogonalized regressions
OutputConstructionJoint

Numerical outputs (variance explained, model fit, IRFs, GIRFs, FEVDs, GFEVDs and risk premia decomposition) for "joint Q" models
OutputConstructionSep_BS

Gathers all the model numerical ouputs after bootstrap for "sep Q" models
OutputConstructionJoint_BS

Gathers all the model numerical ouputs after bootstrap for "joint Q" models
OutputConstructionSep

Numerical outputs (variance explained, model fit, IRFs, GIRFs, FEVDs, GFEVDs, and risk premia decomposition) for "sep Q" models
RMSEsep

Compute the root mean square error ("sep Q" models)
OrthoVAR_JLL

VAR(1) with orthogonalized factors (JLL models)
SpannedFactorsSepQ

Gather all spanned factors ("sep Q" models)
NoOrthoVAR_JLL

Obtain the non-orthogonalized model parameters
NumOutputs

Constructs the model numerical outputs (model fit, IRFs, GIRFs, FEVDs, GFEVDs, and risk premia decomposition)
NumOutputs_Bootstrap

Numerical outputs (IRFs, GIRFs, FEVD, and GFEVD) for bootstrap
SpannedFactorsjointQ

Gather all spanned factors ("joint Q" models)
True_BlockDiag

Transformation of the block diagonal parameters (true form)
ResampleResiduals_BS

Compute the residuals from the original model
IRFandGIRFbs_jointQ_Ortho

Creates the confidence bounds and the graphs of IRFs and GIRFs after bootstrap (JLL-based models)
LabFac

Generates the labels factors
Maturities

Create a vector of numerical maturities in years
K1XQStationary

Impose stationarity under the Q-measure
OOS_Forecast

Perform out-of-sample forecast of bond yields
True_BoundDiag

Transformation of the bounded parameters (True form)
MarginalModelPara

Estimate the marginal model for the global factors
TPDecompGraphSep

Term Premia decomposition graphs for "joint Q" models
Spanned_Factors

Computes the country-specific spanned factors
RiskFactors

Data: Risk Factors - Candelon and Moura (forthcoming, JFEC)
SpecificMLEInputs

Concatenate the model-specific inputs in a list
bound2x

Transform a number bounded between a lower bound and upper bound to x by:
contain

Check whether one element is a subset of another element
IRFandGIRFbs_sepQ

Creates the confidence bounds and the graphs of IRFs and GIRFs after bootstrap ("sep Q" models)
OptOutputs

Prepare outputs to export after the model optimization
Optimization

Perform the optimization of the log-likelihood function of the chosen ATSM
PdynResid_BS

Compute some key parameters from the P-dynamics (Bootstrap set)
logdet

computes the logarithm of determinant of a matrix A
llk_JLL_Sigma

Build the log-likelihood function of the P-dynamics from the JLL-based models
TermPremiaDecompJoint

Decomposition of yields into the average of expected future short-term interest rate and risk premia for "joint Q" models
ParaLabelsOpt

Create the variable labels used in the estimation
Reg_K1Q

Estimate the risk-neutral feedbak matrix K1Q using linear regressions
ImposeStat_Aux

Impose stationary constraint under the risk-neutral measure
x2bound

Transform x to a number bounded btw lb and ub by:
Reg__OLSconstrained

Restricted OLS regression
x2pos

Transform x to a positive number by: y = log(e^x + 1)
StarFactors

Generates the star variables necessary for the GVAR estimation
Wished_Graphs_IRFandGIRF

Extract list of desired graph features (IRFs anc GIRFs)
TPDecompGraphJoint

Term Premia decomposition graphs for "joint Q" models
RiskFactorsGraphs

Spanned and unspanned factors plot
True_JLLstruct

Transformation of the JLL-related parameters (true form)
ImposeStat_True

Makes sure that the stationary constraint under the risk-neutral measure is preserved
TermPremiaDecompSep

Decomposition of yields into the average of expected future short-term interest rate and risk premia for "joint Q" models
VARX

Estimate a VARX(1,1,1)
RiskFactorsPrep

Builds the complete set of time series of the risk factors (spanned and unspanned)
TradeFlows

Data: Trade Flows - Candelon and Moura (forthcoming, JFEC)
RemoveNA

Exclude series that contain NAs
Y_Fit

Model-implied yields (cross-section)
True_Jordan

Transformation of the Jordan-related parameters (True form)
Remove_at

Eliminates the @
VarianceExplained

Percentage explained by the spanned factors of the variations in the set of observed yields for all models
MLEdensity

Compute the maximum likelihood function of all models
LoadData

Loads data sets from several papers
YieldFor

Compile the bond yield forecast for any model type
Y_ModImp

Model-implied yields (P-dynamics)
Update_ParaList

converts the vectorized auxiliary parameter vector x to the parameters that go directly into the likelihood function.
mult__prod

Efficient computation of matrix product for arrays
OptimizationSetup_ATSM

Optimization routine for the entire selected ATSM
True_PSD

Transformation of a PSD matrix (true form)
Optimization_PE

Peform the minimization of mean(f)
Outputs2exportMLE

Prepares inputs to export
m_var

Find mean or median of OLS when DGP is VAR(1)
ParaATSM_opt_ALL

Update the list of parameters
pos2x

Transform a positive number y to back to x by:
mult_inv_large

Inverse each 2D slice of an array (M) with arbitrary dimensions support
YieldsFitAllSep

Fit yields for all maturities of interest
mult__inv

Inverts an array of matrices so that: inva[,,i] = inv(a[,,i])
YieldsFitAllJoint

Fit yields for all maturities of interest
pca_weights_one_country

Weight matrix from principal components
multiprod_2terms

computes matrix product for arrays a and b: c[,,i] = a[,,i] b[,,i]
residY_original

Compute the residuals from the observational equation
Transition_Matrix

Computes the transition matrix required in the estimation of the GVAR model
Trade_Flows

Data: Trade Flows - Candelon and Moura (2023)
Update_SSZ_JLL

Update the variance-covariance matrix from the "JLL joint Sigma" model. Necessary for optimization
VAR

Estimates a standard VAR(1)
YieldsFit

Computes two measures of model fit for bond yields (all models)
Yields

Data: Yields - Candelon and Moura (forthcoming, JFEC)
estVARbrw

Estimate a VAR(1) - suited to Bauer, Rudebusch and Wu (2012) methodology
df__dx

Computes numerical first order derivative of f(x)
sqrtm_robust

Compute the square root of a matrix
getpara

Extract the parameter values from the parameter list set
shrink_Phi

Killan's VAR stationarity adjustment
genVARbrw

Generate M data sets from VAR(1) model
mult_inv_small

Inverse the (m,m,T) array of matrices for m<=4
mult_logabsdet

Inverse each 2D slice of an array (M) with arbitrary dimensions support
Aux_BoundDiag

Transformation of the bounded parameters (auxiliary form)
Aux_JLLstruct

Transformation of the JLL-related parameters (auxiliary form)
Adjust_Const_Type

Adjust the constant label
Aux_BlockDiag

Transformation of the block diagonal parameters (auxiliary form)
A0N__BnAn

Compute the cross-section loadings of yields of a canonical A0_N model
BootstrapBoundsSet

Builds the confidence bounds and graphs (Bootstrap set)
AdjustOptm_BS

Gathers the estimate of the bootstrap draws
AdjustPathIRFs

Generate paths to save IRFs/GIRFs graphs
AdjustYieldsDates

Makes sure that the time series of yields and risk factors have coincident sample spans
BuildATSM_RiskFactors

Builds the time series of the risk factors that are used in the estimation of the ATSM
Aux_Jordan

Transformation of the Jordan-related parameters (auxiliary form)
Aux_PSD

Transformation of a PSD matrix (auxiliary form)