Notities en screenshots van Gretl van Computer Sessions voor het vak Onderzoeksmethoden in Finance, in de master Handelswetenschappen - Finance en Riskmanagement. *Beoordeling(sterren)/feedback wordt geapprecieerd.*
Empirical Finance: Complete formula overview per topic
All for this textbook (4)
Written for
Universiteit Gent (UGent)
Handelswetenschappen
Onderzoeksmethoden in Finance
All documents for this subject (4)
2
reviews
By: jfdj • 3 year ago
By: SofieDesmet • 3 year ago
Seller
Follow
joycel_hw
Reviews received
Content preview
Academiejaar 2019-2020
IN FINANCE
COMPUTER SESSIONS
Joyce Lefevere
Master of Science Handelswetenschappen – Finance & Risicomanagement
Academiejaar 2019-2020 – 1ste semester
Prof. K. Inghelbrecht
,J.L
Deze notities werden gemaakt aan de hand van de computer sessions van professor K.
Inghelbrecht voor het vak ‘Onderzoeksmethoden in Finance’.
BIBLIOGRAFIE
Brooks, C. (2019). Introductory econometrics for finance. Fourth edition. Cambridge: Cambridge
University Press.
Inghelbrecht, K. (2019). Onderzoeksmethoden in Finance.
,J.L
1. GRETL, DATA HANDLING AND SIMPLE REGRESSION – INTRODUCTION TO GRETL 1
1. Import data 1
2. Transform data 3
3. Plot Data 4
1- Time series plot 4
2- XY-plot 6
3- Histogram 7
4. Descriptive statistics 8
Mean and variance 8
Correlations 9
5. Simple regression 10
Example 10
OLS estimation of linear model 11
Residual analysis 13
Goodness of Fit Statistics: R2 14
Statistical tests 15
6. Exercise 21
2. MULTIPLE REGRESSION AND DIAGNOSTIC TESTS FOR CROSS-SECTIONAL DATA 23
1. Multiple regression 23
Introduction 23
OLS estimation of multiple regression model 24
Residual analysis 25
Outliers 26
2. Pitfalls in regression models using cross-sectional data 29
1- Omitted variable bias 29
2- Multicollinearity 31
3- Heteroskedasticity 33
3. Regression with dummy variables 38
4. Exercises 40
Exercise 1: Wage discrimination 40
Exercise 2: Earnings 41
3. DIAGNOSTIC TESTS FOR TIME SERIES DATA – PITFALLS USING TIME SERIES VARIABLES AND
DYNAMIC MODELS 43
1. Working with time series data 43
Example 1 43
Simple regression model 44
Outliers 45
2. Pitfalls using time series variables 47
1. Omitted variable bias 48
2. Multicollinearity 49
3. Heteroskedasticity 50
3. Additional pitfall: Residual autocorrelation 54
Detection 54
Time series data: Example 2 58
Solutions 60
4. Exercises 66
IN FINANCE | Computer Sessions | A
,J.L
Exercise 1: Phillips curve 66
4. (1) MODELLING LONG-RUN RELATIONSHIPS IN FINANCE: NON-STATIONARITY AND UNIT ROOT
TESTING 67
1. Detecting nonstationary time series 67
Example: Stock prices on the NYSE 67
Time series plots 68
Autoregressive model 68
2. Unit root test 70
Dickey-Fuller test 70
Extension 1: Deterministic trend 71
Extension 2: Lags of ∆yt 71
Augmented Dickey-Fuller test 71
3. Exercises 75
Exercise 1: US Interest Rates 75
4. (2) MODELLING LONG-RUN RELATIONSHIPS IN FINANCE: COINTEGRATION AND ERROR
CORRECTION MODEL 77
1. Example 1: Interest rates 77
1- Stationarity? 78
2- Cointegration? 80
3- Spurious regression 85
4- Regression of differences 85
5- Heteroskedasticity? 86
6- Residual autocorrelation? 87
2. Example 2: Spot and forward rates 91
1- Stationarity? 91
2- Cointegration? 92
3- Error correction model 94
4- Heteroskedasticity? 96
5- Residual autocorrelation? 97
3. Exercises 97
Exercise 1: Purchasing power parity 97
Exercise 2: Profits and dividends 98
5. MULTIVARIATE MODELS 99
1. Vector autoregressions (VAR) 99
Granger causality 99
VAR: Estimation 103
Example 105
VAR: Lag length selection 108
VAR: Forecasting 112
VAR: Impulse responses 114
2. Exercises 115
Exercise 1: GDP and Money Supply 115
6. MODELS FOR PANEL DATA 117
1. Panel data 117
Example 117
Import data 118
Transform data 119
IN FINANCE | Computer Sessions | B
,J.L
Analyse data 119
2. Panel data models 121
Steps to follow 122
1. Pooled model 122
2. Individual effects models 124
2.1. Fixed effects model 124
2.2. Random effects model 128
Hausman test : FE versus RE 130
Conclusion 130
Overzichtsschema van beslissingen ivm keuze model 131
3. Exercises 132
Exercise 1 132
7. LIMITED DEPENDENT VARIABLE MODELS 133
1. Limited dependent variable LDV models 133
Example 133
Import data 133
Analyse data 134
1. Linear probability model 135
2. Logit and Probit models 137
Conclusion 140
2. Exercises 141
Exercise 1 141
IN FINANCE | Computer Sessions | C
,J.L
,J.L
Gretl
1. GRETL, DATA HANDLING AND SIMPLE REGRESSION –
INTRODUCTION TO GRETL
ù Gnu Regression, Econometrics and Time-Series Library
ù Gretl is an econometrics package with a graphical user interface
ù Features
Data analysis
Regression analysis (OLS, GLS)
Univariate time series analysis (AR, unit root)
Import data
Multivariate time series analysis (VAR, VEC)
Volatility modeling
Import data Panel data
Qualitative choice models
...
1. Import data
ù Ufora/Datasets/fortis.xls
ù Frequency: Monthly data (end-of-the-month) Altijd interessant om data in Excell al
eens te bekijken
OMF - Computer Session 1 (Slides)
ù Period: January 1973 to September 2008
ù Source: Datastream
ù Seven variables: Markt index = BEL20 index
1. Price Fortis (P)
Price Index Fortis (PI)
2.
3. Total Return Index Fortis (TRI)
Werkblad Selection is de data die we echt
4. Dividend Yield Fortis (DY) gaan gebruiken
5. Market Value Fortis (MV)
6. BEL-20 Total Return Index (BEL20)
7. Risk-free rate (1-Month Treasury Bill Belgium) (RF)
- PI = prijsindex = toont de verandering van het onderliggende aandeel
- TRI = prijs incl. dividenden (dus
- DY = div/prijs
OMF - Computer Session 1 (Slides)
- MV = totale waarde van alle aandelen
- BEL 20 – total return prijs index = geeft gemiddelde prijs weer van 20 grootste aandelen
(ook inclusief dividenden)
Import data
- RF
Import data = risicovrije rente (rente die je bekomt door
het investeren in schatkistcertificaat met looptijd
van 1 maand) → uitgedrukt op jaarbasis
ù Toolbar: File/Open Data/User File
ù Select Excel File (e.g. fortis.xls)
ù Select Name Sheet (e.g. Selection)
ù Select Column and Row number of first data point including name variable
(e.g. Column 2 - Row 1 )
ù Data structure wizard
Cross-sectional, Time-series, Panel (e.g. Time series)
Time series frequency (e.g. Monthly )
starting observation (e.g. 1973:01 )
ù Toolbar: File/Save Data (e.g. fortis.gdt)
Opmerking: enkel data vanaf 2e kolom
OMF - Computer Session 1 (Slides) gaan importeren (van blad Selection)
Er worden geen datums gevonden, aangezien we pas vanaf kolom 2 importeren.
ONDERZOEKSMETHODEN IN FINANCE | Computer Sessions | 1
,J.L
Daarom stelt Gretl de vraag of je de data als tijdsreeks of panel wil interpreteren.
→ Hier als tijdsreeks importeren → YES
Hier selecteren van time series Daarna ook frequentie aanduiden
(hier maand)
Hier startdatum van data opgeven (januari 1973)
Resultaat is dan volgende:
- Opsomming van de variabelen
- Overzicht van de data range
Ook data Opslaan: File/Save Data/… als .gdt
ONDERZOEKSMETHODEN IN FINANCE | Computer Sessions | 2
, J.L Transform data
2. Transform
Transform datadata
Hoe binnen Gretl transformaties doorvoeren?
Dubbelklikken op variabelen zorgt dat je alle waarden ziet.
ù Display values: Double-click variables (e.g. TRI ) Bepalen rendement van Fortis
ù Generate new variable: e.g. return Fortis (hoeveel kunnen we elke maand
Toolbar: Add/Define new variable... verdienen met Fortis, is dus
Compute return based on total return index (TRI) and define it as R
R = (TRI-TRI(-1))/TRI(-1) eigenlijk een verandering)
Exercise: Compute market return based on BEL-20 total return index
(BEL20) and define it as RM
Exercise: Compute return based on price index (PI) and define it as R2
En variabele dan een naam geven
ù Build in options: log, squares, etc
Select variable(s)
Toolbar: Add/Logs of selected
Transform data variables
Toolbar: Add/Squares of selected variables
Transform data
Transform data
Transform data
OMF - Computer Session 1 (Slides)
ù Display values: Double-click variables (e.g. TRI )
ù Generate new variable: e.g. return Fortis
Formule zelf invoegen en TRI(-1) staat voor de waarde uit de
Toolbar: Add/Define new variable...
vorige
Compute return based on total return index periode.
(TRI) and define it as R
ù Display values: Double-click variables (e.g. TRI )
R = (TRI-TRI(-1))/TRI(-1)
ù Generate new variable: e.g. return
Exercise: Compute market returnFortis
based on BEL-20 total return index
Toolbar: Add/Define
(BEL20) and new
define it as RMvariable...
Compute
Exercise: return based
Compute on total
return basedreturn index
on price (TRI)
index and
(PI) define
and it it
define asas
R R2
R = (TRI-TRI(-1))/TRI(-1)
ù Build in options: log, squares, etc
Exercise: Compute market return based on BEL-20 total return index
Select variable(s)
(BEL20) and define it asTransform
RM data
Er zijn ook een Add/Logs
Toolbar: aantal transformaties
of selected mogelijk, en zijn zelf voorgedefinieerd
variables
Exercise: Compute return based on price index (PI) and define it as R2
Toolbar: Add/Squares of selected variables
Transform data
ù Build in options: log, squares, etc
Select variable(s)
Toolbar: Add/Logs of selected variables
Toolbar: Add/Squares of selected variables
OMF - Computer Session 1 (Slides)
ù Log return: ln(Yt ) ≠ ln(Yt≠1 )
1. Toolbar: Add/Log di↵erences of selected variables
OMF - Computer Session 1 (Slides)
2. Toolbar: Add/Define new variable...
LR=ln(TRI)-ln(TRI(-1))
ù Risk-free
Bv. Logs (ln)rate
Toolbar: Add/Define new variable...
→ kan op twee manieren (via variabele zelf definiëren) of via
RF = (RF/100)/12
voorgedefinieerde variabelen
ù Excess returns Fortis
Is ook een benadering vannew
Toolbar: Add/Define hetvariable...
rendement.
ER = R - RF
Exercise: Compute excess return BEL-20 and define it as ERM
Variabele selecteren en dan kiezen voor ‘log
differences of selected variables’
OMF - Computer Session 1 (Slides)
ONDERZOEKSMETHODEN IN FINANCE | Computer Sessions | 3
, ù Log return: ln(Yt ) ≠ ln(Yt≠1 )
1. Toolbar: Add/Log di↵erences of selected variables
2. Toolbar: Add/Define new variable...
J.L LR=ln(TRI)-ln(TRI(-1))
ù Risk-free rate Transform data
Toolbar: Add/Define new variable...
Transform
RF = data
(RF/100)/12
ù Excess returns Fortis
Transformatie van risicovrije rente
Toolbar: Add/Define new variable...
Is nu uitgedrukt
ER = R - RFop jaarbasis, in %
→ Rendementen die weexcess
Exercise: Compute berekend
return hebben
BEL-20 and(Rdefine
en RM)it aszijn
ERMuitgedrukt in decimalen en op
maandbasis
ù Log return: ln(Yt ) ≠ ln(Yt≠1 )
Dus: 1.
deToolbar:
risicovrije rente di↵erences
Add/Log moet ookofuitgedrukt worden in decimalen en op jaarbasis
selected variables
Dus: via define new variable
2. Toolbar: Add/Define new variable...
LR=ln(TRI)-ln(TRI(-1))
(hier wordt de oorspronkelijk data overschreven door de nieuwe variabelen,
OMF - Computer Session 1 (Slides)
kan soms niet goed
ù Risk-free rate
zijn aangezien data verloren gaat,
Toolbar: Add/Define new variable... maar hier oke)
RF = (RF/100)/12
ù Excess returns Fortis
Toolbar: Add/Define new variable...
ER = R - RF
Exercise: Compute excess return BEL-20 and define it as ERM
Excess rendement = rendement van het aandeel bovenop de risicovrije rente
Ook voor marktrendement
Plot Data Time series plot
OMF - Computer Session 1 (Slides)
3. Plot
Time Dataplot
series
Hoe ziet onze er data eruit?
1- Time series plot
ù Toolbar: View/Graph specified vars/Time series plot...
ù Select variables (e.g. TRI and PI )
ù Save plot
Click plot
Save as...
ù Toolbar: View/Multiple Graphs/Time series...
Question: How can we explain the di↵erence between TRI and PI? When do
you work with PI and when with TRI?
ù Exercise: Make a time series plot of the return of Fortis and the return of
the Bel-20 index. What do you conclude?
Optie 1:
OMF - Computer Session 1 (Slides)
En daarna opgeven van welke variabele(n) je die plot wil maken
ONDERZOEKSMETHODEN IN FINANCE | Computer Sessions | 4
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller joycel_hw. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $7.00. You're not tied to anything after your purchase.