ECM Procedure

Example 18.1 Developing an Economic Capital Model

This example illustrates all the steps of developing an economic capital model by using SAS Econometrics procedures, including the ECM procedure. The section Overview: ECM Procedure describes the process in detail. Following is a quick summary of all the steps in the process:

  1. Collect and prepare data.

  2. For each line of business (LoB), do the following:

    1. Fit and select the best frequency model for the number of loss events in a particular time period.

    2. Fit and select the best severity model for the magnitude of each loss.

    3. Estimate a compound distribution model (CDM) by combining the best frequency and severity models to create a large sample of the aggregate loss.

  3. Estimate a dependency structure among the losses of the LoBs by fitting and selecting the best copula model.

  4. Use the best copula model to simulate a large sample of probabilities of loss values that are observed in all LoBs in the same time period.

  5. Estimate an economic capital model by combining the copula simulation sample with the aggregate loss samples of all LoBs.

The following subsections illustrate in detail each of these steps by developing a simple ECM for a bank’s operational risk.

Data Preparation

Consider that you are a bank and, as part of creating an economic capital model for your operational risk, you want to analyze losses in two LoBs: retail banking and commercial banking. In addition to collecting the loss frequency and loss severity data for each LoB, you should also collect data about the key risk indicators (KRIs), which are the external factors that you believe might affect the frequency and severity of losses in at least one LOB. Let CorpKRI1, CorpKRI2, CbKRI1, CbKRI2, CbKRI3, RbKRI1, RbKRI2, and RbKRI3 be the available KRIs, where the prefix Corp indicates corporate-level KRIs, the prefix Cb indicates KRIs specific to commercial banking, and the prefix Rb indicates KRIs specific to retail banking. Some examples of corporate-level KRIs are the ratio of temporary employees to permanent employees and the number of security breaches that are reported during a year. Some examples of commercial banking KRIs are the number of credit defaults, the proportion of financed assets that are movable, and the penalty claims against your bank that can result from processing delays. Some examples of retail banking KRIs are the number of credit cards that are reported stolen, the fraction of employees who have not undergone fraud detection training, and the number of forged drafts and checks that are presented in a year. To mimic the real-world applications, let different yet overlapping sets of KRIs be used for the frequency and severity models. Let the analysis period be one month, and let the data preparation process result in the following data tables:

  • The Work.OpRiskLossCounts data table contains the frequency regressors and the variable NumLoss, which records the number of losses that an LoB incurs in a month. The LoBs are identified by the BY variable Line.

  • The Work.OpRiskLosses data table contains the severity regressors and the variable LossValue, which records the severity of each loss. The LoBs are identified by the BY variable Line.

  • The Work.OpRiskMatchedLosses data table contains the aggregate losses of all LoBs, where the losses in each LoB are aggregated by month. These matched losses are needed for copula modeling.

The following DATA steps prepare the preceding three data tables:

/*** Simulate loss counts data ***/
data OpRiskLossCounts(keep=line corpKRI1 corpKRI2
                     cbKRI1 cbKRI2 cbKRI3 rbKRI1 rbKRI2 numloss);
   call streaminit(12345);
   array cx{8} corpKRI1 corpKRI2 cbKRI1 cbKRI2 cbKRI3 rbKRI1 rbKRI2 cb23;
   array cbetaR{9} _TEMPORARY_ (0.1 1 -0.5 0 0 0 0.5 0.75 0);
   array cbetaC{9} _TEMPORARY_ (0.5 0.75 0.3 -0.25 0.25 0.5 0 0 0.3);

   alpha = 0.35; theta = 1/alpha;
   call streaminit(12345);
   do obs=1 to 1000;
      do i=1 to dim(cx)-1;
         cx(i) = rand('NORMAL');
      end;
      cb23 = cx(4) * cx(5);

      line = 'CommercialBanking';
      xbeta = cbetaC(1);
      do i=1 to dim(cx);
         xbeta = xbeta + cx(i) * cbetaC(i+1);
      end;
      Mu = exp(xbeta); p = theta/(Mu+theta);
      numloss = rand('NEGB',p,theta);
      output;

      line = 'RetailBanking';
      xbeta = cbetaR(1);
      do i=1 to dim(cx);
         xbeta = xbeta + cx(i) * cbetaR(i+1);
      end;
      lambda = exp(xbeta);
      numloss = rand('POISSON', lambda);
      output;
   end;
run;

