ECOS3020-无代写
时间:2024-04-26
C
R
IC
O
S
0
0
0
2
6
A
T
E
Q
S
A
P
R
V
1
2
0
5
7
ECOS3020
Special Topic in Economics
Lecture 1: Understanding financial data
Dr. Sol Chung
Lecture 1. Understanding financial data
• Understanding financial data
• Basic statistical and mathematical concepts
• Textbook: Chapter 1 and 2 in Brooks, C., 2019, Introductory
econometrics for finance, Cambridge university press, 4th edition
Examples of the kind of problems that may be solved
1. Testing whether financial markets are weak-form informationally
efficient.
2. Testing whether the CAPM or APT represent superior models for the
determination of returns on risky assets.
3. Measuring and forecasting the volatility of bond returns.
4. Explaining the determinants of bond credit ratings used by the ratings
agencies.
5. Modelling long-term relationships between prices and exchange rates.
6. Determining the optimal hedge ratio for a spot position in oil.
7. Testing technical trading rules to determine which makes the most
money.
8. Testing the hypothesis that earnings or dividend announcements have
no effect on stock prices.
9. Testing whether spot or futures markets react more rapidly to news.
10. Forecasting the correlation between the returns to the stock indices of
two countries.
Examples of the kind of problems that may be solved
What are the Special Characteristics of Financial Data?
• Frequency & quantity of data
‐ Stock market prices are measured every time there is a trade or
somebody posts a new quote
• Quality
‐ Recorded asset prices are usually those at which the transaction took
place
‐ No possibility for measurement error but financial data are “noisy”.
Steps involved in the formulation of economic models
Basic statistical and mathematical concepts:
Functions
• A function is a mapping or relationship between an input (or set of inputs)
and an output
• We write that y (the output) is a function f of x (the input). y = f (x)
• y could be a linear function of x where the relationship can be expressed
on a straight line
• Or it could be non-linear where it would be expressed 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. a and b are parameters
• a = the intercept and b = the slope or gradient
Straight Lines
• The intercept is the point at which the line crosses the y-axis
• Example: suppose that we were modelling the relationship between a
student’s average mark, y (in percent), and the number of hours studied
per year, x
• Suppose that the relationship can be written as a linear function
y = 25 + 0.05x
Plot of Hours Studied Against Mark Obtained
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 the whole
line
• In general, we can calculate the slope of a straight line by 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
• We can write these using coordinate notation (x,y) as (100,30) and
(1000,75)
• We would calculate the slope as
Roots
• The root is the point at which a line crosses the x-axis
• A straight line will have one root (except for a horizontal line such as y=4
which has no roots)
• To find the root of an equation set y to zero and rearrange
0 = 25 + 0.05x
• So, the root is x = −500
• In this case it does not have a sensible interpretation: the number of hours
of study required to obtain a mark of zero!
Quadratic Functions
• A linear function is often not sufficiently flexible to accurately describe
the relationship between two series
• We could use a quadratic function instead:
y = a + bx + cx2
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 the intercept where the function crosses the y-axis
• As x becomes very large, the x2 term will come to dominate
• If c is positive, the function will be -shaped, while if c is negative it will
be -shaped.
The Roots of Quadratic Functions
• The roots may be
‐ distinct (i.e., different from one another) or the same (repeated roots);
‐ real numbers (e.g., 1.7, -2.357, 4, etc.) or complex numbers
• The roots can be obtained either by factorising the equation (contracting it
into parentheses), by ‘completing the square’, or by using the formula:
The Roots of Quadratic Functions (Cont’d)
• If b2 > 4ac, the function will have two unique roots and it will cross the x-
axis in two separate places
• If b2 = 4ac, the function will have two equal roots and it will only cross
the x-axis in one place
• If b2 < 4ac, the function will have no real roots (only complex roots), it
will not cross the x-axis at all and thus the function will always be above
the x-axis
Calculating the Roots of Quadratics - Examples
Determine the roots of the following quadratic equations:
1. y = x2 + x − 6
2. y = 9x2 + 6x + 1
3. y = x2 − 3x + 1
4. y = x2 − 4x
Calculating the Roots of Quadratics - Solutions
• We solve these equations by setting them in turn to zero
• We could use the quadratic formula in each case, although it is usually
quicker to determine first whether they factorise
1. x2 + x − 6 = 0 factorises to (x − 2)(x + 3) = 0 and thus the roots are 2 and
−3, which are the values of x that set the function to zero. In other words,
the function will cross the x-axis at x = 2 and x = −3
2.9x2 + 6x + 1 = 0 factorises to (3x + 1)(3x + 1) = 0 and thus the roots are
−1/3 and −1/3. This is known as repeated roots – since this is a quadratic
equation there will always be two roots but in this case they are both the
same.
Calculating the Roots of Quadratics – Solutions (Cont’d)
3. x2 − 3x + 1 = 0 does not factorise and so the formula must be used
with a = 1, b = −3, c = 1 and the roots are 0.38 and 2.62 to two decimal
places
4. x2 − 4x = 0 factorises to x(x − 4) = 0 and so the roots are 0 and 4.
• All of these equations have two real roots
• But if we had an equation such as y = 3x2 − 2x + 4, this would not
factorise and would have complex roots since b2 − 4ac < 0 in the
quadratic formula.
Powers of Number or of Variables
• A number or variable raised to a power (or index) is simply a way of
writing repeated multiplication
• For example, raising x to the power 2 means squaring it (i.e., x2 = x × x)
• Raising x to the power 3 means cubing it (x3 = x × x × x), and so on
Manipulating Powers and their Indices
• Any number or variable raised to the power one is simply that number or
variable
• Any number or variable raised to the power zero is one
‐ except that 00 is not defined (i.e., it does not exist)
• If the index is a negative number, this means that we divide one by that
number
• If we want to multiply together a given number raised to more than one
power, we would add the corresponding indices together
• If we want to calculate the power of a variable raised to a power (i.e., the
power of a power), we would multiply the indices together
Manipulating Powers and their Indices (cont’d)
• If we want to divide a variable raised to a power by the same variable
raised to another power, we subtract the second index from the first
• If we want to divide a variable raised to a power by a different variable
raised to the same power, (x / y)n = xn / yn
• The power of a product is equal to each component raised to that power
• The indices for powers do not have to be integers
• Other, non-integer powers are also possible, but are harder to calculate by
hand (e.g. x0:76, x−0:27, etc.)
• In general, x1/n = n√x
The Exponential Function, e
• When a variable grows (or reduces) at a rate in proportion to its current
value, we would write y = ex
• e is a simply number: 2.71828. . .
• It is also useful for capturing the increase in value of an amount of money
that is subject to compound interest
• The exponential function can never be negative
- when x is negative, y is close to zero but positive
• It crosses the y-axis at one and the slope increases at an increasing rate
from left to right
A Plot of the Exponential Function
Logarithms
• Logarithms is the inverse function to exponentiation
• Why do we use a log transformation?
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
How do Logs Work?
• Consider the power relationship 23 = 8
• Using logarithms, we would write this as log28 = 3, or ‘the log to the base
2 of 8 is 3’
• More generally, if ab = c, logac = b
How do Logs Work? (cont’d)
• Natural logarithms, also known as logs to base e, are more commonly
used and more useful mathematically than logs to any other base
• denoted interchangeably by ln(y) or log(y)
• The log of a number less than one will be negative, e.g. ln(0.5) ≈ −0.69
• We cannot take the log of a negative number
• for example, ln(−0.6) does not exist
• If we plot a log function, y = ln(x), it would cross the x-axis at one – see
the following slide
• As x increases, y increases at a slower rate, which is the opposite to an
exponential function where y increases at a faster rate as x increases
A Graph of a Log Function
The Laws of Logs
For variables x and y:
• ln (x y) = ln (x) + ln (y)
• ln (x/y) = ln (x) − ln (y)
• ln (yc) = c ln (y)
• ln (1) = 0
• ln (1/y) = ln (1) − ln (y) = −ln (y)
• ln(ex) = x
Sigma Notation
• Σ means ‘add up all of the following elements’
• Σ(1 + 2 + 3) = 6
•
where the i subscript is an index, 1 is the lower limit and 4 is the upper limit
of the sum. This would mean adding all of the values of x from x1 to x4
Properties of the Sigma Operator
Pi Notation
• Similar to the use of sigma to denote sums, the pi operator (Π) is used to
denote repeated multiplications.
• For example,
means ‘multiply together all of the xi for each value of i between the lower
and upper limits’
• It also follows that
Differential Calculus
• The effect of the rate of change of one variable on the rate of change of
another is measured by a mathematical derivative
• The gradient of a curve show the relationship between the two variables
• y = f (x): the derivative of y with respect to x is written
or sometimes f ′(x)
• This term measures the instantaneous rate of change of y with respect to x
Differentiation: The Basics
1. The derivative of a constant is zero – e.g. if y = 10, dy/dx = 0
This is because y = 10 would be a horizontal straight line on a graph of y
against x, and therefore the gradient of this function is zero
2. The derivative of a linear function is simply its slope
e.g. if y = 3x + 2, dy/dx = 3
3. But non-linear functions will have different gradients at each point along
the curve
• The gradient will be zero at the point where the curve changes direction
from positive to negative or from negative to positive – this is known as a
turning point
The Derivative of a Power Function or of a Sum
• The derivative of a power function n of x:
➢ if y = cxn , dy/dx = cnxn−1
• The derivative of a sum is equal to the sum of the derivatives of the
individual parts:
➢ if y = f (x) + g (x) , dy/dx = f ′(x) + g′(x)
• The derivative of a difference is equal to the difference of the
derivatives of the individual parts:
➢ if y = f (x) − g (x) , dy/dx = f ′(x) − g′(x)
The Derivatives of Logs and Exponentials
• The derivative of the log of x is given by 1/x
➢ i.e. d(log(x))/dx = 1/x
• The derivative of the log of a function of x is the derivative of the
function divided by the function
➢ i.e. d(log(f (x)))/dx = f ′(x)/f (x)
• The derivative of ex is ex
• The derivative of e f (x) is given by f ′(x)e f (x)
Higher Order Derivatives
• It is possible to differentiate a function more than once to calculate the
second order, third order, . . ., nth order derivatives
• The notation for the second order derivative, which is usually just
termed the second derivative, is
• To calculate second order derivatives, differentiate the function with
respect to x and then differentiate it again
• For example, suppose that we have the function y = 4x5 + 3x3 + 2x + 6,
the first order derivative is
Higher Order Derivatives (Cont’d)
• The second order derivative is
• The second order derivative can be interpreted as the gradient of the
gradient of a function – i.e., the rate of change of the gradient
• How can we tell whether a particular turning point is a 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 negative,
while it is positive for a minimum.
Maxima and Minima of Functions – Example
• Consider the quadratic function y = 5x2 + 3x − 6
• Since the second derivative is ________ , the function indeed has a
_________
• To find where this minimum is located, take the first derivative, set it to
zero and solve it for x
Partial Differentiation
• In the case where y is a function of more than one variable (e.g.
y = f (x1, x2, . . . , xn)), it may be of interest to determine the effect that
changes in each of the individual x variables would have on y
• Differentiation of y with respect to only one of the variables, holding
the others constant, is partial differentiation
• The partial derivative of y with respect to a variable x1 is usually
denoted ∂y/∂x1
How to do Partial Differentiation
• Suppose y = 3x1
3 + 4x1 − 2x2
4 + 2x2
2,
➢ the partial derivative of y with respect to x1 would be ________
➢ the partial derivative of y with respect to x2 would be ________
• Partial differentiation has a key role in deriving the main approach to
parameter estimation that we use in economic analysis.
Matrices - Background
• Some useful terminology:
• A scalar is simply a single number – e.g., 3, −5, 0.5 are all scalars
• A vector is a one-dimensional array of numbers
• 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 sets of
data together, which make manipulating and transforming them easy
• Matrices are widely used in econometrics and finance for solving
systems of linear equations, for deriving key results, and for
expressing formulae
Working with Matrices
• The dimensions of a matrix are quoted as R × C, which is the number
of rows by the number of columns
• For example, suppose a matrix M has two rows and four columns:
• a 2 × 4 matrix would have elements
• More generally mij refers to the element in the i
th row and the jth
column
• If a matrix has only one row, it is a row vector, which will be of
dimension 1 × C, where C is the number of columns
• e.g. (2.7 3.0 −1.5 0.3)
Working with Matrices
• A matrix having only one column is a column vector, which will be
of dimension R× 1, where R is the number of rows, e.g.
• When the number of rows and columns is equal (i.e. R = C), it
would be said that the matrix is square, e.g. the 2 × 2 matrix:
• A matrix in which all the elements are zero is a zero matrix.
Working with Matrices 2
• A symmetric matrix is a special square matrix that is symmetric
about the leading diagonal so that mij = mji ∀ i, j, e.g.
• A diagonal matrix is a square matrix which has non-zero terms on
the leading diagonal and zeros everywhere else, e.g.
Working with Matrices 3
• A diagonal matrix with 1 in all places on the leading diagonal and zero
everywhere else is known as the identity matrix, denoted by I, e.g.
• For any matrix M, MI = IM = M
• In order to perform operations with matrices, they must be conformable
• The dimensions of matrices required for them to be conformable
depend on the operation
Matrix Addition or Subtraction
• Addition and subtraction of matrices requires the matrices concerned to
be of the same order (i.e. to have the same number of rows and the
same number of columns as one another)
• The operations are then performed element by element
Matrix Multiplication
• Multiplying or dividing a matrix by a scalar (that is, a single number),
implies that every element of the matrix is multiplied by that number
• More generally, for two matrices A and B of the same order and for c a
scalar, the following results hold
• A + B = B + A
• A + 0 = 0 + A = A
• cA = Ac
• c(A + B) = cA + cB
• A0 = 0A = 0
Matrix Multiplication
• Multiplying two matrices together requires the number of columns of
the first matrix to be equal to the number of rows of the second matrix
• Note also that the ordering of the matrices is important, so in general,
AB BA
• When the matrices are multiplied together, the resulting matrix will be
of size (number of rows of first matrix × number of columns of second
matrix), e.g.
(3 × 2) × (2 × 4) = (3 × 4).
• More generally, (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
Matrix Multiplication Example
The Transpose of a Matrix
• The transpose of a matrix, written A′ or AT, is the matrix obtained by
transposing (switching) the rows and columns of a matrix
• If A is of dimensions R × C, A′ will be C × R.
The Inverse of a Matrix
• The inverse of a matrix A, where defined and denoted A−1
• AA−1 = A−1A = I
• The inverse of a matrix exists only when the matrix is square and non-
singular
• Properties of the inverse of a matrix include:
• I−1 = I
• (A−1)−1 = A
• (A′)−1 = (A−1)′
• (AB)−1 = B−1A−1
Calculating Inverse of a 22 Matrix
• The inverse of a 2 × 2 non-singular matrix whose elements are
will be
• The expression in the denominator, (ad − bc) is the determinant of the
matrix, and will be a scalar
• If the matrix is
the inverse will be
• As a check, multiply the two matrices together and it should give the
identity matrix I.
Statistical foundations and dealing with data:
• The population
‐ is the total collection of all objects to be studied
‐ may be either finite or infinite
• The sample
‐ is a selection of some observations from the population
‐ is usually random in which each individual item in the population is
equally likely to be drawn
‐ should be representative of the population of interest
The population and the sample
• The normal (Gaussian) distribution is the
most commonly used in statistics
• The standard normally distributed variable
can be constructed from any normal random
variable by subtracting its mean and dividing
by its standard deviation:
• The Central Limit Theorem (CLT):
The distribution of sample means approximates
a normal distribution as the sample size gets
larger, regardless of the population’s
distribution
The normal distribution and standard normal distribution
Statistical foundations and dealing with data:
• Descriptive statistics
• The average value of a series is its measure of location or measure of
central tendency, capturing its ‘typical’ behaviour
• There are three broad method to calculate the average value of a series:
‐ mean: the sum of all N observations divided by N
‐ mode: the most frequently occurring value in a set of observations
‐ median: the middle value in a series when the observations are
arranged in ascending order
Measures of central tendency
• the variance or standard deviation: measures the spread of a series about
its mean value
• This quantity is an important measure of risk in finance
• Other measures of spread include:
‐ the range: the difference between the largest and smallest of the data
points)
‐ the semi-interquartile range: the difference between the first and third
quartile points in the series
Measures of spread
• Covariance is a linear measure of association between two series
• Correlation is another measure of association:
‐ is calculated by dividing the covariance between two series by the
product of their standard deviations
‐ is unit-free and must lie between (-1,+1)
Measures of association
Means
• The mean of a random variable y is known as its expected value: E(y)
• The expected value of a constant is the constant, e.g. E(c) = c
• The expected value of a constant multiplied by a random variable is:
E(cy)=c E(y)
• E(cy+d)= cE(y)+d, where d is also a constant
• For two independent random variables, y1 and y2, E(y1y2) = E(y1) E(y2)
Some algebra useful for working with means, variances
and covariances
Variances
• The variance of a random variable y: var(y)
• var(y) = E[y − E(y)]2
• var(c) = 0 where c is a constant
• For c and d constants, var(cy + d) = c2var(y)
• For two independent random variables, y1 and y2, var(cy1 + dy2) =
c2var(y1) + d
2var(y2)
Some algebra useful for working with means, variances
and covariances (cont’d)
Covariances
• The covariance between two random variables, y1 and y2: cov(y1, y2)
• cov(y1, y2) = E[(y1 − E(y1))(y2 − E(y2))]
• For two independent random variables, y1 and y2, cov(y1, y2) = 0
• For four constants, c, d, e, and f, cov(c+dy1, e+fy2)=dfcov(y1, y2)
Some algebra useful for working with means, variances
and covariances (cont’d)
Statistical foundations and dealing with data:
• Descriptive statistics
• Data types
• There are 3 types of data for analysis:
1. Time series data: consists of observations of a single subject at
different times usually at uniform intervals
2. Cross-sectional data: consist of observations of many subjects at the
same point in time
3. Panel data: a combination of 1 & 2
Data types
• Examples of time series data
Series Frequency
GNP or unemployment monthly, or quarterly
government budget deficit annually
money supply weekly
value of a stock market index as transactions occur
Data types (cont’d)
• Example of cross-sectional data
• Example of panel data
Data types (cont’d)
• Quantitative data:
‐ are measures of values or counts and are expressed as numbers
‐ data about numeric variables
‐ e.g. exchange rates, stock prices, number of shares outstanding
• Qualitative data:
‐ are measures of ‘types’ or describes qualities or characteristics
‐ data about categorical variables
‐ e.g. day of the week, sex, educational attain
Data types (cont’d)
Statistical foundations and dealing with data:
• Descriptive statistics
• Data types
• Future values and present values
• Money has time value
‐ receipt of a given amount of money is worth a different amount
depending on when it is received
• As a result of the time value of money, we cannot simply combine
cashflows in their raw form into financial calculations if they are received
at different points in time
• So, we either transform all cashflows to the amount that they would be
worth at some given point in the future (the future value) or we transform
all future cashflows into the equivalent amount that they would be worth if
received today (the present value)
Future values and present values
• The sum of money at the end of the period would be given by
PT =P0 × (1+r)
T
where PT denotes the FV of the account, r is the interest rate, P0 is the
amount placed in the account now, and T is the number of time periods for
which the money is invested
• Example – Suppose that we place £100 in a bank savings account for five
years, paying an annual interest rate of 2%
• the FV of the investment at the end of the first year: PT =
• at the end of the second year: PT =
• at the end of the fifth year: PT =
• In this case the interest is compounded annually – interest is paid this year
on the total value of this year’s end savings
Future values
• Rearrange the FV formula:
r = [PT / P0]
1/T − 1
• For example, if we make an initial investment of £1000 and no further
investments, and we leave the funds for ten years, what rate of interest is
required to enable us to achieve a sum of £1500 by the end of the
decade?
• The calculation is: r =
Future values – calculating the interest rate
• Rearrange the FV formula:
• For example, if we can invest £1000 initially and wish it to grow to
£2000, assuming an interest rate of 10%, how many years do we need
to wait?
T =
Future values – calculating the time
• What if the interest will be received more frequently, rather than annually
•
where n = number of compounding periods per year
• Continuous compounding:
‐ as the compounding frequency increases and so we have more and more
shorter and shorter time periods (i.e., we move from annual to monthly
to weekly to daily to hourly compounding and so on), we would
eventually reach a situation where the time period was infinitesimally
small
‐ PT = P0e
rT
‐ e.g. If T = 5 and r = 2% and interest is continuously compounded,
PT = e
0.02× 5 = £110.52.
Compounding frequency
• In the case of PV, we use a discount rate, which is the rate at which we
would reduce the future payment into today’s terms
• P0 = PT / (1+r)
T
• Example: What is the present value of £100 to be received in five years’
time if the discount rate is 2%?
P0 = £100/(1 + 0.02)
5 = £90.57
• This shows that £100 in five years’ time is worth £90.57 in today’s money
terms
Present value
•Present value calculations for pricing bonds
• Simple returns or log returns
where Rt denotes the return at time t
pt denotes the asset price at time t
ln denotes the natural logarithm
• We ignore any dividend payments, or alternatively assume that the price
series have been already adjusted to account for them.
• Simple return directly measures the absolute change in value, while log
return measures the relative change on a logarithmic scale
Returns in Financial Modelling
%100
1
1
−
=
−
−
t
tt
t
p
pp
R %100ln
1
=
−t
t
t
p
p
R
• There are a number of reasons for this:
1. They have the nice property that they can be interpreted as continuously
compounded returns.
2. Can add them up, e.g. if we want a weekly return and we have calculated
daily log returns:
r1 = ln p1/p0 = ln p1 - ln p0
r2 = ln p2/p1 = ln p2 - ln p1
r3 = ln p3/p2 = ln p3 - ln p2
r4 = ln p4/p3 = ln p4 - ln p3
r5 = ln p5/p4 = ln p5 - ln p4
⎯⎯⎯⎯⎯
ln p5 - ln p0 = ln p5/p0
Use of log returns
• There is a disadvantage of using the log-returns. The simple return on a
portfolio of assets is a weighted average of the simple returns on the
individual assets:
• But this does not work for the continuously compounded returns.
A Disadvantage of using Log Returns
R w Rpt ip it
i
N
=
=
1
• The general level of prices has a tendency to rise most of the time
because of inflation
• We may wish to transform nominal series into real ones to adjust them for
inflation
• This is called deflating a series or displaying a series at constant prices
• We do this by taking the nominal series and dividing it by a price deflator:
real seriest = nominal seriest 100 / deflatort
(assuming that the base figure is 100)
• We only deflate series that are in nominal price terms, not quantity terms
Real Versus Nominal Series
• If we wanted to convert a series into a particular year’s figures (e.g.
house prices in 2010 figures), we would use:
real seriest = nominal seriest deflatorreference year / deflatort
• Often the consumer price index, CPI, is used as the deflator series
Deflating a Series