Beyond Excel – MATLAB

Many financial analysts develop models using Excel; it is easy, flexible and powerful. However, as time goes by, some of these models become sophisticated, unstable or take forever to run. These models have reached Excel’s limits and it may be time to migrate the models to a more flexible and powerful tool, i.e. MATLAB.

What is MATLAB?

Just like Excel, MATLAB has its own financial functions, development environment, and high level programming language but you will soon find out MATLAB is much more advanced; it allow us to develop more challenging financial models in a more effective manner.

Financial Libraries

Excel 2010 only has about 50 simple financial functions but MATLAB provides a huge set of financial libraries:

  • Financial Toolbox – estimate risk, analyze interest rate levels, price equity and interest rate derivatives, and measure investment performance
  • Financial Derivatives Toolbox – analyze and model equity and fixed-income derivatives and securities contingent on interest rates
  • Fixed-Income Toolbox – calculate price, rates, and sensitivities for interest rate swaps, credit default swaps, bond futures, and convertible bonds
  • Econometric Toolbox – provides Monte Carlo methods for simulating systems of linear and nonlinear stochastic differential equations.

These MATLAB toolboxes can handle very demanding financial models, e.g. asset allocation, cash flow analysis, portfolio optimization, credit default swap valuation, or using the GARCH, Heath-Jarrow-Morton, Black-Derman-Toy, or Black-Karasinski models to price assets or measure interest rate sensitivity. This is just the tip of iceberg.

However, the most important feature is that MATLAB gives us the source code so we can customize it according to our own requirements. Instead of building the financial models from scratch, we can jump start using existing MATALB functions. How quick we can build a model on Excel to calculate option-adjusted spread? Days? Weeks?

High Performance Computing (HPC)

Have you tried to run stochastic models on Excel? It would take you days, weeks or even months to process; this is why Microsoft come up with HPC Services for Excel. However, it requires expensive server hardware / software and special cluster safe functions.

MATLAB’s answer to HPC is much simpler and more powerful. it has 2 different toolboxes to handle the most demanding models:

We don’t need expensive server infrastructure; I managed to increase my model’s performance by nearly 350% on my Dell quad core desktop and over 6 times with a $300 video card. If I need significant more power, I can upload my model to Amazon Elastic Compute Cloud (Amazon EC2) – Cluster GPU. It is much easier to scale up the performance in MATLAB.

And even with single core, MATLAB can process much faster than VBA because MATLAB supports native matrix manipulation.

And more…

Apart from financial libraries, MATLAB also has other advanced mathematical and statistical packages. It supports object oriented programming language and we can use its profiler to identify where the bottleneck is. We can deploy our models to other environments, e.g. Java, .NET and even Excel. It is also very easy to use.

The bottom line is if your financial models have reached Excel’s limit and you are looking for something beyond Excel, then you would find MATLAB a very good alternative!

About Andrew Chan
Andrew Chan is an Business Consultant who gives you accurate, consistent and timely information so that you can make better and faster decisions. He is an Associate of Society of Actuaries with over 20 years of IT experience. Apart from strong analytical skills and proven technical background, he was also a former system director at Manulife who had extensive project management experience. If you are looking for someone to gather, consolidate, validate, visualize and analyze data, look no further! Andrew can provide the most cost effective business analytics solution so that you can explore, optimize, predict and visualize your business. Don’t guess on any decision, no matter it is finance, operation, marketing or sales! Always ask for evidence!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: