Multivariate Distributions In Maple
with applications in Finance
Igor Hlivka
MUFG Securities International
LONDON
The document demonstrates the extension of Maple's comprehensive Statistical package into multivariate setting. It shows how Maple's symbolic analytics and numerical engines can be seamlessly applied in the field of multivariate statistics. The core concept of multivariate analysis - joint distributions - are discussed in the context of multivariate Normal distribution and particular aspects of "jointness" are presented through marginal and conditional densities. Extension of multinormality into related family of joint distributions is shown on the example of multivariate Student-t distribution.
Application of multivariate analysis is demonstrated in the field of Finance, however many other fields and branches can be naturally explored and tested with the presented set up.
The Multivariate Normal Distribution
Similar to the univariate setting, the core concept of mutivariability resides on the Normal Distribution.
For a given vector of random variables `(X[1], X[2], () .. X[n])" align="center" border="0"> we define the Multivariate Normal Distribution as with mean vector `(mu[1], mu[2] .. mu[n])" align="center" border="0"> and variance-covariance matrix Σ.
The probability density then can be defined as:
where is a vector of real-valued random variables on n-length and Σ is a symmetric and positive definite variance-covariance matrix of size. The function fully resembles the "familiar" univariate Normal PDF, and indeed with , the above formula reduces to the univariate density function.
We build the in several steps:
The Bivariate Normal Distribution
We will first demonstrate the implementation in the bivariate setting:
This is the desired Bivariate Normal PDF with mean vector M and covariance matrix CoVar.
We can obtain the standardized version of the density by setting the mean vector to 0 and variance to 1
The Bivariate CDF can be obtained by integrating the PDF up to a given limit, however the outer integral has be to be computed numerically
Now we can compute various expectations:
Once the join PDF has been defined, we can compute Marginal and Conditional densities
Marginal PDF: (x) =
Conditional PDF of
We can define the multivariate Moment Generating Function as the expectation of the vectors product
Multivariate MGF:
We can now compute product moments (the first and the second) using MGF
One can verify that the first moment is the same as the product expectation EV[3] calculated above
Graphics
We will present some graphical representation of densities defined above:
Bivariate Standard PDF will exhibit different shapes depending on the correlation coefficient
This is a Conditional Expectation for x[1]=1..2
The Trivariate Normal Distribution
We can extend the Bivariate PDF for a higher dimension
We will simplify the covariance matrix, knowing that symmetric matrix
At the same time, we will introduce the Trivariate Standard Normal PDF
Maple can handle this complex computational task quite easily...
We can now use the Trivariate Standard density to calculate expectations:
Foe example:
The expectation in this example is a function of single correlation coefficient:
Expectations in trivariate setting are generally more complex and they may exist only for certain set of parameters. One of the restrictions will apply to covariance matrix which by definition must be positive definite.
The Multivariate Student-t Distribution
We will now show how simple transformation argument leads to an elegant solution for the multivariate Student-t density.
We assume that `(X[1], X[2], () .. X[n])" align="center" border="0">is a vector of random variables drawn from multivariate normal distribution and let other RV Y be a Chi-Square-distributed quantity with the degree of freedom ν: independent of
Then the joint density of and Y is:
This relationship then determined the multivariate Student-t distribution with the vector: `(t[1], t[2], () .. t[n])" align="center" border="0">and the correlation matrix Σ:
The Bivariate Student-t Distribution
We will demonstrate the above theory in bivariate setting.
Since both and Y and independent, we can obtain the joint density of by simple multiplication of Bivariate Normal and Chi-Square densities
Then the joint PDF can be expressed as:
We now want to transform this PDF product into a Student-t quantities:
This is the transformed density expressed in terms of t-parameters:
We will now obtain the bivariate t-density by integrating the above density over y
The crude integration des not work due to ambiguity of the integrand in the exponential term
Noting that the term is negative, we can integrate with this assumption
We can verify and examine the negativity of the exponent term visually:
As chart shows, the expterm will always stay negative, hence the integration with the negativity assumption is acceptable
This is the desired Bivariate Student-t density
We can plot it
Application in Finance
We now demonstrate how multivariate analysis can be applied in problems solving arising in Financial Economics.
Two particular cases will be reviewed here:
Formal derivation of the hedging concept
Hedging is a transactional process that aims to minimize the risk of the trader's activity. In short, hedging typically refers to the risk offsetting. The risk can be associated with a single transaction (the trade risk) or a number of individual transactions (portfolio risk).
Following trader's activity (buying or selling of financial product), an institution ends up with the position which value can be formally described as:
where: A = amount and represents a risky financial product where price changes follow a Normal Distribution:
To eliminate the fluctuation in the value of the position, an institution considers hedging programme, i.e. taking position in different instrument - say - in order to eliminate the risk.
The task is to determine the quantity of hedging instrument - say amount B - that minimizes the value fluctuation of the original transaction.
We assume that the hedging instrument is a financial product that similar to follows a Normal Distribution. Once the quantity is added to the original transaction, the risk is not any longer univariate (two instruments now constitute a mini-portfolio), but now is governed by a bivariate normal distribution
To present this case formally:
The reader can see that we have computed the portfolio variance by the formula:
Given our objectives, we want to minimize the portfolio's risk, i.e. variance. Although Maple's Optimization routines can be used here, we will apply step-by-step procedures to derive this result explicitly.
We will:
This is the solution to our problem - we have determined the quantity B = that needs to added to the existing position A to minimize the risk.
The B quantity will be:
We still need to verify that this is the minimum (rather than maximum)
The standard condition for minimizations problems stipulates that
The seconded derivative of the portfolio's variance - MinTest is always positive, so adding the quantity B shown above is indeed the solution to our minimization exercise.
As seen from above, the efficiency of the hedging is a function of three variables: volatility of individual assets and the correlation between the two instruments.
How sensitive is the this amount to the functional input?
Spread Options
Spread options naturally arise in Finance when optionality on future value is taken w.r.t two assets. Spread in finance is usually defined as a difference between the two quantities and can be expressed in terms of difference in (i) prices, (ii) yields, (iii) rates or (iv) spreads themselves (eg. credit spreads).
Spreads options are designed and traded to manage future expectations of assets behavior and allow monetisation of a particular view on their direction and dependency
Mathematically, spread options are class of truncated expectations where the expectation is taken w.r.t joint distribution of two instruments in the defined bivariate space.
To value the spread option, we will define:
The formula above is the "adjusted"payoff of the Call Spread Option in the raw format. It differs from the standard notation by having the usual Max(0.....) notation removed, since we will value this option by taking the discounted expectation of the payoff function over the "eligible" positive domain.
The trick to value an option in bivariate setting is to determine the correct limits of integration for each stochastic variable. We will achieve this in three steps:
This is the required critical threshold
This is the desired Call Spread Option expression - a discounted expectation w.r.t bivariate standard normal density with correlation ρ. The discounting is performed with the DF expression outside the integral.
Maple returns a semi-analytical result that, unfortunately, cannot be evaluated symbolically any further, so we need to resort to numerical routines, which Maples handles with ease.
All we need is to assign numerical values to each parameter and numerically integrate:
We use the particular case:
Here we are valuating a call option that pays the unit of currency (i.e. $1 or ?1 ) if in one year from now the S - U > 0.20% (irrespective of the fact that today U > S)
This is the Call Option Premium obtained numerically.
Now, what is the sensitivity of the option premium w.r.t functional input?
Although we have computed the value numerically, this does not impact Maple's productivity or efficiency:
For example, we can compute the option's sensitivity w.r.t. each underling rate - the deltas for S and U
What do these values mean?
Maple can be equally efficient in computing any other desired comparative static - gamma (2nd derivative w.r.t rate), vega (derivative w.r.t sigma) etc.
Reader can verify that in the spread option case, the sensitivity set increases by the factor of two - we will have two deltas, two gammas etc.
At the same time, for example, we can visualize the impact of a certain parameter - such as correlation- on the call option premium computed above:
As seen from the chart, the option premium will increase when the correlation gets lower and will gradually decrease as the correlation increases - as expected. The curvature on the graph also reveals that the relationship between the premium and the correlation is non-linear.
Conclusion
This short presentation shows the ways how Maple's univariate statistical analysis can be easily extended into multivariate platform. The centered focus resides on the Multivariate Normal Distribution that with the help of suitable transformation can be turned into other multivariate distributions.
Two particular examples from Finance demonstrate the advantages of using CAS platforms in applied multivariate analysis. Maple, as the above examples highlight, is well suited and flexible to handle these tasks well.
Legal Notice: The copyright for this application is owned by the author(s). Neither Maplesoft nor the author are responsible for any errors contained within and are not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact the author for permission if you wish to use this application in for-profit activities.