/*** Simulate severity of losses and matched loss data ***/
data OpRiskLosses(keep=line corpKRI1 corpKRI2 cbKRI2 rbKRI1 rbKRI3 lossValue)
     OpRiskMatchedLosses(keep=CB RB);
   array sx{6} corpKRI1 corpKRI2 cbKRI2 rbKRI1 rbKRI3 corp1rb3;
   array sbetaC{7} _TEMPORARY_ (5 1 0 0.3 0 0 0);
   array sbetaR{7} _TEMPORARY_ (3.5 0 0.5 0 -0.8 0.6 0.2);
   retain CB RB sigma alpha;
   if (_n_=1) then do;
      call streaminit(67890);
      sigma = 1.0; /* for lognormal */
      alpha = 3.0; /* for gamma */
   end;
   set OpRiskLossCounts(keep=line numloss corpKRI1 corpKRI2 cbKRI2 rbKRI1);
   sx(5) = rand('NORMAL'); /* simulate rbKRI3 value */
   corp1rb3 = sx(1) * sx(5);

   if (line='CommercialBanking') then do;
      CB = 0;
      do il=1 to numloss;
         /* lognormal */
         Mu = sbetaC(1);
         do i=1 to dim(sx);
            Mu = Mu + sx(i) * sbetaC(i+1);
         end;
         lossValue = exp(Mu) * rand('LOGNORMAL')**Sigma;
       CB = CB + lossValue;
       output OpRiskLosses;
     end;
   end;
   else do; /* line='RetailBanking' */
      RB = 0;
      do il=1 to numloss;
         /* gamma */
         Mu = sbetaR(1);
         do i=1 to dim(sx);
            Mu = Mu + sx(i) * sbetaR(i+1);
         end;
         lossValue = rand('Gamma', Alpha, exp(Mu));
       RB = RB + lossValue;
       output OpRiskLosses;
     end;
     output OpRiskMatchedLosses;
   end;
run;

The following DATA steps load the data tables in your session that is associated with the mylib libref. This example assumes that your libref is named mylib, but you can substitute any appropriately defined libref.

/*** Load data tables into the session ***/
data mylib.OpRiskLossCounts;
   set OpRiskLossCounts;
run;
data mylib.OpRiskLosses;
   set OpRiskLosses;
run;
data mylib.OpRiskMatchedLosses;
   set OpRiskMatchedLosses(where=(CB > 0 and RB > 0));
run;

When your frequency or severity models contain regressors, you must also create an external scenario data table to contain values that you expect to observe for each regressor in some future state. The final CDM and ECM estimates depend on this scenario data table. For this example, the scenario data table is named Work.MultiConditionScenario, and it contains observations for 12 months of a future year. The following DATA steps simulate it and load it into your session:

/*** Generate a scenario data table for multiple operating conditions ***/
data multiConditionScenario (keep=line opEnvId corpKRI1 corpKRI2
      cbKRI1 cbKRI2 cbKRI3 rbKRI1 rbKRI2 rbKRI3);
   array x{8} corpKRI1 corpKRI2 cbKRI1 cbKRI2 cbKRI3 rbKRI1 rbKRI2 rbKRI3;
   call streaminit(5151);
   do opEnvId=1 to 12;
      do i=1 to dim(x);
         x(i) = rand('NORMAL');
      end;
      line = 'CommercialBanking';
      output;
      line = 'RetailBanking';
      output;
   end;
run;
proc print; run;

/*** Load the scenario data table into the session ***/
data mylib.multiConditionScenario;
  set multiConditionScenario;
run;

After this critical step of collecting and preparing the data, you are ready for the subsequent modeling and simulation steps.

Frequency (Count) Modeling

The CNTSELECT procedure in SAS Econometrics estimates frequency models. It fits a count regression model, where the dependent variable is a count variable that, conditional on the regressors, has one of the following discrete probability distributions: Poisson, negative binomial with linear or quadratic variance, or Conway-Maxwell-Poisson (CMP). It can also fit a zero-inflated version of each distribution, enabling you to account for the large number of zeros that are often present in real-life loss count data. For detailed information about all the features of PROC CNTSELECT, see Chapter 10, CNTSELECT Procedure.

The following statements use the CNTSELECT procedure to fit Poisson and negative binomial distribution models to the example data:

/*** Fit Poisson count models ***/
proc cntselect data=mylib.OpRiskLossCounts store=mylib.opriskStorePoisson
   method=CONGRA;
   by line;
   model numloss=corpKRI1 corpKRI2 cbKRI1 cbKRI2 cbKRI3 cbKRI2*cbKRI3
         rbKRI1 rbKRI2/dist=poisson;
   selection;
   ods output SelectedModel.FitModelSummary=fitPoisson;
run;

/*** Fit negative binomial count models ***/
proc cntselect data=mylib.OpRiskLossCounts store=mylib.opriskStoreNegbin
   method=CONGRA;
   by line;
   model numloss=corpKRI1 corpKRI2 cbKRI1 cbKRI2 cbKRI3 cbKRI2*cbKRI3
         rbKRI1 rbKRI2/dist=negbin(p=2);
   selection;
   ods output SelectedModel.FitModelSummary=fitNegbin
              SelectedModel.ParameterEstimates=estNegbin;
run;

