transprobprep

Preprocess credit ratings data to estimate transition probabilities

Syntax

[prepData] = transprobprep(data)
[prepData] = transprobprep(data, Name,Value)

Description

[prepData] = transprobprep(data) preprocesses credit ratings historical data (i.e., credit migration data) for the subsequent estimation of transition probabilities.

[prepData] = transprobprep(data, Name,Value) preprocesses credit ratings historical data (i.e., credit migration data) for the subsequent estimation of transition probabilities with additional options specified by one or more Name,Value pair arguments.

Input Arguments

data

Historical input data for credit ratings. Cell array of size nRecords-by-3 containing the credit ratings. Each row contains an ID (column 1), a date (column 2), and a credit rating (column 3). The assigned credit rating corresponds to the associated ID on the associated date. All information corresponding to the same ID must be stored in contiguous rows. Sorting this information by date is not required but is recommended. IDs, dates, and ratings are usually stored in string format, but they can also be entered in numeric format. Here is an example with all of the information in string format:

 '00010283'    '10-Nov-1984'    'CCC'
 '00010283'    '12-May-1986'    'B'  
 '00010283'    '29-Jun-1988'    'CCC'
 '00010283'    '12-Dec-1991'    'D'  
 '00013326'    '09-Feb-1985'    'A'  
 '00013326'    '24-Feb-1994'    'AA' 

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

'labels'

Cell array of size nRatings-by-1, or 1-by-nRatings, containing the credit-rating scale. It must be consistent with the ratings labels used in the third column of data.

Default: {'AAA','AA','A','BBB','BB','B','CCC','D'}

Output Arguments

prepData

Structure with the following fields:

  • idStart — Array of size (nIDs+1)-by-1, where nIDs is the number of distinct IDs in column 1 of data. This array summarizes where the credit ratings information corresponding to each company starts and ends. The dates and ratings corresponding to company j in data are stored from row idStart(j) to row idStart(j+1)−1 of numericDates and numericRatings.

  • numericDates — Array of size nRecords-by-1, containing the dates in column 2 of data, in numeric format.

  • numericRatings — Array of size nRecords-by-1, containing the ratings in column 3 of data, mapped into numeric format.

  • ratingsLabels — Cell array of size1-by-nRatings, containing the credit rating scale.

Examples

expand all

Aggregate the Credit Ratings Information Stored in the totals Input

Use historical credit rating input data from Data_TransProb.mat. Load input data from file Data_TransProb.mat.

load Data_TransProb

% Call TRANSPROB with two output arguments
[transMat, sampleTotals] = transprob(data);
transMat
transMat =

  Columns 1 through 7

   93.1170    5.8428    0.8232    0.1763    0.0376    0.0012    0.0001
    1.6166   93.1518    4.3632    0.6602    0.1626    0.0055    0.0004
    0.1237    2.9003   92.2197    4.0756    0.5365    0.0661    0.0028
    0.0236    0.2312    5.0059   90.1846    3.7979    0.4733    0.0642
    0.0216    0.1134    0.6357    5.7960   88.9866    3.4497    0.2919
    0.0010    0.0062    0.1081    0.8697    7.3366   86.7215    2.5169
    0.0002    0.0011    0.0120    0.2582    1.4294    4.2898   81.2927
         0         0         0         0         0         0         0

  Column 8

    0.0017
    0.0396
    0.0753
    0.2193
    0.7050
    2.4399
   12.7167
  100.0000

Group into investment grade (ratings 1-4) and speculative grade (ratings 5-7); note, the default is the last rating (number 8).

edges = [4 7 8];
sampleTotalsGrp = transprobgrouptotals(sampleTotals,edges);

% Transition matrix at investment grade / speculative grade level
transMatIGSG = transprobbytotals(sampleTotalsGrp)
transMatIGSG =

   98.5336    1.3608    0.1056
    3.9155   92.9692    3.1153
         0         0  100.0000

Obtain the 1-year, 2-year, 3-year, 4-year, and 5-year default probabilities at investment grade and speculative grade level.

DefProb = zeros(2,5);
for t = 1:5
transMatTemp = transprobbytotals(sampleTotalsGrp,'transInterval',t);
DefProb(:,t) = transMatTemp(1:2,3);
end
DefProb
DefProb =

    0.1056    0.2521    0.4359    0.6537    0.9027
    3.1153    6.0157    8.7179   11.2373   13.5881

Was this topic helpful?