Home   >   User Resources   >   Online Help   >   apaBonds.Simulate.TotalReturns
 

 

Function index Version 3.0.0

apaBonds.Simulate.TotalReturns(nScenarios, HorizonYears, Yields, Durations, Convexities, CreditBuckets, BucketBetas, FactorVols, FactorCorrels, Issuers, StressProbability, StressVolMultiplier, StressMeanShifts, StressFactorCorrels, IssuerVol, SpreadDurations, IdioVols, PDs, LGDs, SlopePivotDuration, Seed)

Excel=apaBonds.Simulate.TotalReturns(nScenarios, HorizonYears, Yields, Durations, Convexities, CreditBuckets, BucketBetas, FactorVols, FactorCorrels, Issuers, StressProbability, StressVolMultiplier, StressMeanShifts, StressFactorCorrels, IssuerVol, SpreadDurations, IdioVols, PDs, LGDs, SlopePivotDuration, Seed)

Result

Simulates bond total return scenarios over a horizon in one step: it simulates the common factors as apaBonds.Simulate.Factors and reprices the bonds on them as apaBonds.TotalReturns.FromFactors. The result is a nScenarios x nBonds matrix of simple total returns in decimals, one row per equally likely scenario and one column per bond, typically used as input of the mean-CVaR optimization (e.g. apaMeanCVaR.Restricted.Bounded.Axb.Frontier).

Syntax

nScenarios: number of scenarios

HorizonYears: horizon in years, e.g. 1/12 for monthly returns

Yields: nBonds annual yields in decimals, as a row or column

Durations: nBonds modified durations, as a row or column

Convexities: nBonds convexities, or one value for all bonds

CreditBuckets: nBonds credit bucket labels looked up in BucketBetas, or nBonds numeric spread betas if BucketBetas is empty

BucketBetas: two-column table with bucket label and beta to the market spread factor; leave the argument empty if CreditBuckets contains the betas

FactorVols: 3 annualized volatilities in decimals of the level, slope and market spread factor

FactorCorrels: optional 3 x 3 factor correlation matrix in normal scenarios; default: identity matrix

Issuers: optional nBonds issuer labels; bonds of the same issuer share issuer shocks and defaults; default: every bond is its own issuer

StressProbability: optional probability of a stress scenario; default: 0

StressVolMultiplier: optional volatility multiplier in stress scenarios; default: 1

StressMeanShifts: optional 3 mean shifts of level, slope and market spread in stress scenarios (changes over the horizon); default: 0, 0, 0

StressFactorCorrels: optional 3 x 3 factor correlation matrix in stress scenarios; default: FactorCorrels

IssuerVol: optional annualized volatility of the issuer spread shocks; default: 0

SpreadDurations: optional nBonds spread durations, or one value; default: Durations

IdioVols: optional nBonds annualized idiosyncratic spread volatilities, or one value; default: 0

PDs: optional nBonds annual default probabilities, or one value; default: 0

LGDs: optional nBonds losses given default, or one value; default: 0.6

SlopePivotDuration: optional duration at which the slope factor has no effect; default: average of Durations

Seed: optional integer seed; default: 1

Algorithm

The function runs the complete scenario generation process:

1. Factor scenarios: for each scenario, draw the regime (stress with probability StressProbability), draw the correlated level, slope and market spread changes with the volatilities, correlations and mean shifts of that regime, and draw one spread shock per distinct issuer. The number of issuer shocks equals the number of distinct labels in Issuers (or the number of bonds if Issuers is omitted). The factor random numbers use Seed. See apaBonds.Simulate.Factors for the formulas.

2. Bond repricing: for each scenario and bond, compute the rate change from level and slope, the spread change from the market spread (times the bucket beta), the issuer shock and the bond noise, and the total return from carry, duration, spread duration and convexity; apply defaults if PDs are given. The noise and default random numbers use Seed + 1. See apaBonds.TotalReturns.FromFactors for the formulas.

Rs,i=yih−DiΔrs,i−SDiΔcs,i+12Ci(Δrs,i+Δcs,i)2R_{s,i} = y_{i}\, h - D_{i}\,\Delta r_{s,i} - {SD}_{i}\,\Delta c_{s,i} + \frac{1}{2}\, C_{i}\left( \Delta r_{s,i} + \Delta c_{s,i} \right)^{2}

3. Output: the nScenarios x nBonds matrix of total returns. The factor scenarios themselves are not returned; use the two-step route if you want to analyze them.

The result is identical to apaBonds.Simulate.Factors with Seed and nIssuers = number of distinct issuers, followed by apaBonds.TotalReturns.FromFactors with Seed + 1, so the one-step and two-step routes can be used interchangeably.

Remarks

Example: =apaBonds.Simulate.TotalReturns(600, 1/12, Yields, Durations, Convexities, Ratings, BucketBetas, {0.015, 0.008, 0.006}, CorrNormal, Issuers, 0.1, 2, {-0.0015, 0.0005, 0.0015}, CorrStress, 0.004, , 0.002, , , , 145) returns 600 monthly scenarios for all bonds, with a stress regime in 10% of the scenarios, issuer shocks, bond-specific noise and no defaults. The workbook ApaLibExample_BondTotalReturnSimulation.xlsx contains this setup, the two-step route, summary statistics by bond and regime, checks, and the mean-CVaR efficient frontier on the simulated scenarios with duration, issuer and high-yield constraints.

Practical guidance: use enough scenarios for the tail measure you optimize; with 600 scenarios and a 95% confidence level, CVaR is the average of the 30 worst scenarios. Keep the seed fixed while comparing portfolios or constraints, so that differences are not caused by different random numbers, and vary the seed to assess the sampling uncertainty of the results.