In the PROC CNTSELECT step, the BY statement ensures that the specified model is analyzed for both LoBs. The MODEL statements specify all the possible regression effects that you believe can affect the number of losses in all LoBs. The SELECTION statements perform model (variable) selection independently for each BY group. The default settings of the SELECTION statement choose the best subset of regression effects to maximize the Schwarz Bayesian criterion (SBC). The ODS OUTPUT statements store the fit summary of the selected model in the Work.FitPoisson and Work.FitNegbin data sets. The following DATA step reads those two data sets to prepare a comparative fit summary:

/*** Summarize count modeling results ***/
data countFitSummary;
   set fitPoisson (keep=line Property PropertyValue where=(Property='SBC'));
   Model='Poisson    ';
   output;
   set fitNegbin (keep=line Property PropertyValue where=(Property='SBC'));
   Model='NegBin(p=2)';
   output;
run;

Output 18.1.1 shows the comparison of the fit summary of the final count models of both business lines. It indicates that the negative binomial model is the best model for the commercial banking LoB, because it has a smaller SBC value than the Poisson model. For the retail banking LoB, the Poisson model is the best model. Occasionally, both the Poisson and negative binomial models might have identical SBC values. This usually implies that the negative binomial model is equivalent to the Poisson model, because the overdispersion parameter alpha is close to 0. Formally, the conditional variance of the negative binomial distribution is upper V left-parenthesis y vertical-bar x right-parenthesis equals mu plus alpha mu squared, where mu denotes the mean. As alpha becomes closer 0, the variance becomes closer to the mean, making it equivalent to a Poisson distribution. The estimate of the _Alpha parameter in Output 18.1.2 confirms this.

Output 18.1.1: Comparing Fit Statistics of Count Models

lineModelPropertyPropertyValue
CommercialBankingPoissonSBC4010.42
CommercialBankingNegBin(p=2)SBC3608.513
RetailBankingPoissonSBC2940.835
RetailBankingNegBin(p=2)SBC2940.835


Output 18.1.2: Parameter Estimates of Negative Binomial Count Model (Retail Banking)

The CNTSELECT Procedure
 
Selected Model

Parameter Estimates
ParameterDFEstimateStandard
Error
t ValueApprox
Pr > |t|
Intercept10.1247330.0324013.850.0001
corpKRI110.9897010.01968750.27<.0001
corpKRI21-0.5042750.019627-25.69<.0001
rbKRI110.5226830.01986226.32<.0001
rbKRI210.7128960.02030735.11<.0001
_Alpha11.0536712E-8...
Restrict 1-16273.095945...


The STORE= options in each PROC CNTSELECT step create item-store data tables that store all the model fit information, including the selected model’s parameter estimates, which are used to estimate the compound distribution model in a later step.

Severity Modeling

The SEVSELECT procedure in SAS Econometrics estimates severity models. In the simplest form, it fits multiple continuous probability distributions to the input loss severity data (which are possibly censored or truncated), and prepares a comparative summary of the fit statistics of all candidate distributions to help you choose the best candidate. PROC SEVSELECT includes a default set of 10 distributions: Burr, exponential, gamma, generalized Pareto (GPD), inverse Gaussian (Wald), lognormal, Pareto, scaled Tweedie, Tweedie, and Weibull. However, you can define and fit your own distributions, such as mixture distributions. PROC SEVSELECT models the effect of regressors on the scale parameter or the log-scale parameter of the distribution, and it supports automatic model (variable) selection. For detailed information about all the features of PROC SEVSELECT, see Chapter 26, SEVSELECT Procedure.

The following PROC SEVSELECT step fits severity models for three candidate distributions—gamma, lognormal, and Weibull—to the example data:

/*** Fit severity models ***/
proc sevselect data=mylib.OpRiskLosses store=mylib.opriskSevstore(promote=yes)
               covout print=(allfitstats);
   by line;
   loss lossValue;
   dist gamma logn weibull;
   scalemodel corpKRI1 corpKRI2 cbKRI2 rbKRI1 rbKRI3 corpKRI1*rbKRI3;
   selection method=forward(select=aicc);
run;

The LOSS statement specifies the severity loss variable. The DIST statement specifies the list of candidate distributions. The STORE= option names an item store to hold the final model specifications and their parameter estimates. The COVOUT option requests that the parameter covariance estimates be kept in the item store for use in a later step. The SCALEMODEL statement lists all candidate regression effects. The SELECTION statement requests that the best subset of regression effects be chosen according to the forward selection method, where candidate subsets are compared using the corrected Akaike’s information criterion (AICC). Within each BY group, PROC SEVSELECT runs the regression effect selection process independently for each candidate distribution.

