CS计算机代考程序代写 data structure finance algorithm Empirical Techniques and Applications in Finance

Empirical Techniques and Applications in Finance
Raphael Park
University of New South Wales
jonghyeon.park@unsw.edu.au
February 18, 2020
The slides greatly benefit from lecture notes of Dr. Wing Wah Tham and Dr. Jaehoon Lee
Raphael Park (UNSW) MFIN6201 February 18, 2020 1 / 56

Class overview
Learn methods for estimating causal effects using observational data
Learn some tools that can be used for other purposes; for example, forecasting using time series data;
Focus on applications, theory is used only as needed to understand the whys of the methods;
Learn to evaluate the regression analysis of others. You will be able to read/understand empirical finance papers in other finance courses;
Get some hands-on experience with regression analysis in your practice problem sets.
Raphael Park (UNSW) MFIN6201 February 18, 2020 2 / 56

Overview of today’s lecture
Read (SW Chapters 1, 2, 3) Topics
Review of Statistical Theory
The probability framework for statistical inference
Estimation Hypothesis testing Confidence interval
Raphael Park (UNSW) MFIN6201 February 18, 2020 3 / 56

Lecture resources
Lectures
Practice exercises
Case studies Assignments Consultation
5pm-6pm Tuesday at ABS 365 for week 1, 3-6 by appointments
Raphael Park (UNSW) MFIN6201 February 18, 2020 4 / 56

What is Econometrics?
The science and art of using economic theory and statistical techniques to analyze economic data.
Statistics + economics
Standard assumptions in statistics
Nature of economic data
Financial econometrics = econometrics + finance
Use econometrics techniques to study a variety of problems from finance
Focus on hypothesis testing, causal inference and forecasting
Raphael Park (UNSW) MFIN6201 February 18, 2020 5 / 56

Types of data in finance
Studies varying across entities (e.g., firms, individuals, etc.):
cross-sectional data
Studies varying across time: time-series data
Study variations both across firms and through time using panel data
Can you visualize the data structure? Cross-sectional vs. time series vs. panel data Answer: See Stock and Watson Chapter 1.3
Raphael Park (UNSW) MFIN6201 February 18, 2020 6 / 56

Brief overview of the first part of the course
Economics and financial theories suggest important relations, often with policy implications, but virtually never suggests quantitative magnitudes of causal effects.
What is the quantitative effect of independent board members on firm performance?
What is the quantitative effect of high frequency trading on market quality?
What is the quantitative effect on asset prices of a 1 percentage point increase in interest rates by the Fed?
What is the magnitude for the price of risk across different financial assets?
We need to carry out empirical analysis to answer these questions with rigor!
Raphael Park (UNSW) MFIN6201 February 18, 2020 7 / 56

How to carry out empirical analysis in finance?
To measure causal effect, we would ideally like an experiment with random assignment of treatment to achieve treatment and control groups
Why randomized experiments? ⇒ Sample selection bias
Raphael Park (UNSW) MFIN6201 February 18, 2020 8 / 56

How to carry out empirical analysis in finance?
Example: medical research
Treatment group : given new drugs
Control group : given placebo (usually vitamin) Treatment effect : difference between the two groups
Example: financial research
Firms with high cashflows make larger investments. What is its implication?
Firms that invest in social responsibility perform better?
Raphael Park (UNSW) MFIN6201 February 18, 2020 9 / 56

How to carry out empirical analysis in finance?
But almost always we only have observational (non-experimental) data Independent board of directors and algorithmic traders
Monetary policy
Part of the course deals with difficulties arising from using observational to estimate causal effects
confounding effects (omitted factors) simultaneous causality
“correlation does not imply causation”
Raphael Park (UNSW) MFIN6201 February 18, 2020 10 / 56

An empirical example: class size and education output
Question: What is the effect on test scores (or some other outcome measure) of reducing class size by one student per class? by 8 students/class??
We must use data to find out (is there any way to answer this without data?)
Raphael Park (UNSW) MFIN6201 February 18, 2020 11 / 56

Using data for empirical analysis
The California Test Score Data Set – see SW chapter 1.3
California school districts (n = 420) in 1999 Variables:
fifth grade test scores (combined math and reading),
district average Student-teacher ratio (STR) = no. of students in the district divided by no. full-time equivalent teachers
Raphael Park (UNSW) MFIN6201 February 18, 2020 12 / 56

Initial look at the data
What is the relationship between test scores and the STR?
Raphael Park (UNSW) MFIN6201 February 18, 2020 13 / 56

Initial look at the data
What does this figure show? Answer: Eyeball econometrics
Raphael Park (UNSW) MFIN6201 February 18, 2020 14 / 56

Eyeball econometrics is not rigorous enough!
We need to get some numerical evidence on whether districts with low STRs have higher test scores but how?
Compare average test scores in districts with low STRs to those with high STRs (“estimation”).
Point estimation involves the use of sample data to calculate a single value (known as a statistic), which is served as the “best estimate” of an unknown (fixed or random) population parameter.
Test the null hypothesis that the mean test scores in the two types of districts are the same, against the “alternative” hypothesis that they differ (“hypothesis testing”).
Testing a hypothesis on the basis of observing a process that is modeled via a set of random variables.
Estimate an interval for the difference in the mean test scores, high v. low STR districts (“confidence interval”). A confidence interval is a type of interval estimate of a population parameter.
Raphael Park (UNSW) MFIN6201 February 18, 2020 15 / 56

What is next?
Or, you can use regression to measure the relation (i.e., the slope) between student-to-teacher ratios and average test scores.
Before turning to regression, however, we will review some of the underlying theory of estimation, hypothesis testing, and confidence intervals:
Why do these procedures work, and why use these rather than others? We will review the intellectual foundations of statistics and econometrics
Raphael Park (UNSW) MFIN6201 February 18, 2020 16 / 56

Review of Statistical Theory
Probability framework for statistical inference
Estimation
Testing
Confidence Intervals
Raphael Park (UNSW) MFIN6201 February 18, 2020 17 / 56

Probability framework for statistical inference
Population, random variable, and distribution
Moments of a distribution (mean, variance, standard deviation, covariance, correlation)
Conditional distributions and conditional means
Distribution of a sample of data drawn randomly from a population:
X1,···,Xn
Raphael Park (UNSW) MFIN6201 February 18, 2020 18 / 56

Population, random variable, and distribution
Population
The group or collection of all possible entities of interest (school districts)
We will think of populations as infinitely large
Random variable
Random variable is a variable whose value is subject to variations due to chance
As a result, it can take on a set of possible different values each with an associated probability
Numerical summary of a random outcome (district average test score, district STR)
Raphael Park (UNSW) MFIN6201 February 18, 2020 19 / 56

Discrete random variable
Example
X=
 1  2
 3  4
with probability 0.2 with probability 0.3 with probability 0.3 with probability 0.2
Raphael Park (UNSW)
MFIN6201
February 18, 2020
20 / 56

Discrete random variable: pdf
pdf (probability density function) f(x)≡P(X =x)
: the probability for a random variable X to be equal to a given constant, x
Raphael Park (UNSW) MFIN6201 February 18, 2020 21 / 56

Discrete random variable: cdf
cdf (cumulative distribution function) f(x)≡P(X =x)
: the probability for a random given constant, x
F(1)=P(X ≤1) F(2)=P(X ≤2) F(3)=P(X ≤3) F(4)=P(X ≤4)
variable X to be less than or equal to a
=0.2
=0.2+0.3 =0.2+0.3+0.3 =0.2+0.3+0.3+0.2
=0.2 =0.5 =0.8 =1
Raphael Park (UNSW)
MFIN6201
February 18, 2020
22 / 56

Discrete random variable: cdf
Raphael Park (UNSW) MFIN6201 February 18, 2020 23 / 56

