Integrated Value-at-Risk Modeling
 | Download
this example as a Mathematica notebook. |
To demonstrate some useful features of Mathematica's design, we
turn to Benninga and Wiener's short paper on Value-at-Risk (VaR), the modern
risk-measuring index. VaR is defined as the lowest quantile of the
potential losses that can occur within a given portfolio during a specific
time period. The time period T and the confidence level q are
the two major parameters, which are chosen carefully and are dependent
upon the goal of the risk management (regulatory reporting, corporate risk
management, etc.). For example, suppose that a portfolio
manager has a daily VaR equal to $1 million at 1%. This means that, assuming
normal market conditions, there
is only one chance in a hundred that there will be a daily loss bigger than $1
million. While this problem can be easily
stated, finding a solution can frequently be computationally difficult.
The Single Asset Problem: Loading Mathematica
Packages and Constructing a Model
First, we load the relevant add-on packages and use Mathematica to
find the 5% VaR of $100 million invested in a single asset, lognormally distributed
with expected return of 10% and variance of 30%. This is stated formally
below (Hull, 2000).
![[Graphics:Images/var_gr_1.gif]](images/var_gr_1.gif)
![[Graphics:Images/var_gr_2.gif]](images/var_gr_2.gif)
![[Graphics:Images/var_gr_3.gif]](images/var_gr_3.gif)
![[Graphics:Images/var_gr_4.gif]](images/var_gr_4.gif)
In other words, there is a 5% chance that $100 million invested in this single asset
will lose more than $35,496,800.
Accounting for Correlations: Matrix Algebra with Mathematica
Of course, real portfolios have more than one asset. One key difficulty in
modeling the behavior of portfolios with more than one asset is measuring, and
then accounting for, correlations in the movement of asset
prices. The above model is now generalized to accommodate three
assets, the prices of which are lognormally distributed (meaning that returns
are normally distributed).
Portfolio size = $100 million
Portfolio allocation = x = = ![[Graphics:Images/var_gr_8.gif]](images/var_gr_8.gif)
Mean returns = mu = ![[Graphics:Images/var_gr_9.gif]](images/var_gr_9.gif)
Variance-covariance = S =
This program will work in three pieces. First, some preliminary
definitions are made.
![[Graphics:Images/var_gr_11.gif]](images/var_gr_11.gif)
![[Graphics:Images/var_gr_12.gif]](images/var_gr_12.gif)
![[Graphics:Images/var_gr_13.gif]](images/var_gr_13.gif)
![[Graphics:Images/var_gr_14.gif]](images/var_gr_14.gif)
Then we can add some numerical data and recalculate the portfolio's expected
return and variance.
![[Graphics:Images/var_gr_15.gif]](images/var_gr_15.gif)
![[Graphics:Images/var_gr_16.gif]](images/var_gr_16.gif)
![[Graphics:Images/var_gr_17.gif]](images/var_gr_17.gif)
![[Graphics:Images/var_gr_18.gif]](images/var_gr_18.gif)
Bringing Everything Together: Writing Mathematica
Functions
Finally, all of the pieces above are combined to write the new multivariate VaR for the portfolio.
![[Graphics:Images/var_gr_19.gif]](images/var_gr_19.gif)
We can now look at VaR calculations for 1%, 5%, and 10%.
![[Graphics:Images/var_gr_20.gif]](images/var_gr_20.gif)
![[Graphics:Images/var_gr_21.gif]](images/var_gr_21.gif)
Given the stated parameters, we can say that for a one-year horizon, there
is a
1% chance of losing more than $177 million, a 5% chance of losing more than $151 million,
and a 10% chance of losing more than $137 million.
The Next Step: Databases, Monte Carlo Simulations, and Building a Real
System
While these two problems demonstrate the basic setup of a VaR
calculation in Mathematica, modeling of real-world returns requires
more-involved calculations of the asset correlations from empirical
data. Benninga and Wiener's paper delves more deeply into this
process, including the techniques of risk mapping, historical simulation,
variance-covariance techniques, and the Monte Carlo
approach. Interested readers are strongly encouraged to
download this and other white papers. To assist in the implementation of
Mathematica in your firm, Wolfram Research Account Executives can
recommend Mathematica consultants in your region, tools to link
Mathematica to your database, and tools to value derivative
instruments.
Note: All of the code used in this example was
modified from the
article "Value-at-Risk (VaR)" by Simon Benninga and Zvi Wiener.
The article is a more thorough introduction to this subject and may be
downloaded in PDF file format from http://finance.wharton.upenn.edu/~benninga/wiener.html.
|