After the selection process completes for all distributions, PROC SEVSELECT prepares a comparative summary of the fit statistics of the final selected scale regression models of all candidate distributions, as shown in Output 18.1.3. There are two classes of fit statistics: likelihood-based (AIC, AICC, and SBC) and EDF-based (KS, AD, CvM). Akaike’s information criterion (AIC) is an asymptotic version of AICC. The Kolmogorov-Smirnov (KS), Anderson-Darling (AD), and Cramér–von Mises (CvM) statistics are the EDF-based statistics, which measure the distance between the CDF and the EDF. For scale regression models, the CDF depends on the values of the regressors, which can vary from one observation to another, making it difficult to interpret the EDF-based fit statistics. So you should use the likelihood-based statistics to compare the scale regression models. For the example data, the lognormal distribution is the best for the commercial banking line, and the gamma distribution is the best for the retail banking line, according to all the likelihood-based fit statistics.

Output 18.1.3: Comparison of Statistics of Fit for the Final Selected Severity Models

The SEVSELECT Procedure
 
Weibull Distribution
Selected Model

All Fit Statistics
Distribution-2 Log
Likelihood
AICAICCSBCKSADCvM
Gamma469644697446974470045.41882190.5041911.56643
Logn46471*46481*46481*46512*5.09394153.9882712.20540
Weibull469864699646996470275.05018*140.59352*6.80075*
Asterisk (*) denotes the best model in the column.

All Fit Statistics
Distribution-2 Log
Likelihood
AICAICCSBCKSADCvM
Gamma30851*30865*30865*30908*12.35872135862.75081
Logn3098530999309993104111.22101*1037*60.10064
Weibull3097930993309933103612.61826169056.20766*
Asterisk (*) denotes the best model in the column.


Compound Distribution Modeling

The CCDM procedure in SAS Econometrics estimates a compound distribution model (CDM) for the aggregate loss by combining the best frequency and severity models. Before illustrating the use of PROC CCDM, it is useful to define the CDM. If N and X represent the frequency and severity random variables, respectively, then the aggregate loss S is defined as upper S equals sigma-summation Underscript j equals 1 Overscript upper N Endscripts upper X Subscript j. If upper F Subscript upper X Baseline left-parenthesis x right-parenthesis denotes the cumulative distribution function (CDF) of X and if probability left-parenthesis upper N equals n right-parenthesis denotes the probability of seeing n losses as per the frequency distribution, then the CDF of S is theoretically computable as upper F Subscript upper S Baseline left-parenthesis s right-parenthesis equals sigma-summation Underscript n equals 0 Overscript normal infinity Endscripts probability left-parenthesis upper N equals n right-parenthesis dot upper F Subscript upper X Superscript asterisk n Baseline left-parenthesis x right-parenthesis, where upper F Subscript upper X Superscript asterisk n Baseline left-parenthesis x right-parenthesis denotes the n-fold convolution of the CDF of X. The probability distribution model for S, characterized by upper F Subscript upper S Baseline left-parenthesis s right-parenthesis, is called a CDM. Direct computation of upper F Subscript upper S is usually a difficult task because the n-fold convolution needs to be computed. Some methods exist for certain combinations of severity and frequency distributions (for example, Klugman, Panjer, and Willmot 1998, Ch. 4), but even those methods do not offer closed-form or easily computable expressions for upper F Subscript upper S. Further, when the distributions of X and N are conditional on external factors (regressors), as is usually the case, each set of regressor values results in a different distribution for N and X. For all these reasons, PROC CCDM estimates the CDM by using a Monte Carlo simulation method. For detailed information about all the features of PROC CCDM, see Chapter 7, CCDM Procedure. An important feature that this example uses is PROC CCDM’s ability to generate multiple perturbed aggregate loss samples, each of which corresponds to a random perturbation of the frequency and severity parameters from their mean values according to the covariance structure that the CNTSELECT and SEVSELECT procedures estimate. This feature helps assess the uncertainty (variability) in the estimates of the CDM.

The following PROC CCDM steps estimate the CDM for each LoB. Because the best count model for each LoB is different for this example, you need two separate steps, each of which uses an appropriate count model item-store table in the COUNTSTORE= option.

/*** Simulate CDM for commercial banking LoB ***/
proc ccdm data=mylib.multiConditionScenario
          countstore=mylib.opriskStoreNegbin severitystore=mylib.opriskSevstore
          seed=13579 nreplicates=10000 nperturb=50 print=all;
   by line;
   severitymodel logn;
   output out=mylib.aggregateLossCB samplevar=agglossCB / perturbOut;
run;

/*** Simulate CDM for retail banking LoB ***/
proc ccdm data=mylib.multiConditionScenario
          countstore=mylib.opriskStorePoisson severitystore=mylib.opriskSevstore
          seed=13579 nreplicates=10000 nperturb=50 print=all;
   by line;
   severitymodel gamma;
   output out=mylib.aggregateLossRB samplevar=agglossRB / perturbOut;
run;

When the frequency and severity models contain regression effects, you need to use the DATA= option to specify a data table that contains an external scenario that you want to analyze. This example uses a simulated scenario in the mylib.MultiConditionScenario data table. The NPERTURB= option requests that parameter perturbation analysis be conducted to generate 50 perturbed samples. The NREPLICATES= option specifies the size of each unperturbed and perturbed aggregate loss sample. The OUTPUT statement and its PERTURBOUT option request that all 51 samples be stored in a data table. PROC CCDM creates the output data table by using parallel computations and stores it in a distributed manner across all worker nodes. These samples are useful for estimating the uncertainty in the final ECM estimates in a later stage of the ECM process.

