Docsity

Workshop on Financial Simulation, Appunti di Matematica Finanziaria

Anteprima parziale del testo

Scarica Workshop on Financial Simulation e più Appunti in PDF di Matematica Finanziaria solo su Docsity!

Do not circulate Gianluca Broll – University of Trento

WORKSHOP ON

FINANCIAL

SIMULATION

(Prof. Marco Bee)

Broll Gianluca

University of Trento

  • DISTRIBUTIONS Table of Contents
      1. NOTATION AND DESCRIPTIVE FUNCTIONS OF DISTRIBUTION
      1. MAIN DISTRIBUTION OTHER THAN NORMAL
      • 2.1 Uniform distribution
      • 2.2 Geometric Distribution
      • 2.3 Lognormal Distribution
      1. TRUNCATED DISTRIBUTION
      • 3.1 Truncated Normal Distribution
      • 3.2 Truncated Beta Distribution
      1. PARETO DISTRIBUTION AND GENERALIZED PARETO
      • 4.1 Pareto Distribution................................................................................................................................................
      • 4.2 Generalized Pareto Distribution
      1. DISTRIBUTION MOMENTS
      • 5.1 Third Moment: Skewness......................................................................................................................................
      • 5.2 Fourth Moment: Kurtosis
  • INTEGRALS DETERMINATION
      1. EXACT METHOD
      1. QUADRATURE METHOD
      1. MONTE CARLO METHOD
      • 3.1 Monte Carlo Estimator Properties: Unbiasedness and Variance........................................................................
      • 3.2 Monte Carlo Estimator Properties: Consistency
      • 3.3 Monte Carlo Estimator Properties: Asymptotic Normality
      • 3.4 How to Select the Auxiliary Distribution
      • 3.5 How to Decide the Sample Size...........................................................................................................................
      • 3.6 Warnings on Monte Carlo Estimator
      1. IMPORTANCE SAMPLING
  • GENERATING RANDOM VARIABLES
      1. INTRODUCTION TO RANDOM NUMBERS...................................................................................................................
      • 1.1 The Modulo Operator
      • 1.2 The Congruential Generator
      1. DISCRETE RANDOM VARIABLES
      • 2.1 Inverse Distribution Function
      • 2.2 Acceptance-Rejection Method............................................................................................................................
      1. CONTINUOUS RANDOM VARIABLES
      • 3.1 Inverse Distribution Method
      • 3.2 Acceptance-Rejection Method............................................................................................................................
      1. THE MULTIVARIATE NORMAL DISTRIBUTION
      • 4.1 Definition and Properties
      • 4.2 Simulations
  • SIMULATING STOCHASTIC PROCESSES
      1. RANDOM WALK
      • 1.1 Definition
      • 1.2 Properties
    • 2.BROWNIAN MOTIONS
      • 2.1 Standard Brownian Motion (Wiener Process)
      • 2.2 Generalized Brownian Motion
      • 2.3 Itô’s Process and Geometric Brownian Motion
  • APPLYING SIMULATION IN PRACTICE
      1. OPTIONS PRICING
      • 1.1 A Brief Recap on Options
      • 1.2 A First Simulation Approach
      • 1.3 Pricing a Lookback Option
      • 1.4 Barrier Options....................................................................................................................................................
      1. RISK MANAGEMENT
      • 2.1 Scenario Analysis (Stress Testing)
      • 2.2 Value at Risk
      • 2.3 Expected Shortfall
  • EXTREME VALUE THEORY....................................................................................................................................
      1. MOTIVATIONS............................................................................................................................................................
      1. THE THEORY
      • 2.1 Generalized Extreme Value CDF
      • 2.2 Generalized Pareto Distribution
      • 2.3 Parameters Estimator
      1. CONCLUSIONS............................................................................................................................................................
  • PORTFOLIO CREDIT RISK
      1. THE TOPIC
  • THE POISSON PROCESS
      1. INTRODUCTION..........................................................................................................................................................
      1. THE MODEL
      1. THE PROCESS..............................................................................................................................................................
      • 3.1 Compound Poisson Process

