Example 1: BRISMA Risk Model Pipeline

This walkthrough demonstrates the complete BRISMA risk modeling workflow in 17 steps.

Source: brisma/R/examples/example1.R

Outputs: Q_emp (empirical), Q_shrink (shrinkage-adjusted), Q_garch (forecasted) covariance matrices

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

Phase 1: Data Loading & Preparation

1
Load Data from Excel
[expand]

Load all data sheets from the Excel file: client portfolio, risk model, index data, and FX rates. Filter to working days only (Monday-Friday).

2
Create Mapping Tables
[expand]

Build ID-to-currency and ID-to-name lookup tables for consistent referencing across portfolio and risk model data.

3
Set Base Currency
[expand]

Define the base currency (EUR) and identify the cash index for excess return calculations.

4
Currency Conversion
[expand]

Convert all indices to base currency EUR and calculate excess returns over the cash index. Also convert Trade-Weighted Index (TWI) data.

5
Prepare Time Series
[expand]

Combine time series, determine date ranges (10-year lookback), and filter portfolio/risk model IDs based on data availability.

Phase 2: Covariance Estimation

6
Create Index Matrix & Calculate Returns
[expand]

Build the date x ID index matrix, compute log returns, and calculate 22-day rolling returns for covariance estimation.

7
Iterative Covariance Estimation
[expand]

Core algorithm: Iteratively estimate covariance with GARCH-based time-decay weights. Uses eigenvalue decomposition to create orthogonal risk factors.

8
Plot Weights & Risk Factors
[expand]

Visualize the converged time-decay weights and the first 5 principal risk factors.

9
Plot Empirical Volatilities
[expand]

Display annualized volatility for each portfolio asset from the empirical covariance matrix.

Phase 3: Factor Model & GARCH

10
Factor Model Estimation
[expand]

Estimate the factor model with beta decomposition. Select components explaining 95% of variance and compute shrinkage-adjusted covariance.

11
GARCH Modeling
[expand]

Fit GARCH(1,1) models to residuals and components for forward-looking volatility forecasts.

12
Plot Component Volatilities
[expand]

Visualize GARCH-forecasted volatilities for each risk model component.

13
Calculate GARCH Covariance
[expand]

Construct the forward-looking GARCH covariance matrix using forecasted component and residual volatilities.

14
Plot GARCH Volatilities
[expand]

Display GARCH-forecasted annualized volatility for each portfolio asset.

Phase 4: Final Output

15
Extract Portfolio Covariance Matrices
[expand]

Extract the three final covariance matrices for portfolio assets: empirical, shrinkage-adjusted, and GARCH-forecasted.

16
Plot Volatility Comparisons
[expand]

Compare volatilities across the three estimation methods using scatter plots.

17
Print Final Correlation Matrices
[expand]

Output the correlation matrices (subset) for validation and comparison.

Summary: Three Covariance Matrices

Q_port_emp: Historical empirical covariance from weighted returns

Q_port_shrink: Shrinkage-adjusted using factor model decomposition

Q_port_garch: Forward-looking GARCH(1,1) forecasted covariance