Output 18.1.4 shows one of the tables that the perturbation analysis produces for the commercial banking LoB. You can use this table to estimate the VaR for an individual LoB. The perturbation analysis gives you an estimate of the variability in each statistic of interest, which is more informative than just the estimate of the mean.

Output 18.1.4: Perturbation Analysis of Aggregate Losses (Commercial Banking LoB)

The CCDM Procedure
 
Severity Model: Logn
Count Model: NegBin(p=2)

Sample Percentile Perturbation Analysis
PercentileEstimateStandard
Error
15275.4376.48300
57954.1494.75748
2513355.5718.13076
5018388.8943.74904
7524699.31245.3
9536460.41929.3
9947070.22483.3
99.551639.62679.0
Number of Perturbed Samples = 50
Size of Each Sample = 10000


Copula Modeling

The CCOPULA procedure in SAS Econometrics helps you analyze the dependency among losses of multiple LoBs. It supports the dependency structures that are expressed in terms of an elliptical copula (normal and t copulas) or an Archimedean copula (Clayton, Frank, and Gumbel copulas). A copula is especially useful for modeling the dependency structure in the ECM process, because it decouples the marginal distributions—that is, the probability distributions of individual random variables—from their joint probability distribution. This decoupling is based on an important theorem by Sklar (1959), which shows that a copula can be derived from any joint distribution function and that any copula can be combined with any set of marginal distributions to result in a multivariate distribution function. PROC CCOPULA can both fit a copula model and simulate samples from a fitted copula model. For detailed information about all the features of PROC CCDM, see Chapter 8, CCOPULA Procedure.

The following PROC CCOPULA steps fit four different types of copulas to the matched loss data in the data table mylib.OpRiskMatchedLosses:

/*** Fit different copula models ***/
proc ccopula data=mylib.OpRiskMatchedLosses;
   var CB RB;
   fit Gumbel / store=mylib.copStoreG;
   ods output fitmodelsummary=fitsummG;
run;
proc ccopula data=mylib.OpRiskMatchedLosses;
   var CB RB;
   fit T / store=mylib.copStoreT;
   ods output fitmodelsummary=fitsummT;
run;
proc ccopula data=mylib.OpRiskMatchedLosses;
   var CB RB;
   fit Frank / store=mylib.copStoreF;
   ods output fitmodelsummary=fitsummF;
run;
proc ccopula data=mylib.OpRiskMatchedLosses;
   var CB RB;
   fit Clayton / store=mylib.copStoreC;
   ods output fitmodelsummary=fitsummC;
run;

In each PROC CCOPULA step, the VAR statement specifies the marginal variables, which are CB and RB for losses in the commercial and retail banking LoBs, respectively. The FIT statement specifies the type of the copula and names the item-store data table in which to store the specification and estimates of the copula parameters. The ODS OUTPUT statement stores the fit summary of the copula, which you can analyze to produce a comparative table of the SBC fit statistics of all copulas as shown in Output 18.1.5. The table shows that the Gumbel copula has the best fit for the example data by virtue of having the smallest SBC value.

Output 18.1.5: Fit Statistics for Copula Models

CopulaSBC
Gumbel-69.6587
T-61.4826
Frank-48.3310
Clayton-25.3843


Copula Simulation

The next step in the ECM process is to simulate multiple future scenarios of loss values that might be observed in all LoBs in the same time period. Each scenario is represented by the probabilities of loss values in all LoBs while taking into account the dependency structure among their losses. The use of the OUTUNIFORM= option in the OUTPUT statement of the CCOPULA procedure helps you create a large number of such simulated scenarios. The following PROC CCOPULA step illustrates that for the best-fitting Gumbel copula for this example’s data:

/*** Simulate marginal probabilities on the uniform scale from the Gumbel copula ***/
proc ccopula;
    simulate cop / restore=mylib.copStoreG
                   ndraws=10000 seed=234
                   outuniform=mylib.CbRbProbs;
run;
proc print data=mylib.CbRbProbs(obs=5) noobs; run;

The SIMULATE statement specifies the mylib.copStoreG item store to read the estimates of the Gumbel copula’s parameter. The NDRAWS= option simulates 10,000 observations from this copula. The OUTUNIFORM= option requests that the observations be generated in the uniform scale and stored in the mylib.CbRbProbs data table. PROC CCOPULA uses the multiple nodes of a CAS session to simulate and store the data in a distributed manner. The first few simulated observations in the data table are shown in Output 18.1.6. Each observation contains the probability of a loss in each LoB.

Output 18.1.6: Example of Simulated Copula Observations