Normal Quantile Function tells us the quantile associated with a given probability, is thus the inverse

of Normal CDF: we can determine the quantile associated with a given probability by means of the

Quantile Function. Analytically:

𝛼

− 1

2

𝛼

2

𝑥

𝛼

−∞

2. MAIN DISTRIBUTION OTHER THAN NORMAL

2.1 Uniform distribution

A random variable is said to follow a uniform distribution in the interval [a, b] if all the values

between a and b have the same probability. Analytically:

The Probability Density Function has the following form:

While the Cumulative Distribution Function takes the following form:

The interval [a, b] is called support.

Normal Quantile Function

Distributions

Do not circulate Gianluca Broll – University of Trento

If the support is [0, 1] , the CDF takes the following form:

2.2 Geometric Distribution

The Geometric Distribution is related to the Binomial, which is in turn related to the Bernoulli

distribution. If we have n random variable each following a Bernoulli distribution:

𝑖

Then a Binomial is:

𝑖

𝑛

𝑖= 1

Thus, a Binomial with parameter n and p is the sum of n Bernoulli variables with a probability p of

success. The Geometric Distribution starts from here and gives us information about the likelihood

of needing k trials before getting the first success. Because we are dealing with discrete variables

(success/not success), the PDF takes the name of Probability Mass Function. We are interested in

determining the Probability Mass Function of y i

(the number of trials need to get the first success).

2

k ( 1 − 𝑝

𝑘− 1

The table shows the passages needed to describe the Probability Mass Function. The logic is the

following: the probability of having the first success at the first attempt is equal to p ; the probability

of having the first success at the second attempt is:

1

2

Because of the i.i.d. the probability of the interception is the product of the probability, thus:

1

2

1

2

Thus, generalizing we get the Probability Mass Function of the Geometric Distribution:

𝑘− 1

Distributions

Do not circulate Gianluca Broll – University of Trento

To derive the Probability Distribution Function, we exploit its relationship with CDF indicated above:

𝑌

𝑌

ln 𝑦 − 𝜇

ln 𝑦 − 𝜇

ln 𝑦 − 𝜇

Explicating the Standard Normal PDF we obtain:

𝑌

−

1

2

(

ln 𝑦−𝜇

𝜎

)

2

ln 𝑦 − 𝜇

−

1

2

(

ln 𝑦−𝜇

𝜎

)

2

Which is commonly written as:

𝑌

−

1

2

(

ln 𝑦−𝜇

𝜎

)

2

Knowing the PDF, obtaining the CDF means to determine the following integral:

𝑌

𝑌

𝑦

−∞

3. TRUNCATED DISTRIBUTION

A random variable is said to follow a truncated distribution if it support does not coincides

with ℝ, but with a portion of it. For example, a normal variable x is normally distributed on the

support [−∞, +∞]. A truncated distribution describes a random variable that has a distribution only

for value above a certain threshold, below a certain threshold or between a certain interval. In other

words, a truncated distribution is obtained restricting the domain of some other distribution.

3.1 Truncated Normal Distribution

A normal truncated distribution describes a variable which is normally distributed on a

restricted domain. For example, imagine that a random variable is normally distributed only for

values greater than t. Graphically, this means:

How can we can write the PDF of such distribution? A first attempt could be to write:

𝑌

−

1

2

(

𝑦−𝜇

𝜎

)

2

This makes sense, but it does not work, a correct PDF must ensure that it integral is equal to one.

Because the integral from t to infinity is:

𝑌

+∞

𝑡

2

It is obvious that this is not the proper PDF. Exploiting this result, we can write:

𝑌

2

−

1

2

(

𝑦−𝜇

𝜎

)

2

To evaluate whether this is the correct form, we can determine the integral, which is:

𝑌

+∞

𝑡

2

−

1

2

(

𝑦−𝜇

𝜎

)

2

+∞

𝑡

2

−

1

2

(

𝑦−𝜇

𝜎

)

2

+∞

𝑡

2

2

Thus, for a normal truncated distribution on the support [a, b] , the following equation holds:

𝑌

2

2

2

Graphically:

4. PARETO DISTRIBUTION AND GENERALIZED PARETO

4.1 Pareto Distribution

The Pareto distribution is very useful to model the tail, for this reason it is frequently used

in the financial models. It is described by two parameters: shape (𝛼) and scale (𝑥 𝑚𝑖𝑛

). The Probability

Density Function is:

𝑚𝑖𝑛

𝑚𝑖𝑛

𝛼

𝛼+ 1

𝑚𝑖𝑛

While the Cumulative Distribution Function is:

𝑚𝑖𝑛

𝑚𝑖𝑛

𝛼

𝑚𝑖𝑛

We can define the Survival function that, setting 𝜅 = 𝑥

𝑚𝑖𝑛

𝛼

, it has the following form:

𝑚𝑖𝑛

𝛼

−𝛼

Which is one of the most important examples of Power-low distribution. The higher is the shape

parameter, the slower is the decay rate.

The moment r-th of Pareto distribution can be obtained by means of the following formula:

𝑟

𝑚𝑖𝑛

𝑟

4.2 Generalized Pareto Distribution

The Generalized Pareto Distribution is a three parameters distribution with a Cumulative

Distribution Function equal to:

𝑚𝑖𝑛

𝑚𝑖𝑛

−

1

𝜉

−

𝑥−𝑥

𝑚𝑖𝑛

𝜎

𝑖𝑓 𝜉 = 0

With a support of:

𝜉,𝜎,𝑥

𝑚𝑖𝑛

𝑚𝑖𝑛

𝑚𝑖𝑛

𝑚𝑖𝑛

Distributions

Do not circulate Gianluca Broll – University of Trento

Where 𝜉 is a tail index (shape parameter), 𝜎 is the scale parameter and 𝑥

𝑚𝑖𝑛

is the location. The

Density Function in case of 𝜉 ≥ 0 , is:

𝑚𝑖𝑛

𝑚𝑖𝑛

−

1

𝜉

− 1

{ 𝑥≥𝑥 𝑚𝑖𝑛

}

The Pareto Distribution PDF can be obtained by the Generalized Pareto Distribution one by

means of a reparameterization. If we set:

𝑚𝑖𝑛

𝑚𝑖𝑛

We obtain precisely the Probability Distribution Function of the Pareto Distribution.

5. DISTRIBUTION MOMENTS

Usually, we are more focused on the expected value and the variance of a random variable,

which are, respectively, the first and the second moment. In simulation for risk management

purposes, but even for a more complete description of a distribution, we are interested also in the

following two moments: skewness and kurtosis.

5.1 Third Moment: Skewness

The skewness gives us information about the symmetry of a distribution. If the distribution

is symmetric, all the odd moments of the distribution are nil. Analytically, the third moments is:

3

Where 𝜇 = 𝐸

and 𝜎 = √𝑉𝑎𝑟(𝑋). Its sample counterpart is determined in the usual way, i.e.:

𝑖

3

𝑛

𝑖= 1

5.2 Fourth Moment: Kurtosis

The fourth moment gives us information about the heaviness of the tails of a distribution.

The higher the kurtosis is, the heavier are the tails. The kurtosis of a normal random variable is

always 3, regardless of the value of means and variance. When the kurtosis is grater that 3, the

distribution is said to be leptokurtic. Analytically:

4

Do not circulate Gianluca Broll – University of Trento

INTEGRALS DETERMINATION

Determining an integral means calculating the area under a function (in any dimension).

Which means that can be determined in the one dimension, two, three, and so on. Analytically, we

indicate the integral by:

𝑏

𝑎

Graphically (for a one-dimension function):

Graphically (for a two-dimensions function):

Which is a double integral.

There are several methods to determine the integral of a function, in the following

paragraph they will be briefly presented.

𝐼 = ∫ 𝑓(𝑥)𝑑𝑥

𝑏

𝑎

1. EXACT METHOD

The more precise is the exact one, i.e. the exact solution. If it is possible to easily obtain a

primitive, then the integral determination is trivial. The challenges come when this type of

resolution is not available. The exact method is used for simple function, i.e. for those function

whose primitive is easy to find:

′

𝑏

𝑎

2. QUADRATURE METHOD

This method is an approximation, in fact the integral is determined as the sum of n rectangles

that have as height the value of the function and a very small base. Obviously, for n that tends

toward infinite, this approximation gives the exact value of the integral. The following graph gives

an example:

This method works very well up to four dimensions, then becomes excessively complex. In fact,

while in one-dimension only n rectangles are needed, in two-dimensions they rise to n

2

. In general,

being d the dimension, n

d

rectangles are needed: when we overcome the fourth dimension, it is

better to choose other method to determine the integral.

As shown in the picture, quadrature method approximates the integral with the sum of n

area, in a sort of ‘discretization’ of continuous world:

𝑏

𝑎

𝑖

𝑛

𝑖= 1

𝑖

𝑛

𝑖= 1

Δ

𝑥 1

𝑥 2

𝑥 𝑛

3.1 Monte Carlo Estimator Properties: Unbiasedness and Variance

In this paragraph we evaluate the properties of the Monte Carlo estimator, which are

unbiasedness, consistency and asymptotic normal distribution. We also determine the variance of

this estimator.

To determine the unbiasedness, i.e. 𝐸

𝑔

𝑛

) = 𝐼. Let us determine the expected value of

