Main Content

信用额度Simulation Workflow

此示例显示了使用a的常见工作流程信用额度object for a portfolio of counterparty credit ratings.

步骤1。创建一个creditMigrationCopula对象a 4-factor model

加载已保存的投资组合数据。

加载CreditMigrationData.mat.;

Scale the bond prices for portfolio positions for each bond.

MigrationValues =迁移前。* numbonds;

创建一个信用额度object with a 4-factor model using信用额度

CMC = CreditMigrationCopula(迁移值,评级,传输,......LGD,重量,'factorcorlation',factorcorr)
cmc = creditMigrationCopula with properties: Portfolio: [250x5 table] FactorCorrelation: [4x4 double] RatingLabels: [8x1 string] TransitionMatrix: [8x8 double] VaRLevel: 0.9500 UseParallel: 0 PortfolioValues: []

步骤2.将varlevel设置为99%。

设定VarLevelproperty for the信用额度对象99%(默认值为95%)。

cmc.VaRLevel = 0.99;

步骤3.显示Portfolioproperty for information about migration values, ratings, LGDs, and weights.

显示Portfolio属性包含有关迁移值,额定值,LGDS和权重的信息。迁移值中的列与额定值相同,最后一列中的默认评级。

head(cmc.Portfolio)
ans=8×5表ID MigrationValues Rating LGD Weights __ _______________ ______ ______ ___________________________________ 1 [1x8 double] "A" 0.6509 0 0 0 0.5 0.5 2 [1x8 double] "BBB" 0.8283 0 0.55 0 0 0.45 3 [1x8 double] "AA" 0.6041 0 0.7 0 0 0.3 4 [1x8 double] "BB" 0.6509 0 0.55 0 0 0.45 5 [1x8 double] "BBB" 0.4966 0 0 0.75 0 0.25 6 [1x8 double] "BB" 0.8283 0 0 0 0.65 0.35 7 [1x8 double] "BB" 0.6041 0 0 0 0.65 0.35 8 [1x8 double] "BB" 0.4873 0.5 0 0 0 0.5

步骤4.显示交易对手的迁移值。

例如,您可以显示第一个交易对手的迁移值。请注意,默认值高于某些非默认额定值。这是因为默认评级的迁移值是乘以仿真过程中乘以恢复速率的参考值(例如,当前额定值,转发值,或其他),以获取事件中资产的值默认值。回收率是1-LGD.当。。。的时候LGD.输入到信用额度是一个常数LGD.价值(备LGD.input has one column). The recovery rate is a random quantity when theLGD.输入到信用额度被指定为β发行版的平均值和标准偏差(LGD.输入有两列)。

bar(cmc.Portfolio.MigrationValues(1,:)) xticklabels(cmc.RatingLabels) title('第一家公司的迁移价值'

步骤5.运行模拟。

使用模拟函数模拟100,000场景。

cmc = simulate(cmc,1e5)
cmc = creditMigrationCopula with properties: Portfolio: [250x5 table] FactorCorrelation: [4x4 double] RatingLabels: [8x1 string] TransitionMatrix: [8x8 double] VaRLevel: 0.9900 UseParallel: 0 PortfolioValues: [1x100000 double]

步骤6.为投资组合风险生成报告。

使用portfoliorisk.function to obtain a report for risk measures and confidence intervals forelSTD.var.那andCVaR

[portRisk,RiskConfidenceInterval] = portfolioRisk(cmc)
Portrack =.1×4表EL STD VAR CVAR ______ _____ ___________ 4515.9 12963 57176 83975
RiskConfidenceInterval=1×4表EL STD VAR CVAR ________________ ______________ ______________ ______________ 4435.6 4596.3 12907 58541 52137 58541 82137 85812

Step 7. Visualize the distribution.

View a histogram of the portfolio values.

图H =直方图(CMC.Portfoliovalues,125);标题('Distribution of Portfolio Values');

Step 8. Overlay the value if all counterparties maintain current credit ratings.

覆盖portfolio对象的值(cmc)如果所有的交易对手都保持其当前的信用评级。

CurrentRatingValue = portRisk.EL + mean(cmc.PortfolioValues); holdonplot([CurrentRatingValue CurrentRatingValue],[0 max(h.Values)],'行宽',2);格on

Step 9. Generate a risk contributions report.

使用riskContributionfunction to display the risk contribution. The risk contributions,elandCVaR那are additive. If you sum each of these two metrics over all the counterparties, you get the values reported for the entire portfolio in theportfoliorisk.T.able.

RC =风险协调(CMC);DISP(RC(1:10,:))
ID EL标准的VaR CVaR的__ ______ ______ 1 15.521 41.153 238.72 279.18 2 8.49 18.838 92.074 122.19 3 6.0937 20.069 113.22 181.53 4 6.6964 55.885 272.23 313.25 5 23.583 73.905 360.32 573.39 6 10.722 114.97 445.94 728.38 7 1.8393 84.754 262.32 490.39 8 11.711 39.768 175.84 253.299 2.2154 4.4038 22.797 31.039 10 1.7453 2.5545 9.8801 17.603

Step 10. Simulate the risk exposure with a t copula.

用A.T.copula with 10 degrees of freedom, use the模拟function with optional input arguments. Save the results to a new信用额度对象(CMCT.)。

CMCT.= simulate(cmc,1e5,'Copula''T''自由程度',10)
CMCT = CreditMigrationCopula具有属性:投资组合:[250x5表]因子相关性:[4x4 Double] ratingLabes:[8x1 String] TransitionMatrix:[8x8 Double] varlevel:0.9900使用平行:0 portfoliovalues:[1x100000双]

Step 11. Generate a report for the portfolio risk for the t copula.

使用portfoliorisk.function to obtain a report for risk measures and confidence intervals forelSTD.var.那andCVaR

[portRisk2,RiskConfidenceInterval2] = portfolioRisk(cmct)
portRisk2=1×4表el std var cvar ____ _____ _____ __________ 4544 17034 72270 1.2391E + 05
Riskconfiencesinterval2 =1×4表EL标准的VaR CVaR的________________ ______________ ______________ ________________________ 4438.5 4649.6 16960 17109 69769 75382 1.1991e + 05 1.2791e + 05

Step 12. Visualize the distribution for the t copula.

View a histogram of the portfolio values.

图H =直方图(CMCT.Portfoliovalues,125);标题('Distribution of Portfolio Values for t Copula');

步骤13.如果所有对应对方维持T Copula的当前信用评级,则叠加该值。

覆盖portfolio对象的值(CMCT.)如果所有的交易对手都保持其当前的信用评级。

currentratingvalue2 = portrisk2.el +均值(cmct.portfoliovalues);保持on绘图([CurrentRatingValue2 CurrentRatingValue2],[0 max(H.Values)],'行宽',2);格on

也可以看看

||||||

相关例子

更多关于