CBRB
0.05854455760.317802304
0.95798330830.9688330154
0.21144792240.3521376759
0.38571461590.9856645119
0.70712695660.7585000789


Economic Capital Modeling: Combining Copula Simulation with CDM Samples

The final step of the ECM process is to estimate the distribution of the total loss across all LoBs. This requires transforming each observation in the copula simulation table (which contains the probability of a loss value in each LoB) to an observation that contains an estimate of the actual loss for each LoB. For a conceptual overview of this process, see the section Overview of the Algorithm.

The ECM procedure is designed specifically to help you implement this step. The following PROC ECM step converts the loss probabilities in the data table mylib.CbRbProbs to a sample of the total loss across two marginals, CB and RB, for the commercial and retail banking LoBs, respectively:

/* Estimate an empirical model for the total loss */
proc ecm data=mylib.CbRbProbs tailstart=0.85 edfaccuracy=1.0e-2
         samplefraction=0.7 seed=789 print=all;
    marginal CB: data=mylib.aggregateLossCB samplevar=agglossCB;
    marginal RB: data=mylib.aggregateLossRB samplevar=agglossRB;
    outsum out=mylib.tlSummary mean stddev skew kurtosis qrange=iqr
        pctlpts=50, 90, 95, 97.5, 99, 99.5 pctlpre=VaR
        tvarpts=90, 95, 97.5, 99, 99.5 pctlpre=TVaR;
run;

The two MARGINAL statements specify the data tables that contain the aggregate loss samples of each LoB as created by the CCDM steps. The identifying name of the marginal that you specify in the MARGINAL statement must match the corresponding name that you use in the VAR statement of the CCOPULA procedure. Because the name of the variable that contains the sample is different from the name of the marginal, you need to specify the SAMPLEVAR= option in each MARGINAL statement.

PROC ECM uses the loss sample in each marginal’s data table to estimate the empirical distribution function (EDF) of that marginal. The EDF estimation process works in two stages. The first stage divides the sample values into body and tail regions. For this example, the TAILSTART= option requests that the tail region start at a value whose EDF is approximately 0.85. The actual EDF value at the start of the tail region also depends on the number of worker nodes and the sampling fraction for the body region. The second stage estimates the EDF in each region independently by using the desired accuracy of EDF estimates in each region. By default, PROC ECM attempts to achieve higher accuracy in the tail region. So for this example, you should expect more accurate loss estimates for probability values that are larger than approximately 0.85. The body region can afford to have a relatively lower EDF accuracy. For this example, the EDFACCURACCY= option specifies it to be 0.01, which means that the width of the bins along the EDF axis is approximately 0.01 in the body region. In particular, when PROC ECM processes an interval left-bracket p 1 comma p 2 right-bracket of the EDF axis, it attempts to bin the data into approximately B bins, where upper B almost-equals left-parenthesis p 2 minus p 1 right-parenthesis slash 0.01. The SAMPLEFRACTION= option requests that only about 70% of the observations in the body region be used for estimating the EDF in that region. This helps reduce the amount of data movement among worker nodes. The SEED= option ensures that the results are similar across multiple runs of the procedure with identical inputs.

For each observation in the DATA= data table, PROC ECM computes the percentile for the probability value of each marginal by using the estimated EDF of that marginal. Adding these percentiles across all marginals results in the estimate of the total loss for that observation. Repeating this process for all observations results in the sample of the total loss, which encodes the probability distribution of the total loss, which in turn is an empirical estimate of the economic capital model (ECM). The OUTSUM statement specifies the summary statistics and various percentile levels of risk measures, VaR and TVaR, that you want to compute for the estimated ECM. The OUT= option requests that the computed statistics and risk measures be stored in the data table mylib.tlSummary.

The PRINT=ALL option in the PROC ECM statement displays all the result tables that PROC ECM produces. For each marginal, up to five result tables are displayed, as illustrated in Output 18.1.7, Output 18.1.8, and Output 18.1.9 for the commercial banking marginal CB.

Output 18.1.7 shows the "Data Summary" table, which summarizes the data sample that PROC ECM reads for CB. It displays the data table name; the number of total, valid, and zero-valued observations; and the range of the data. When the input data table is a result of the parameter perturbation analysis that PROC CCDM conducts (as in this example), it contains multiple samples, each identified by a unique value of the _DRAWID_ variable. The "Data Summary" table displays the draw identifier, which is the value of the _DRAWID_ variable it uses to read the marginal sample. You can control this value by specifying a global value in the DRAWID= option in the PROC ECM statement or a marginal-specific value in the DRAWID= option in a MARGINAL statement. Similarly, the input data table can contain samples for multiple severity distributions when you specify multiple distributions in the SEVERITYMODEL statement of PROC CCDM. PROC ECM chooses the first severity distribution that it finds and displays its name in the "Data Summary" table.

Output 18.1.7: Data Summary (Commercial Banking)

The ECM Procedure
 
Marginal Variable CB

