Code covered by the BSD License  

Highlights from
Modeling Variable Annuities with MATLAB

image thumbnail

Modeling Variable Annuities with MATLAB

by

 

This demo shows how to price variable annuity product (Guaranteed Minimum Withdrawal Benefit)

GMWB Demo

GMWB Demo

This demo shows how to price a GMWB rider. Yi Wang, MathWorks, 2010

Contents

Set up parameters

close all; clear all; clc;

% AnnualFee, Risk Free Rate and Annual Withdrawal Rate
annualFee = 0.005;
rfr = 0.05;
annualWithdrawalRate = 0.07:0.01:0.10;

% Investment Portfolio
EP.Ticker = {'MMM', 'AA', 'AXP', 'T', 'BAC', 'BA', 'CAT', 'CVX', 'CSCO', 'KO'};

% Range for historical data.
EP.FromDate = '01/01/2000';
EP.ToDate = '01/01/2010';
EP.Period = 'm';

% Assuming we're holding 10 shares of each stock in our investment
% portfolio
EP.Holdings = 10*ones(length(EP.Ticker), 1);

Price GMWB

Price GMWB contract

tic;
for i = 1:length(annualWithdrawalRate)
va = GMWB(annualWithdrawalRate(i), annualFee, rfr, EP, [], []);
va.price();
end
toc;
Elapsed time is 26.100099 seconds.

Run the following script to generate data for a cost surface

Set up grids for surface fitting tool PLEASE NOTE that data contained in cost.mat is not the same as those generated above. No real data was used to generated data in cost.mat. We used a theoretical case of one stock with 10% withdrawal rate

load cost.mat

[initSAGrid, IGWBGrid] = meshgrid(initSA, IGWB);

initSAGrid = reshape(initSAGrid, numel(initSAGrid), 1); % Y-axis
IGWBGrid = reshape(IGWBGrid, numel(IGWBGrid), 1); % X-axis
costGrid = reshape(cost', numel(cost), 1); % Z-axis

Open sftool

Load init_SA as Y, IGWB_grid as X and cost_grid as Z Set Axis Limit from 10 to 0 Fit with Lowess and Quadratic Polynomial Generate M-file

[fittedModel, ~] = createSurfaceFit(IGWBGrid, initSAGrid, costGrid);

Plot delta

[~, delta] = differentiate(fittedModel, IGWBGrid, initSAGrid);
[fittedModelDelta, ~] = createSurfaceFit(IGWBGrid, initSAGrid, delta);

Contact us