Relation between pdf and cdf
cdf is a sum of pdf
F(x) =f(x)+f(x−∆)+···
= f (x ) + F (x − ∆) pdf is a difference of cdf
f(x) =F(x)−F(x−∆)
Raphael Park (UNSW) MFIN6201 February 18, 2020 24 / 56

Continuous random variable
For example,
Normal distribution (bell-shaped curve)
X ∼N(μ,σ2)
: X is drawn from a normal distribution with mean μ and variance σ2
pdf of the normal distribution
Raphael Park (UNSW) MFIN6201 February 18, 2020 25 / 56

Continuous random variable
pdf of continuous distribution is somehow different from the pdf of discrete distribution because P(X = x) = 0
Let’s begin with cdf
X = P(X ≤ x)
Raphael Park (UNSW) MFIN6201 February 18, 2020 26 / 56

pdf and cdf of continuous distribution
cdf is an integration of pdf
F(x) =
􏰞x −∞
f (t)dt
pdf is a differentiation of cdf
f(x)= dF(x)
dx
Raphael Park (UNSW) MFIN6201 February 18, 2020 27 / 56

pdf and cdf
cdf
pdf
Discrete: F(x) = 􏰃t≤x f (t)
Continuous: F(x) = 􏰝 x f (t) −∞
Discrete: f (x) = F(x) − F(x − ∆)
Continuous: f(x)= d F(x) dx
Raphael Park (UNSW)
MFIN6201
February 18, 2020
28 / 56

Probability density of stock returns
Raphael Park (UNSW) MFIN6201 February 18, 2020 29 / 56

Moments: mean
Mean (μ, average, expectation, expected value, 1st moment)
Example
􏰝 ∞ −∞
1 2 3 4
xf (x)dx (continuous)
with probability 0.2 with probability 0.3 with probability 0.3 with probability 0.2
E[X] ≡
􏰌 􏰃ni=1 xipi (discrete)
X=
 
 
E [X ] = 1 · 0.2 + 2 · 0.3 + 3 · 0.3 + 4 · 0.2 = 2.5
Raphael Park (UNSW)
MFIN6201
February 18, 2020
30 / 56

Moments: variance
Variance (σ2, 2nd moment) Var[X] ≡ Ep[(X − μ)2]
􏰌 􏰃ni=1(xi − μ)2pi
= 􏰝 ∞ (x − μ)2f (x)dx
(discrete) (continuous)
Standard deviation
−∞
std(X) = 􏰕Var[X]
Example
std(X) = Raphael Park (UNSW)
1.05 = 1.0247
MFIN6201 February 18, 2020 31 / 56
Var(X)=(1−2.5)2 ·0.2+(2−2.5)2 ·0.3
+(3−2.5)2 ·0.3+(4−2.5)2 ·0.2
= 1.05

Useful formulas
Expectation
Variance
E [a + bX ] = a + bE [X ]
E [X + Y ] = E [X ] + E [Y ]
Combined ,
E [aX + bY ] = aE [X ] + bE [Y ]
Var[a + bX] = b2Var[X]
Var[X +Y]=Var[X]+Var[Y]+2Cov[X,Y]
Combined ,
Var[aX +bY]=a2Var[X]+b2Var[Y]+2abCov[X,Y]
Raphael Park (UNSW) MFIN6201 February 18, 2020 32 / 56

Moments: sknewness, kurtosis
Skewness (3rd moment) = E[(X−μ)3] σ3
measure of asymmetry of a distribution
skewness = 0: distribution is symmetric
skewness > (<) 0: distribution has long right (left) tail Kurtosis (4th moment) = E[(X−μ)4] σ4 measure of mass in tails measure of probability of large values kurtosis = 3: normal distribution kurtosis > 3: heavy tails (leptokurtotic)
Raphael Park (UNSW) MFIN6201 February 18, 2020 33 / 56

