[prepData] = transprobprep(data)
preprocesses credit ratings historical data (that is, credit migration data) for
the subsequent estimation of transition probabilities.
data — Historical data for credit ratings table | cell array of character vectors
Historical input data for credit ratings, specified as one of the following:
A MATLAB® table 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 recommended for
efficiency. When using a MATLAB table input, the names of the columns are
irrelevant, but the ID, date and rating information are
assumed to be in the first, second, and third columns,
respectively. Also, when using a table input, the first and
third columns can be categorical arrays, and the second can
be a datetime array. Here is an example with all the
information in table
format:
The following summarizes the supported data types for
table input:
Data Input Type
ID (1st Column)
Date (2nd Column)
Rating (3rd Column)
Table
Numeric array
Cell array of character vectors
Categorical array
Numeric array
Cell array of character vectors
Datetime array
Numeric array
Cell array of character vectors
Categorical array
A 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 stored in character vector format,
but they can also be entered in numeric format. Here is an
example with all the information in character vector
format:
The following summarizes the supported data types for cell
array input:
Data Input Type
ID (1st Column)
Date (2nd Column)
Rating (3rd Column)
Cell
Numeric elements
Character vector elements
Numeric elements
Character vector elements
Numeric elements
Character vector elements
Data Types: table | cell
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 quotes. You can specify several name and value
pair arguments in any order as
Name1,Value1,...,NameN,ValueN.
'labels' — Credit-rating scale {'AAA','AA','A','BBB','BB','B','CCC','D'} (default) | cell array of character vectors
Credit-rating scale, specified as the comma-separated pair
consisting of 'labels' and a
nRatings-by-1, or
1-by-nRatings cell array of
character vectors.
labels must be consistent with the ratings
labels used in the third column of data. Use a
cell array of numbers for numeric ratings, and a cell array for
character vectors for categorical ratings.
prepData — Summary where credit ratings information corresponding to each company starts and ends structure
Summary where the credit ratings information corresponding to each
company starts and ends, returned as a 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.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.