Applied Econometrics
Applied Econometrics
c 2014
Applied Econometrics for Business and Finance
Functions
A function is a mapping or relationship between an input or
=f(x)
y could be a linear function of x where the relationship can be
graphically as a curve
If the equation is linear, we would write the relationship as
y = a + bx
where y and x are called variables and a and b are parameters
a is the intercept and b is the slope or gradient
c 2014
Applied Econometrics for Business and Finance
Straight Lines
The intercept is the point at which the line crosses the y-axis
Example: suppose that we were modelling the relationship
function
y = 25 + 0.05x
The intercept, a, is 25 and the slope, b, is 0.05
This means that with no study (x=0), the student could
c 2014
Applied Econometrics for Business and Finance
Straight Lines
In the graph above, the slope is positive
i.e. the line slopes upwards from left to right
But in other examples the gradient could be zero or negative
For a straight line the slope is constant i.e. the same along
taking any two points on the line and dividing the change in y
by the change in x
(Delta) denotes the change in a variable
For example, take two points x = 100, y = 30 and x = 1000,
y = 75
c 2014
Applied Econometrics for Business and Finance
y
75 30
=
= 0.05
x
1000 100
c 2014
Applied Econometrics for Business and Finance
Roots
The point at which a line crosses the x-axis is known as the
root
A straight line will have one root (except for a horizontal line
0 = 25 + 0.05x
So the root is x = 500
In this case it does not have a sensible interpretation: the
c 2014
Applied Econometrics for Business and Finance
Quadratic Functions
A linear function is often not sufficiently flexible to accurately
as
y = a + bx + cx 2
where a, b, c are the parameters that describe the shape of
the function
Quadratics have an additional parameter compared with linear
functions
The linear function is a special case of a quadratic where c=0
a still represents where the function crosses the y-axis
As x becomes very large, the x 2 term will come to dominate
Thus if c is positive, the function will be -shaped, while if c
b b 2 4ac
x=
2c
If b 2 > 4ac, the function will have two unique roots and it will
If b 2 = 4ac, the function will have two equal roots and it will
roots), it will not cross the x-axis at all and thus the function
will always be above the x-axis.
c 2014
Applied Econometrics for Business and Finance
10
c 2014
Applied Econometrics for Business and Finance
11
c 2014
Applied Econometrics for Business and Finance
12
c 2014
Applied Econometrics for Business and Finance
13
(i.e., x 2 = x x).
Raising it to the power 3 means cubing it (x 3 = x x x),
and so on
The number that we are raising the number or variable to is
c 2014
Applied Econometrics for Business and Finance
14
1
x3
1
xxx .
c 2014
Applied Econometrics for Business and Finance
15
c 2014
Applied Econometrics for Business and Finance
16
sometimes written x
Other, non-integer powers are also possible, but are harder to
In general, x 1/n = n x.
c 2014
Applied Econometrics for Business and Finance
17
18
c 2014
Applied Econometrics for Business and Finance
19
Logarithms
Logarithms were invented to simplify cumbersome
useful.
1. Taking a logarithm can often help to rescale the data so that
their variance is more constant, which overcomes a common
statistical problem known as heteroscedasticity.
2. Logarithmic transforms can help to make a positively skewed
distribution closer to a normal distribution.
3. Taking logarithms can also be a way to make a non-linear,
multiplicative relationship between variables into a linear,
additive one.
c 2014
Applied Econometrics for Business and Finance
20
21
c 2014
Applied Econometrics for Business and Finance
22
ln(0.5) 0.69
We cannot take the log of a negative number
So ln(-0.6), for example, does not exist.
c 2014
Applied Econometrics for Business and Finance
23
c 2014
Applied Econometrics for Business and Finance
24
Sigma Notation
If we wish to add together several numbers (or observations
(1 + 2 + 3) = 6
In the context of adding the observations on a variable, it is
25
xi +
n
X
zi
i=1
n
X
i=1
cxi
= c
i=1
n
X
n
X
(xi + zi )
n
X
xi .
i=1
xi zi
6=
i=1
n
X
i=1
n
X
xi
n
X
zi
i=1
= x + x + . . . + x = nx
xi
= x1 + x2 + . . . + xn = nx.
i=1
n
X
i=1
c 2014
Applied Econometrics for Business and Finance
26
Pi Notation
Similar to the use of sigma to denote sums, the pi operator
Q
( ) is used to denote repeated multiplications.
For example
n
Y
xi = x1 x2 . . . xn
i=1
c 2014
Applied Econometrics for Business and Finance
i=1
27
Differential Calculus
The effect of the rate of change of one variable on the rate of
28
dy
= 0.
dx
dy
= 3.
dx
29
c 2014
Applied Econometrics for Business and Finance
30
c 2014
Applied Econometrics for Business and Finance
31
i.e. y = cx n is given by
dy
= cnx n1 .
dx
For example:
dy
= (4 3)x 2 = 12x 2
dx
dy
3
3
= (3 1)x 2 = 3x 2 = 2 .
y = = 3x 1 ,
x
dx
x
The derivative of a sum is equal to the sum of the derivatives
of the individual parts: e.g., if
dy
= f 0 (x) + g 0 (x)
e.g. if y = f (x) + g (x),
dx
The derivative of a difference is equal to the difference of the
derivatives of the individual parts: e.g.,
dy
if y = f (x) g (x),
= f 0 (x) g 0 (x).
c
Applied Econometrics for Business and Finance
2014
dx
y = 4x 3 ,
32
given by 1/x
i.e.
d(log(x))
1
= .
dx
x
f 0 (x)
d(log(f (x)))
=
.
dx
f (x)
c 2014
Applied Econometrics for Business and Finance
33
The derivative of e x is e x .
The derivative of e f (x) is given by f 0 (x)e f (x) .
2
E.g., if y = e 3x ,
dy
dx
= 6xe 3x .
c 2014
Applied Econometrics for Business and Finance
34
c 2014
Applied Econometrics for Business and Finance
35
d 2y
dx 2
00
= f (x) =
d( d(4x
5 +3x 3 +2x+6)
dx
dx
d(20x 4 + 9x 2 + 2)
=
dx
= 80x 3 + 18x.
c 2014
Applied Econometrics for Business and Finance
36
maximum or a minimum?
The answer is that we would look at the second derivative
When a function reaches a maximum, its second derivative is
c 2014
Applied Econometrics for Business and Finance
37
a minimum
To find where this minimum is located, take the first
c 2014
Applied Econometrics for Business and Finance
38
c 2014
Applied Econometrics for Business and Finance
39
Partial Differentiation
In the case where y is a function of more than one variable
usually denoted
y
x1
All of the rules for differentiation explained above still apply
and there will be one (first order) partial derivative for each
variable on the right hand side of the equation.
c 2014
Applied Econometrics for Business and Finance
40
c 2014
Applied Econometrics for Business and Finance
41
c 2014
Applied Econometrics for Business and Finance
42
Integration
c 2014
Applied Econometrics for Business and Finance
43
Matrices - Background
Some useful terminology:
A scalar is simply a single number (although it need not be a
whole number e.g. 3, 5, 0.5 are all scalars)
A vector is a one-dimensional array of numbers (see below for
examples)
A matrix is a two-dimensional collection or array of numbers.
The size of a matrix is given by its numbers of rows and
columns
Matrices are very useful and important ways for organising
44
columns. The element in the second row and the third column
of this matrix would be denoted m23 .
More generally mij refers to the element in the ith row and
m11
m21
m12
m22
m13
m23
m14
m24
45
1.3
e.g. 0.1
0.0
When the number of rows and columns is equal (i.e. R=C), it
c 2014
Applied Econometrics for Business and Finance
46
e.g.
1
2
4
7
2 3
6
9
4
6
2 8
7
9 8
0
3 0 0
0
0 1 0
0
e.g.
0 0 2
0
0 0 0 1
c 2014
Applied Econometrics for Business and Finance
47
1 0
0 1
e.g.
0 0
0 0
0
0
1
0
0
0
0
1
number one
Multiplying any matrix by the identity matrix of the
c 2014
Applied Econometrics for Business and Finance
48
conformable
The dimensions of matrices required for them to be
c 2014
Applied Econometrics for Business and Finance
49
,
0.1
e.g., if A =
and B =
0.3
0.3 + 0.2 0.6 0.1
0.5 0.5
A+B =
=
,
0.1 + 0 0.7 + 0.3
0.1 1.0
0.3 0.2 0.6 0.1
0.1 0.7
AB =
=
0.1 0 0.7 0.3
0.1 0.4
0.3 0.6
0.1 0.7
c 2014
Applied Econometrics for Business and Finance
0.2
0
,
50
Matrix Multiplication
Multiplying or dividing a matrix by a scalar (that is, a single
51
Matrix Multiplication
Multiplying two matrices together requires the number of
general, AB 6= BA
When the matrices are multiplied together, the resulting
(a b) (b c) (c d) (d e) = (a e), etc.
In general, matrices cannot be divided by one another.
Instead, we multiply by the inverse.
c 2014
Applied Econometrics for Business and Finance
52
c 2014
Applied Econometrics for Business and Finance
53
1
e.g. 7
1
2
0
3
6
6
(3 2)
2
3
4
0
9
2
(2 4)
12 8 4 13
= 18 23 28 69
36 20 4 21
(3 4)
c 2014
Applied Econometrics for Business and Finance
54
If A is of dimensions R C , A0 will be C R.
c 2014
Applied Econometrics for Business and Finance
55
6
4
=1
rank
c 2014
Applied Econometrics for Business and Finance
56
c 2014
Applied Econometrics for Business and Finance
57
and non-singular
Properties of the inverse of a matrix include:
I 1 = I
(A1 )1 = A
(A0 )1 = (A1 )0
(AB)1 = B 1 A1
c 2014
Applied Econometrics for Business and Finance
58
a
c
b
d
1
ad bc
d
c
will be
b
a
c 2014
Applied Econometrics for Business and Finance
59
2
4
1
6
18
1
4
.
c 2014
Applied Econometrics for Business and Finance
60
leading diagonal
For example, the trace of the matrix
A=
3
7
4
9
Tr(A), is 3 + 9 = 12
Some important properties of the trace of a matrix are:
Tr(cA) = cTr(A)
Tr(A0 ) = Tr(A)
Tr(A + B) = Tr(A) + Tr(B)
Tr(IN ) = N
c 2014
Applied Econometrics for Business and Finance
61
62
=
5
2
1
4
5 1
1 0
=0
=
2 4
0 1
5
1
=
= (5 )(4 ) 2 = 2 9 + 18
2
4
This gives the solutions = 6 and = 3.
The characteristic roots are also known as eigenvalues
The eigenvectors would be the values of c corresponding to
the eigenvalues.
c 2014
Applied Econometrics for Business and Finance
63
w1
E (r1 )
w2
E (r ) = E (r2 )
w =
...
...
wN
E (rN )
The expected return on the portfolio, E (rP ) can be calculated
as E (r )0 w .
c 2014
Applied Econometrics for Business and Finance
64
V =
11
21
..
.
12
22
13
23
. . . 1N
. . . 2N
..
.
N1 N2 N3 . . . NN
For example:
11 is the variance of the returns on stock one, 22 is the
variance of returns on stock two, etc.
12 is the covariance between the returns on stock one and
those on stock two, etc.
c 2014
Applied Econometrics for Business and Finance
65
R=
r11 r1
r12 r1
..
.
r21 r2
r22 r2
r31 r3
r32 r3
rN1 rN
rN2 rN
. . . rNT rN
...
...
..
.
66
on the portfolio P
A scalar which we might call VP
We would do this by calculating
VP = w 0 Vw
Checking the dimension of VP , w 0 is (1 N), V is (N N)
c 2014
Applied Econometrics for Business and Finance
67
would be
C =
1
C21
..
.
C12
1
C13
C23
. . . C1N
. . . C2N
..
.
This matrix would have ones on the leading diagonal and the
c 2014
Applied Econometrics for Business and Finance
68
VP = w 0 SCSw
where S is a diagonal matrix containing the standard
deviations of the portfolio returns.
c 2014
Applied Econometrics for Business and Finance
69
VP is written
min w 0 Vw
w
70
wMVP =
1N V 1
1N V 1 10N
c 2014
Applied Econometrics for Business and Finance
71
min
w
w 0 Vw
subject to
w 0 1N = 1, w 0 E (r ) = R
problem
It can be solved analytically so we can derive an exact solution
But it is often the case that we want to place additional
72
c 2014
Applied Econometrics for Business and Finance
73
w 0 E (r ) rf
1
(w 0 Vw ) 2
subject to
w 0 1N = 1
be solved as
V 1 [E (r ) rf 1N ]
10N V 1 [E (r ) rf 1N ]
Note that it is also possible to write the Markowitz problem
where we select the portfolio weights that maximise the
expected portfolio return subject to a target maximum
variance level.
w=
c 2014
Applied Econometrics for Business and Finance
74