Skewness and Kurtosis
Raphael Park (UNSW) MFIN6201 February 18, 2020 34 / 56

Covariance
Random variables X and Y have a joint distribution Covariance between X and Y is
Cov(X,Y)=E[(X −μx)(Y −μy)]=σxy
The covariance is a measure of the linear association between X and Y
cov(X, Y ) > 0 means a positive relation between X and Y
If X and Y are independently distributed, then Cov(X,Y) = 0 (but not vice versa!! – consider X ∼ N(0,1) and Y = X2)
The covariance of a r.v. with itself is its variance
Raphael Park (UNSW) MFIN6201 February 18, 2020 35 / 56

Correlation
Correlation is defined as
Corr(X,Y)=􏰕 =σσ =ρxy
Cov(X,Y) σxy Var(X)Var(Y) x y
1 ≤ corr(X,Y) ≤ 1
Cov(X,Y) > 0 means a positive relation between X and Y Corr(X,Y) = 1 mean perfect positive linear association Corr(X,Y) = 1 means perfect negative linear association Corr(X,Y) = 0 means no linear association
Raphael Park (UNSW) MFIN6201 February 18, 2020 36 / 56

Correlation examples
Two Bernoulli random variables
􏰌 1 with probability p
Mean
X,Y = 0 with probability 1−p E[X] = p · 1 + (1 − p) · 0 = p
Variance
Var[X] = E[(X − μ)2]
=p·(1−p)2 +(1−p)·(0−p)2 = p(1 − p)
Raphael Park (UNSW) MFIN6201 February 18, 2020 37 / 56

Correlation examples
Example 1: independent distributions
Y/X 1 0
1 p2 p(1-p) 0 p(1-p) (1-p)2
Covariance
Cov (X , Y ) = E [(X − μx )(Y − μy )]
=p2 ·(1−p)(1−p)+p(1−p)·(1−p)(0−p)
+p(1−p)·(0−p)(1−p)+(1−p)2 ·(0−p)(0−p) =0
Raphael Park (UNSW) MFIN6201 February 18, 2020 38 / 56

Correlation examples
Correlation
Cov(X,Y) Corr(X,Y) = 􏰕Var(X)Var(Y) = 0
Thus, independent distribution implies zero covariance/correlation, but not vice versa.
Raphael Park (UNSW) MFIN6201 February 18, 2020 39 / 56

Correlation examples
Example 2: perfect correlation
Y/X 1 0 1p0 0 0 1-p
Covariance
Cov (X , Y ) = E [(X − μx )(Y − μy )]
= p · (1 − p)(1 − p) + 0 · (1 − p)(0 − p)
+0·(0−p)(1−p)+(1−p)·(0−p)(0−p) = p(1 − p)
= Var(X)
Thus, perfect correlation implies that covariance is equal to ones own
variance
Raphael Park (UNSW) MFIN6201 February 18, 2020 40 / 56

Correlation examples
Correlation
Cov(X,Y) p(1−p) Corr(X,Y)= 􏰕Var(X)Var(Y) = p(1−p) =1
Thus, perfect correlation implies that correlation is equal to one
Raphael Park (UNSW) MFIN6201 February 18, 2020 41 / 56

Correlation
Raphael Park (UNSW) MFIN6201 February 18, 2020 42 / 56

Correlation
Corr(X, Y) ∈ (0, 1)
: When X is high, Y is likely, but not perfectly, to be high
Corr(X, Y) ∈ (-1, 0)
: When X is high, Y is likely, but not perfectly, to be low
Note: correlation does not imply causality
Example: incarceration rate is correlated to crime rate. Does it imply
that high incarceration causes more crimes? No!
Raphael Park (UNSW) MFIN6201 February 18, 2020 43 / 56

Bivariate density of stock returns
Raphael Park (UNSW) MFIN6201 February 18, 2020 44 / 56