Data Summary
Data TableAGGREGATELOSSCB
Severity ModelLogn
Draw Identifier0
Observations20000
Valid Observations20000
Zero-valued Observations0
Minimum233.557351
Maximum135451


Output 18.1.8 shows the tables that provide an insight into the first stage of the EDF estimation algorithm for the commercial banking marginal CB.

Output 18.1.8: Summary of the First Stage of EDF Estimation (Commercial Banking)

EDF Binning Initialization
Number of Bins7
Convergence StatusConverged
Tail Start EDF0.857650
Tail Start23510
Bins Distributed Among WorkersNo

EDF Binning Initialization Details
Target
Proportion
IterationsCriterionDFChi-SquarePr > ChiSq
0.14285750.003300061.44580.9630


Following is a description of the contents of each table in Output 18.1.8:

  • "EDF Binning Initialization": This table summarizes the result of the first-stage binning by displaying the number of bins and the status of the iterative bin boundary optimization algorithm. It also shows the EDF value and the actual loss value at the start of the tail region. Finally, it shows whether the bins are distributed among worker nodes at the end of the first stage.

  • "EDF Binning Initialization Details": This table displays the details of the iterative bin boundary optimization algorithm of the first stage. For B number of bins (which is 7 for this marginal), the algorithm attempts to achieve a target proportion of 1 slash upper B observations in each bin. After several iterations, the maximum difference in fractions of observations in the largest and smallest bins is the value of Criterion. The chi-square test for uniformity of counts in the bins uses upper B minus 1 degrees of freedom. The value of the test statistic and its corresponding p-value show that the final distribution of counts in bins is close to the uniform distribution.

Output 18.1.9 shows the tables that provide an insight into the second stage of the EDF estimation process for the commercial banking marginal CB.

Output 18.1.9: Summary of the Second Stage of EDF Estimation (Commercial Banking)

EDF Binning Summary
RegionBeginEndLocationNBinsStatus
1233.5573523509.7Body1715386Converged
223509.7135451.4Tail28472848Data points used as bins

EDF Binning Optimization Details
RegionTarget
Proportion
IterationsCriterionDFChi-SquarePr > ChiSq
10.01162810.00448908553.17190.9973


Following is a description of the contents of each table in Output 18.1.9:

  • "EDF Binning Summary": This table displays the different subregions of values that the second stage processes in parallel. Typically, the number of rows in this table is proportional to the number of worker nodes. For each subregion, the table displays whether the subregion is located in the body or tail region of the distribution. You might also occasionally see the 'Body-Tail' location value, which indicates that a subregion straddles the body and tail regions. Next, the table displays the number of observations that are processed and the number of bins that are used. The number of observations in the body subregions reflect the sampling fraction. The number of bins reflects the specified EDF accuracy. Finally, the last column displays the status of the binning process for that subregion. If the number of bins is small enough to hold at least five observations in each bin, an iterative binning algorithm is used and its convergence status is displayed. If the desired accuracy of the region is too high, the number of bins is large and the algorithm uses data points as bin boundaries, as the table shows for the tail region.

  • "EDF Binning Optimization Details": This table displays the details of the iterative bin boundary optimization algorithm for each subregion that does not use data as bin boundaries. The Region column identifies the region, and the remaining columns are similar to the columns of the "EDF Binning Initialization Details" table. For this example, the binning algorithm needs very few iterations in both subregions to achieve a nearly uniform distribution of counts.

    If the algorithm decides to use data points as bin boundaries in all the subregions, then this table is not displayed.

PROC ECM also executes the same EDF estimation algorithm for the retail banking marginal RB, and the PRINT=ALL option displays up to five similar result tables for that marginal. Further, because the OUTSUM statement requests ECM statistics that require percentile-based estimates, PROC ECM also executes the same algorithm to estimate the EDF of the generated total loss sample and then uses that EDF estimate to compute the required percentiles and percentile-based risk measures. The PRINT=ALL option displays up to five similar result tables, which contain the summary of the total loss sample and information about the first and second stages of the EDF estimation algorithm for that sample.

After displaying the results of the EDF estimation algorithms for all marginals and the total loss sample, PROC ECM displays the summary statistics and requested risk measures for the total loss sample. Output 18.1.10 shows the "Summary Statistics" and "Tail Value-at-Risk Estimates" tables for this example.

Output 18.1.10: Summary Statistics and Estimates of Risk Measures (VaR and TVaR) of the ECM

Summary Statistics
Sample Size10000
Minimum1921.8
Maximum122147.2
Mean23061.3
Standard Deviation15640.3
Variance244617483
Skewness0.90913
Kurtosis0.77211
Median20658.4
Interquartile Range23487.3

Tail Value-at-Risk Estimates
PercentilePr > VaRValue at Risk (VaR)Tail Value at Risk
900.144943.454976.4
950.0552019.361880.9
97.50.02559023.368705.4
990.0168500.677100.1
99.50.00574608.982843.7


