www.tbs-education.fr
Plan of the Chapter
References:
Berk and DeMarzo, Corporate Finance, Prentice Hall.
Benninga, Principles of Finance with Excel, Oxford University Press.
Brealey, Myers and Allen, Principles of Corporate Finance, McGraw Hill.
Holden, Spreadsheet Modeling in Corporate Finance, Prentice Hall.
o References :
o Berk & DeMarzo
o S. Benninga, Principles of Finance with Excel, Oxford University Press
o C. W. Holden, Spreadsheet Modeling in Corporate Finance, Prentice Hall
o M. Jackson & M. Staunton, Advanced Modelling in Finance usind Excel and VBA, John Wiley
& Sons
You have been initiated to Excel during the IT courses to the basics of Excel. You have also seen how to
use Excel and VBA more deeply. We will apply here these concepts to Finance.
Automate:
o Save time: The needs are often repetitive.
o Avoid typos and miscalculation.
o Some tasks could be decentralized.
Clarity:
o Report the results,
o Arguments for decision-making,
o Have an easy mind when you are on leave
www.tbs-education.fr
VBA Reminder
o VBA programs allow the user to automatize tasks that may be very long to undertake when they
are made manually
o Press Alt+F11 or use the menu (Developper -> Macro -> Visual Basic Editor)
Insertion->Module
Sub bonjour()
MsgBox "Je mappelle Jean-Claude Dusse avec un D comme Dusse"
End Sub
o Click run or ALT+F8: A pop-up appears with the message.
Sub cellule_en_jaune()
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
End Sub
o A function allows to make an operation and therefore provides a value. You can define a
function in using the keywords Function and End Function
o Other references
activecell.offset(0,1).select selects a cell on the same line and on the right
activecell.offset(0,-1).select selects a cell on the same line and on the left
activecell.offset(0,-1).Range("A1:A4").select selects 4 cells on the same line and on the left
o Select all non-empty cells from a column below the active cell:
Range(ActiveCell, ActiveCell.End(xlDown)).Select
o Select all non-empty cells from a line and on the right of the active cell:
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
o Conditional Instructions
o Examples:
If isempty(activecell) then
If activecell.value = "" then
Those processes return True if the Active Cell is empty, otherwise they return False
The keywords And or Or con also be used within a condition:
If activecell.value >10 And activecell.value <20 then
In this case, the condition only returns True if both conditions are satisfied
If activecell.value <10 or activecell.value >20 then
In this case, the condition returns True if at least one of those conditions are satisfied
o Loops:
o Loops allow to repeat several times a sequence of instructions
o Example:
o Your Excel sheet contains within a column some students first names and in another one their
grades. You are willing to stock those values within a table variable with 2 dimensions.
o Here is the table:
Sub stock_tableau2()
Dim tableau()
nb_lignes = Range("A1").End(xlDown).Row
nb_colonnes = Range("A1").End(xlToRight).Column
ReDim tableau(1 To nb_lignes, 1 To nb_colonnes)
End Sub
Notice that even if this seems very complicated this is much easier than using
references for reading a large table
Illustrations:
o Djia.xls
o You want to make a selective sorting for a very large table (more than 28,000 lines)
o You want to highlight all lines with daily returns exceeding 1%
o You can not modified the order in the table, so that you cannot used the Excel function
o In this case, writing a simple Macro can help you
o Write a Macro that highlights in Yellow all dates for which daily returns exceed 1%
o RAE.xls
o You have to create a button that is able to the Yield to Maturity (RAE or YTM) of a bond
www.tbs-education.fr
I. Statistics: The Normal Distribution
We can apply this distribution empirically when there is a large number of
observations (>30 : which is generally the case in finance, otherwise, one
should use the Student distribution).
Why : The central limit theorem (the mean of a sufficiently large number of
independent random variables, each with finite mean and variance, will be
approximately normally distributed.)
Characteristics :
One of the values is frequently observed: the mean
The probability of observing a value far from the mean is low
The Normal Distribution is defined by its mean and its variance (or standard
deviation) => Very simple to use it
Notation for a Normal Distribution with mean m and standard deviation :N(m,).
As this can only be applied to continuous random variables, we compute
p(X<x) or P(X>x), P(X=x)=0.
Statistics
Turnover
CA total
10 Symmetry / Mean Turnover
8
N 48
Mean 6274.49
6
2 Sigma = 2826,55
0
Moyenne = 6274,5
N = 48,00
Minimum 787.7
10 0
11 0
12 0 ,0
13 0 ,0
10
20 , 0
30 0
40 , 0
50 , 0
60 0
70 , 0
80 0
90 , 0
00
00
00
00
00
00
00
00
00
00
00
00
00
Maximum 13426.8
0,
0,
,
CA total
Properties
Mean: E(X)=m
Variance: V(X)=
Properties :
67% of all observations belong to the interval: mean minus 1 standard deviation and
mean plus 1 standard deviation
95% of all observations belong to the interval: mean plus/minus 2 standard deviations
99% of all observations belong to the interval: mean plus/minus 3 standard deviations
If X1 and X2 are 2 independent random variables following respectively N(m1 ;1) and
N(m2;2), then:
X1+X2 follows a N(m1 + m2 ; 12 22 ),
X1-X2 follows a N(m1 - m2 ; 12 22 ),
aX1 follows a N(am1 ; a 1 ).
Objective :
We have a representative sample with observations of a random variable X that
follows a distribution function depending on a parameter q.
We are willing to find a confidence interval for the parameter q for a given level
of confidence (or a given risk of error)
As we only have a sample of the values that can be taken by X, we have a risk
of error. This risk will be higher when the standard deviation is high and when
our sample is small.
r% t% a
10% 90% 1,64
5% 95% 2
1% 99% 2,6
Simulations allows to use computers in order to imitate the real world or to make
forecasts in order to implement decisions.
When you generate a model with Excel, for instance, this model should include:
Some inputs
Some equations
Solving the model allows Excel to generate the outputs of the model
Most of financial models and this is particularly true in corporate finance) are purely
deterministic For given inputs, they always generate the same result and outputs.
Model
Examples :
Black et Scholes (r and )
NPV(CFt , r)
Problem: As all financial models (but this is also the case in Economics, Strategy,
Marketing,) are forward-looking , i.e. they are supposed to provide an objective
information today based on future (forecasted) events , they are not, by nature,
deterministic. The mathematical models make them deterministic while they should be
stochastic as they are based on forecasts. As a forecast corresponds to a random
variable, this will generate errors !!!
2 useful tools allow to take into account the stochastic nature of those models:
A sensitivity analysis
Monte-Carlo simulations
The Excel function Data Table allows to it in a quite simple way (from the Excel menu bar,
click on Data, locate the Data Tools panel and click on the "What if Analysis" item, then click
on Data Table).
Method :
You first have to define the data of your base scenario on a particular sheet
The model that will use those data should appear on another sheet
Then, you have to copy the output of the model within a cell
Enter new values for the inputs of your model whether in line or column or
both.
Highlight both the new values & the output of the model you're using. This will
also highlight the cells in which Excel will put the results of the sensitivity
analysis
Apply the function Data Table in stating whether your inputs are in line or
column and enter the cell in which your original input is.
35 Sylvain Bourjade Toulouse Business School
III Sensitivity Analysis
The file sensi.xls computes the NPV of a capital budgeting decision project. We are
willing to analyze the sensitivity of the NPV to variations of both the cost of goods sold
and the cost of capital
The main interest of doing such a sensitivity analysis is therefore the inherent simplicity
of implementing it.
Simulation methods are based on the following principle: generating random numbers in
order to simulate a probability distribution. Monte-Carlo Simulations are a reference to the
Monte-Carlo casino. The main idea is that a running simulations is equivalent to spinning a
large number of times an unbiased roulette.
A stochastic model is a model with variables that follows probability distributions. Those
models are frequently used in Finance because most of variables are not known with
certainty (B&S). For instance, one can observe that most of financial assets returns
distribution are close to classic probability distributions (Stock returns can be
approximated by Normal or Log-Normal distributions). Even though this was not the case,
you can think about the Central Limit Theorem.
Market Share
4% 5% 6% 7% 8% 4% 5% 6% 7% 8%
1% -5.9 -3.5 -1.2 1.2 3.5 1%
Optimization = You have to find the optimal values for the control variables
(Weights of the assets in a Mean-Variance analysis, ) that maximize or
minimize an objective function (the variance in the previous example)
Even though you have to solve the algorithm numerically, the base principle
is analytical there is only one optimal value!
Simulation = You have to determine the value of an objective function in
simulating the values of the parameters (or the control variables) of the
model
This is a purely empirical method: You only get a distribution for the values of
the objective function.
This allows to analyze the values of the objective function that will occur
with the highest probabilities
This also allows to analyze the volatility of the values of the objective
function around the mean of its distribution
How it works?
Model
Confidence
Assume that we are willing to estimate the market shares of some brands of the car
industry:
- This is difficult because we do not have access to regional data !
- However, one can observe the traffic on the highway and analyze the number
of cars for each brand that drive on the highway X being the Car company
45 Sylvain Bourjade Toulouse Business School
IV Monte-Carlo Simulations: Methodology
Density Function
% d'observation
% of observations selon
for each
lesbrand
diffrentes
Renault 30% marques
Cumulative Distribution
Fonction Function
de rpartition
(b)
120%
(a) Inversion of the cumulative
100%
Generating a distribution function in order to
number
80% get a value
60% X
between 0 and
1 from the 40%
Uniform 20%
Distribution 0%
1 3 5 7 9 11 13 15 17 19 21 23 25
(c)
The value comes from the
corresponding distribution
The density function of a continuous random variable gives the probability that X is in a
neighborhood of x as P(X = x) = 0. We therefore have f(x) = Proba(a X b)
0.05
0
Values of the
random variable
The cumulative distribution function of a continuous random variable gives the probability that
X takes values lower than x: F(x) = Proba(X x)
You can compute it in integrating the density function
If x is the upper bound of the interval, F(x)=1
The cumulative distribution function of a continuous random variable is continuous
F(x)
f(x)
a x a
F(x) c.d.f.
(a)
Generating a number between
0 and 1 from the Uniform p
Distribution with random()
Random
observation
(b)
Read the value associated to the random variable from the c.d.f.:
The value comes from the corresponding distribution
One can generate values from a continuous random variable that follows a particular
distribution function in combining the Excel function random() with other functions:
Uniform Distribution:
= 10*random() generates a number from the Uniform Distribution between 0 &
10.
= 5 + (2*random()) generates a number from the Uniform Distribution between 5
& 7.
= x + ((y-x)*random() ) generates a number between x & x+y.
Normal Distribution:
= NORMINV(random(),x,y) or LOI.NORMALE.INVERSE in French, generates a
random number from the Normal Distribution with mean x and standard deviation y.
The choice of the probability distribution depends on your anticipations concerning the
symmetry and the likelihood of observing values close from the mean and from the lower
and upper bounds of the interval for the inputs of your model.
Example 2: You have to introduce a negative correlation between price and quantity in a
Monte-Carlo Simulation: CF_Simulation.xls
The base random number (between 0 and 1) that should generate the quantity has to depend on the
random nuber that generate the price. For instance, to generate the random nuber for Q, hou may
use the function If and associate a multiplicative coeffeicient > 1 (resp. < 1) depending on the
random number for P (i.e. if it is > or < 0.5). The anti-correlation degree is at your discretion.
Choose Uniform Distributions for price and quantity.
Simulate 500 Prices and quantities
Generate Descriptive statistics and an Histogram for the output.