Bayes theorem
The distribution of Y, given value(s) of some other random variable, X P(A|B) = P(A􏰹B)
P(B)
= P(B|A)P(A)
P(B)
Raphael Park (UNSW) MFIN6201 February 18, 2020 45 / 56

Conditional probability: example
Example: what is the probability for the first child to be a son if at least one of the two children is known to be a son?
P(first is a son | at least one is a son) = 23
= P(first is a son & at least one is a son) P(at least one is a son)
= 1/2 3/4
= 23
Raphael Park (UNSW) MFIN6201 February 18, 2020 46 / 56

Textbook example: Table 2.2
Joint distribution
Raphael Park (UNSW) MFIN6201 February 18, 2020 47 / 56

Textbook example: Table 2.2
Marginal distribution
P(Y =y)=􏰓P(X =xi,Y =y)
From the example,
P(rain) = 0.15 + 0.15 = 0.30 P(no rain) = 0.07 + 0.63 = 0.70 P(long commute) = 0.15 + 0.07 = 0.22 P(short commute) = 0.15 + 0.63 = 0.78
n i=1
Raphael Park (UNSW) MFIN6201 February 18, 2020 48 / 56

Textbook example: Table 2.2
Conditional distribution
P(Y = y|X = x) = P(X = x and Y = yB) P(X = x)
From the example,
P(long commute|rain) = 0.15
= 0.50 = 0.68 = 0.90
0.30 P(rain|long commute) = 0.15
0.22
P(short commute|no rain) = 0.63 0.70
Raphael Park (UNSW) MFIN6201
February 18, 2020
49 / 56

Conditional probability example: AIDS testing
Question
The probability that a patient has HIV is 0.001 and the diagnostic test for HIV can detect the virus with a probability of 0.98. Given that the chance of a false positive is 6%, what is the probability that a patient who has already tested positive really has HIV?
Raphael Park (UNSW) MFIN6201 February 18, 2020 50 / 56

Conditional probability example: AIDS testing
The following information is given from the question,
P(HIV) = 0.001 P(positive | HIV) = 0.98 P(positive | not HIV ) = 0.06
The question asks
P(HIV | positive) =???
Raphael Park (UNSW) MFIN6201 February 18, 2020 51 / 56

Conditional probability example: AIDS testing
Marginal distribution Bayes theorem
P(positive) = P(positive&HIV ) + P(positive&not HIV )
= P(positive|HIV ) · P(HIV ) + P(positive|not HIV ) · P(not HIV ) = 0.98 × 0.001 + 0.06 × 0.999
= 0.06092
Raphael Park (UNSW) MFIN6201 February 18, 2020 52 / 56

Conditional probability example: AIDS testing
Bayes theorem
P(HIV | positive) = P(positive|HIV ) · P(HIV ) P(positive)
= 0.98 × 0.001 0.06092
= 0.0161
Raphael Park (UNSW) MFIN6201 February 18, 2020 53 / 56

Conditional means
Conditional expectations and conditional moments E(Y|X =x)
Example: E(test scores|STR < 20) = the mean of test scores among districts with small class sizes Conditional variance: variance of conditional distribution Raphael Park (UNSW) MFIN6201 February 18, 2020 54 / 56 Conditional means Do you remember the classroom-size example? ∆ = E(test scores|STR < 20) − E(test scores|STR ≥ 20) Other examples of conditional means: Wages of all female workers (Y = wages, X = gender) Mortality rate of those given an experimental treatment (Y =live/die; X = treated/not treated) If E(X|Z) = const, then corr(X,Z) = 0 (not necessarily vice versa however) The conditional mean is a (possibly new) term for the familiar idea of the group mean Raphael Park (UNSW) MFIN6201 February 18, 2020 55 / 56 Practice questions Try question 2.1, 2.2, 2.3, 2.7, 2.10, 2.17, and 2.25. Answers will be provided next week. This is not an assessment. They are just for practice. Raphael Park (UNSW) MFIN6201 February 18, 2020 56 / 56