Main Content


Compute exposure profiles from credit exposures


profilestructs = exposureprofiles(dates,exposures) computes common counterparty credit exposures profiles from an array of exposures.

profilestructs = exposureprofiles(___,Name,Value) adds optional name-value arguments.


collapse all

After computing the mark-to-market contract values for a portfolio of swaps over many scenarios, view the exposure profiles of a particular counterparty.

Load the data (ccr.mat) that contains the mark-to-market contract values for a portfolio of swaps over many scenarios.

load ccr.mat

Compute the exposure by counterparty.

[exposures, expcpty] = creditexposures(values,swaps.Counterparty,...

Compute the credit exposure profiles for all counterparties.

 cpProfiles = exposureprofiles(simulationDates,exposures)
cpProfiles=5×1 struct array with fields:

Visualize the exposure profiles for a particular counterparty.

cpIdx = find(expcpty == 4);
numDates = numel(simulationDates);
        simulationDates,cpProfiles(cpIdx).MPFE * ones(numDates,1),...
        simulationDates,cpProfiles(cpIdx).EPE * ones(numDates,1),...
        simulationDates,cpProfiles(cpIdx).EffEPE * ones(numDates,1));
legend({'PFE (95%)','Max PFE','Exp Exposure (EE)',...
        'Time-Avg EE (EPE)','Max past EE (EffEE)',...
        'Time-Avg EffEE (EffEPE)'})
title(sprintf('Counterparty %d Exposure Profiles',cpIdx));
ylabel('Exposure ($)')
xlabel('Simulation Dates')

Input Arguments

collapse all

Simulation dates, specified as vector of date numbers or a cell array of character vectors in a known date format. For more information for known date formats, see the function datenum.

Data Types: double | char | cell

3-D array of potential losses due to counterparty default on a set of instruments simulated over a series of simulation dates and across many scenarios, specified as a NumDates-by-NumCounterParties-by-NumScenarios “cube” of credit exposures. Each row represents a different simulation date, each column a different counterparty, and each “page” is a different scenario from a Monte-Carlo simulation.

Data Types: double

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: profilestructs = exposureprofiles(dates,exposures,'ProfileSpec','PFE','PFEProbabilityLevel',.9)

Exposure profiles, specified as a character vector or cell array of character vectors with the following possible values:

  • EE — Expected Exposure. The mean of the distribution of exposures at each date. A [NumDates-by-1] vector.

  • PFE — Potential Future Exposure. A high percentile (default 95%) of the distribution of possible exposures at each date. This is sometimes referred to as “Peak Exposure.” A [NumDates-by-1] vector.

  • MPFE — Maximum Potential Future Exposure. The maximum potential future exposure (PFE) over all dates

  • EffEE — Effective Expected Exposure. The maximum expected exposure (at a specific date) that occurs at that date or any prior date. This is the expected exposure, but constrained to be nondecreasing over time. A [NumDates-by-1] vector.

  • EPE — Expected Positive Exposure. The weighted average over time of expected exposures. A scalar.

  • EffEPE — Effective Expected Positive Exposure. The weighted average over time of the effective expected exposure (EffEE). A scalar.

  • All — Generate all the previous profiles.


Exposure profiles are computed on a per-counterparty basis.

Data Types: char | cell

Level for potential future exposure (PFE) and maximum potential future exposure (MPFE), specified as a scalar with value [0..1].

Data Types: double

Output Arguments

collapse all

Structure of credit exposure profiles, returned as an array of structs holding credit exposure profiles for each counterparty, returned as a struct, with the fields of the struct as the (abbreviated) names of every exposure profile. Profiles listed in the ProfileSpec (and their related profiles) are populated, while those not requested contain empty ([]). profilestructs contains the dates information as a vector of MATLAB® date numbers requested in the ProfileSpec argument.


[1] Basel II: International Convergence of Capital Measurement and Capital Standards: A Revised Framework - Comprehensive Version. at, 2006.

Version History

Introduced in R2014a

See Also