Learn R Programming

MultiATSM (version 1.3.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

365

Version

1.3.0

License

GPL-2 | GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Rubens Moura

Last Published

March 24th, 2025

Functions in MultiATSM (1.3.0)

BUnspannedAdapSep

Transform B_spanned into B_unspanned for sepQ models
Boot_DataGraphFact_perShock

Generates the desired bootstrap graphs
BUnspannedAdapJoint

Transform B_spanned into B_unspanned for jointQ models
BR_jps_out

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

Build Confidence intervals for yield-related outputs
Boot_DataGraphYield_perShock

Generates the desired bootstrap graphs
Build_xvec

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

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

Builds the confidence bounds and graphs (Bootstrap set)
BuildATSM_RiskFactors

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

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

Build the list of IRF and GIRF for both factors and bond yields
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
Compute_EP

Compute the expected component for all models
ComputeBounds_IRFandGIRF

Compute the confidence bounds from the model's numerical outputs
BuildLinkMat

Build country-specific link matrices
BuildRiskFactors_BS

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

Clean unnecessary outputs of JLL models in the bootstrap setup
CholRestrictionsJLL

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

Compute the confidence bounds around the P-dynamics and bond yields for FEVD and GFEVD
Convert2JordanForm

Convert a generic matrix to its Jordan form
Boot_Yields_Graphs

Build P-dynamic graphs after the bootstrap implementation
BuildGVAR

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

Compute the latent loading AnX and BnX
Bootstrap

Generates the bootstrap-related outputs
CheckInputsForMLE

Check consistence of inputs
Boot_graph_template

Builds template from bootstrap-related graphs
DataSet_BS

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

Get the expected component of all models
FFtemporary

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

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

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

Creates folder to store graphs generated from the bootstrap analysis
EstimationSigma_GVARrest

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

Compute the Feedback matrix of each bootstrap draw
FEVDandGFEVDs_Graphs

Generates graphs for FEVDs and GFEVDs
FEVDandGFEVDgraphs

FEVD and GFEVD graphs for all models
CheckInputsGVAR

Check consistency of the inputs provided in GVARinputs
ComputeIRFs

Compute IRFs of all models
ComputeGIRFs

Compute GIRFs for all models
ForwardPremia

Compute the forward premia for all models
FEVDandGFEVD

FEVDs and GFEVDs for all models
FeedbackMatrixRestrictionsJLL

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

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

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

Gather several forecast dates
ComputeGFEVDs

Compute GFEVDs for all models
ComputeFEVDs

Compute FEVDs for all models
FEVDandGFEVD_BS

FEVDs and GFEVDs after bootstrap for all models
Check_label_consistency

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

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

Compute Sigmas/Cholesky factorizations
Get_Unspanned

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

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

Compute quantiles for model P-dynamics
GetTruePara

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

Performs state rotations
GVAR_PrepFactors

Prepare risk factors for the estimation of the GVAR model
FEVDandGFEVDbs

Creates the confidence bounds and the graphs of FEVDs and GFEVDs after bootstrap (all models)
FolderPrep_IRFs

Create folders for storing IRFs and GIRFs
GetYields_AllCountries

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

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

Obtain the country-specific a0
DatabasePrep

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

Get delta t
FactorBounds_FEVDandGFEVD

Compute the confidence bounds for the model bond P-dynamics-related outputs
DomesticMacroVar

Data: Risk Factors - Candelon and Moura (2024, JFEC)
GVAR

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

Generates the labels factors
NumOutputs

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

Generates forecasts of bond yields for all model types
IdxSpanned

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

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

Impose stationarity under the Q-measure
Functionf_vectorized

Use function f to generate the outputs from a ATSM
FactorsGVAR

Data: Risk Factors for the GVAR - Candelon and Moura (2024, JFEC)
GlobalMacro

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

Compute the A loadings
Get_BFull

Compute the B matrix of loadings
NumOutputs_Bootstrap

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

Create folders for storing IRFs and GIRFs
GetLabels_JLL

Generate the variable labels of the JLL models
IDXZeroRestrictionsJLLVarCovOrtho

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

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

Map constrained parameters b to unconstrained auxiliary parameters a.
GlobalMacroVar

Data: Risk Factors - Candelon and Moura (2024, JFEC)
Get_SigmaYields

Compute the variance-covariance matrix of the bond yields
RemoveNA

Exclude series that contain NAs
TermPremia

Compute the term premia
Fit_Subplot

Build subplot for fitted yields
Fitgraphs

Model fit graphs for all models
Reg__OLSconstrained

Restricted OLS regression
Factors_NonOrtho

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

IRFs and GIRFs for all models
Gen_Forecast_Yields

Compute the bond yield forecast for any model type
ImposeStat_Aux

Impose stationary constraint under the risk-neutral measure
IRFandGIRFgraphs

IRF and GIRF graphs for all models
LoadData

Loads data sets from several papers
ImposeStat_True

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

Compute the confidence bounds for the model P-dynamics
GraphicalOutputs

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

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

Generate the factor labels for models estimated on a country-by-country basis
FolderCreationPoint

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

computes the density function of a gaussian process
Gen_Artificial_Series

Generate artificial time-series in the bootstrap setup
OOS_Forecast

Perform out-of-sample forecast of bond yields
Get_Bs

Build the B loadings
Get_G0G1Sigma

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

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

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

Compute the maximum likelihood function of all models
GeneralMLEInputs

Gathers the general inputs for model estimation
GetPdynPara_BC

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

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

Generates inputs necessary to build the likelihood function for the ATSM model
VARX

Estimate a VARX(1,1,1)
TermPremiaDecomp

Decomposition of yields into the average of expected future short-term interest rate and risk premia for all models
Reg_K1Q

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

Generates the star variables necessary for the GVAR estimation
Get_llk

Compute the log-likelihood function
RMSE

Compute the root mean square error for all models
OptOutputs

Prepare outputs to export after the model optimization
Optimization_PE

Peform the minimization of mean(f)
VarianceExplained

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

Fit yields for all maturities of interest
IRFandGIRFs_Format_Yields

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

Term Premia decomposition graphs for all models
True_Jordan

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

Find the indexes of the spanned factors
bound2x

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

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

Data: Yields - Candelon and Moura (2024, JFEC)
df__dx

Computes numerical first order derivative of f(x)
YieldsFit

Computes two measures of model fit for bond yields (all models)
summary.ATSMModelInputs

Summary method for ATSMModelInputs objects
Get_r0

Compute r0 for the various models
sqrtm_robust

Compute the square root of a matrix
InputsForOutputs

Collects the inputs that are used to construct the numerical and the graphical outputs
summary.ATSMModelOutputs

Summary method for ATSMModelOutputs objects
adjust_delta

Adjust delta for numerical differentiation
plot.ATSMModelForecast

Plot method for ATSMModelForecast objects
MultiATSM

ATSM Package
LabelsStar

Generate the labels of the star variables
Optimization_Time

Compute the time elapsed in the numerical optimization
LabelsSpanned

Generate the labels of the spanned factors
NoOrthoVAR_JLL

Obtain the non-orthogonalized model parameters
pos2x

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

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

Create a vector of numerical maturities in years
IRFandGIRFbs

Creates the confidence bounds and the graphs of IRFs and GIRFs after bootstrap
IRFandGIRF_BS

IRFs and GIRFs after bootstrap for all models
Spanned_Factors

Computes the country-specific spanned factors
Optimization

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

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

Optimization routine for the entire selected ATSM
ParaLabelsOpt

Create the variable labels used in the estimation
OrthoReg_JLL

Get coefficients from the orthogonalized regressions
ModelPara

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

Update the list of parameters
Outputs2exportMLE

Prepares inputs to export
TradeFlows

Data: Trade Flows - Candelon and Moura (2024, JFEC)
TimeVarWeights_GVAR

Compute the star variables with time-varying weights
Wished_Graphs_FEVDandGFEVD

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

Transformation of a PSD matrix (true form)
True_BoundDiag

Transformation of the bounded parameters (True form)
SpecificMLEInputs

Concatenate the model-specific inputs in a list
ResampleResiduals_BS

Compute the residuals from the original model
PdynResid_BS

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

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

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

Transformation of the block diagonal parameters (true form)
Jordan_JLL

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

Data: Risk Factors - Candelon and Moura (2024, JFEC)
Update_SSZ_JLL

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

Estimates the P-dynamics from JLL-based models
VAR

Estimates a standard VAR(1)
Trade_Flows

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

Compute the confidence bounds for the model bond yield-related outputs
Y_Fit

Model-implied yields (cross-section)
Wished_Graphs_IRFandGIRF

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

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

Print method for ATSMModelInputs objects
YieldBounds_IRFandGIRF

Compute the confidence bounds for the model bond yield-related outputs
m_var

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

Generate M data sets from VAR(1) model
Y_ModImp

Model-implied yields (P-dynamics)
x2pos

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

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

Compute risk-neutral intercept and slope
shrink_Phi

Killan's VAR stationarity adjustment
residY_original

Compute the residuals from the observational equation
MarginalModelPara

Estimate the marginal model for the global factors
pca_weights_one_country

Computes the PCA weights for a single country
YieldQuantile_bs

Compute quantiles for model bond yield-related outputs
RiskFactorsPrep

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

Compile the bond yield forecast for any model type
mult__prod

Efficient computation of matrix product for arrays
OutputConstruction

Numerical outputs (variance explained, model fit, IRFs, GIRFs, FEVDs, GFEVDs, and risk premia decomposition) for all models
Out

Complete list of several outputs from an ATSM
MatAdjusted

Adjust vector of maturities
RiskFactorsGraphs

Spanned and unspanned factors plot
WishGraphs_IRFandGIRF_Boot

Extract graphs of interest (bootstrap version)
WishGraphs_FEVDandGFEVD_Boot

Extract graphs of interest (bootstrap version)
AdjustPathFEVDs

Generate paths to save IRFs/GIRFs graphs
AdjustOptm_BS

Gathers the estimate of the bootstrap draws
A0N__BnAn

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

Build P-dynamic graphs after the bootstrap implementation
Aux_PSD

Transformation of a PSD matrix (auxiliary form)
AdjustPathIRFs

Generate paths to save IRFs/GIRFs graphs
Aux_BoundDiag

Transformation of the bounded parameters (auxiliary form)
AdjustYieldsDates

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

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

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

Adjust the constant label
Aux_BlockDiag

Transformation of the block diagonal parameters (auxiliary form)
BUnspannedAdapSep_BS

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

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