The "Summary Statistics" table displays the size of the sample, the range of the total loss values in the sample, and various moments of the sample. It also displays median and interquartile range, the robust statistics of location and scale, respectively. The "Tail Value-at-Risk Estimates" table displays the VaR and TVaR estimates for the percentile levels in the TVARPTS= option in the OUTSUM statement. These result tables together provide you a comprehensive statistical picture of the distribution of the total loss. You can especially use the VaR and TVaR estimates to decide the capital requirements for your enterprise. But, you can take this analysis one step further.

The preceding estimates are for a specific set of marginal samples. However, the perturbation analysis that PROC CCDM conducts to capture the uncertainty in the parameter estimates of the severity and frequency models results in multiple samples for each marginal. Similar to how PROC CCDM uses those multiple perturbed samples to estimate the location and dispersion (variability) of various summary statistics and percentiles of a marginal’s CDM, you can use different combinations of the perturbed samples of all the marginals to generate multiple samples of the total loss, compute the risk measures for each such total loss sample, and summarize those estimates to estimate the location and dispersion of all risk measures.

Each perturbed sample is identified by a draw identifier that PROC CCDM writes in the variable _DRAWID_ when you use the NPERTURB= option in the PROC CCDM statement and the PERTURBOUT option in the OUTPUT statement. PROC ECM enables you to specify a value of the draw identifier to use for each marginal by using the DRAWID= option in the MARGINAL statement. The following programming statements use this feature to define a SAS macro that generates multiple combinations of the perturbed samples of both the marginals of this example and invokes PROC ECM for each combination:

/*** Macro to generate multiple ECM samples by using multiple perturbed CDM samples,
     and to estimate mean, standard deviation, median, and interquartile range
     of various risk measures of the total loss. ***/
%macro EstimateECMvariability(maxDrawId1=10, maxDrawId2=10);
   %do draw1=0 %to &maxDrawId1;
      %do draw2=0 %to &maxDrawId2;
         %put draw1=&draw1 draw2=&draw2;
         proc ecm data=mylib.CbRbProbs noprint;
            marginal CB: data=mylib.aggregateLossCB samplevar=agglossCB drawId=&draw1;
            marginal RB: data=mylib.aggregateLossRB samplevar=agglossRB drawId=&draw2;
            outsum out=mylib.tlSumm mean stddev skew kurtosis qrange=iqr
                pctlpts=50, 95, 97.5, 99.5 pctlpre=VaR
                tvarpts=95, 97.5, 99.5 pctlpre=TVaR;
         run;
         data tlSumm;
            set mylib.tlSumm;
         run;
         %if &draw1=0 and &draw2=0 %then %do;
            data allecmstats;
               set tlSumm;
            run;
         %end;
         %else %do;
            proc datasets library=work nolist;
               append base=allecmstats data=tlSumm;
            run;
         %end;
      %end;
   %end;

   proc means data=allecmstats(rename=(VaR50=Median)) n mean std median qrange;
      var Mean Median VaR95 TVaR95 VaR97_5 TVaR97_5 VaR99_5 TVaR99_5;
   quit;
%mend;

/*** Compute ECM variability estimates ***/
%EstimateECMvariability(maxDrawId1=9, maxDrawId2=9);

The preceding code accumulates the summary statistics and risk measures (VaR and TVaR) that each PROC ECM step computes into the data table Work.AllEcmStats. The PROC MEANS step then summarizes that data table to estimate the location and dispersion of each summary statistic and risk measure. The final results that the %EstimateECMvariability macro prepares are shown in Output 18.1.11.

Output 18.1.11: Location and Dispersion Estimates of Various ECM Summary Statistics and Risk Measures

The MEANS Procedure

VariableLabelNMeanStd DevMedianQuartile Range
MEAN
Median
VaR95
TVaR95
VaR97_5
TVaR97_5
VaR99_5
TVaR99_5
Mean
50th Percentile
95th Percentile
Tail Value-at-Risk (TVaR): 95th Percentile
97.5th Percentile
Tail Value-at-Risk (TVaR): 97.5th Percentile
99.5th Percentile
Tail Value-at-Risk (TVaR): 99.5th Percentile
100
100
100
100
100
100
100
100
22624.91
20202.09
51471.24
60980.61
58242.96
67557.64
73266.99
81107.88
508.8904821
448.1312869
1438.64
1670.27
1625.26
1853.42
1956.93
2309.65
22690.38
20222.62
51693.52
61260.92
58620.67
68042.35
73606.28
81642.40
623.0886502
577.8018542
1949.54
2307.31
2290.03
2543.53
2481.46
3107.46


You have now completed the process of developing an economic capital model. You should be able to use this template to analyze multiple dependent lines of business or risk categories of your enterprise and get a statistically sound estimate of the economic capital model to decide the minimum capital that you need to set aside for covering the worst-case losses across the parts of the enterprise that you include in the ECM.

Last updated: July 09, 2026