This code computes the Component Expected Shortfall (CES) risk measure both in-sample and out-of-sample for each financial institution in the system. The in-sample measure corresponds to fixed calendar dates, whereas the out-of-sample one looks at the 6-month period preceding that particular day. The date of interest should be changed manually. The evolution of CES over the part of the sample under analysis (in the paper this is from 2007 on) can also be calculated for a given asset. As a byproduct, the codes also compute the Marginal Expected Shortfall (MES). To obtain the in-sample results run the file RUN_var.m, for the out-of-sample ones, run the file RUN_main_oos.m, and for a specific asset run RUN_main_i.m . Note also that the dataset (data_set.mat) should include the firm returns at each date (returnsL matrix) as well as the weight of each institution in the financial system for the period under analysis, e.g. from 2007 (weights matrix).
Working Paper (2016)
Pekkala Tapio and Doskov Nikolay