the estimator. Which means:

𝑔

𝑛

𝑔

𝑖

𝑖

𝑛

𝑖= 1

𝑔

𝑖

𝑖

𝑛

𝑖= 1

𝑔

𝑏

𝑎

𝑏

𝑎

Thus, Monte Carlo estimator for integral has the property of unbiasedness. Before going on studying

the other two properties, we compute the variance of the estimator. Which means:

𝑔

𝑛

𝑔

𝑖

𝑖

𝑛

𝑖= 1

2

𝑖

𝑖

𝑛

𝑖= 1

2

𝑔

𝑔

Where the third passage is correct because we are dealing with independent random variable,

which are also identically distributed, this the variance of the sum is the sum of the variances. This

is an interesting result, because it implies that by increasing the sample size (𝑛) the variance of the

estimator reduces (as usual). Obviously, the quantity in brackets is not known, thus we need to

estimate it, and we can do so by means of Monte Carlo simulation again. This means that we need

an estimator for the variance of the estimator. To this purpose, we first write the variance as:

2

2

Integrals Determination

Do not circulate Gianluca Broll – University of Trento

Then, to simplify the notation, we set ℎ(𝑥) = 𝑓(𝑥)/𝑔(𝑥), so to have:

𝑔

𝑛

𝑔

Therefore, our equation for estimator variance becomes:

𝑔

𝑔

2

𝑔

2

The first term in the right-hand side of this equation can be estimated through the Monte Carlo

estimator as follows:

𝑔

2

2

𝑛

𝑖= 1

𝑖

2

𝑖

2

𝑛

𝑖= 1

While the second term is just the expression for the integral estimator squared. Putting together,

we obtain:

𝑔

𝑖

2

𝑖

2

𝑛

𝑖= 1

𝑛

2

Thus, the variance for the estimators is:

𝑔

𝑛

𝑔

𝑖

2

𝑖

2

𝑛

𝑖= 1

𝑛

2

2

𝑖

2

𝑖

2

𝑛

𝑖= 1

𝑛

2

An alternative to estimate the variance of the estimator, albeit more demanding from a

computational point of view, is to create a sample of estimated integral and then calculate directly

the sample variance. Which means:

a) Simulate 𝑥

1

2

𝑛

values from g ;

b) Compute the estimator for the integral 𝐼

𝑛

1

𝑛

𝑖

𝑛

𝑖= 1

c) Repeat steps a) and b) a large number of time B , in order to obtain 𝐼

𝑛

( 1 )

𝑛

( 2 )

𝑛

(𝐵)

Having a sample of B estimates for the integral, the variance of the estimator is determined as the

variance of such sample.

An interesting case is the one in which the integral is already an expected value, i.e. it is of

the form:

Where g is already a density function of some random variable. For example, suppose that:

2

2