Python Guide to Accompany Introductory Econometrics for Finance

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

This free software guide for Python with freely downloadable datasets brings the econometric techniques to life, showing readers how to implement the approaches presented in Introductory Econometrics for Finance using this highly popular software package. Designed to be used alongside the main textbook, the guide will give readers the confidence and skills to estimate and interpret their own models while the textbook will ensure that they have a thorough understanding of the conceptual underpinnings. Guide draws on material from ‘Introductory Econometrics for Finance’, published by Cambridge University Press, Chris Brooks (2019) & is intended to be used alongside the book*; page numbers from the book are given after each section and subsection heading. Code and data sets are available at https://www.cambridge.org/gb/academic/subjects/economics/finance/introductory-econometrics-finance-4th-edition?format=PB&isbn=9781108422536 *https://library.bz/main/uploads/84D576786C2A3047E2974B05DF293A6E

Author(s): Ran Tao, Chris Brooks
Edition: 4
Publisher: ICMA Centre, University of Reading
Year: 2019

Language: English
Commentary: Date Written: October 25, 2019 | Last revised: 9 Nov 2021
Pages: 175
Tags: Python; Financial Econometrics; Finance Programming

1 Getting started
1.1 What is Python? . . . . . . . . . . . . . . .
1.2 Different ways to run Python code . . . .
1.3 What does a Jupyter NoteBook look like?
1.4 Getting help . . . . . . . . . . . . . .
2 Data management in Python
2.1 Variables and name rules . . . . . . . . . . . . . . . . . . . . .
2.2 Whitespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.3 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4 Mathematical operations . . . . . . . . . . . . . . . . . . . . .
2.5 Two libraries: Pandas and NumPy . . . . . . . . . . . . . . .
2.6 Data input and saving . . . . . . . . . . . . . . . . . . . . . .
2.7 Data description and calculation . . . . . . . . . . . . . . . .
2.8 An example: calculating summary statistics for house prices
2.9 Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.10 Saving data and results . . . . . . . . . . . . . . . . . . . . . .
3 Simple linear regression - estimation of an optimal hedge ratio 27
4 Hypothesis testing - Example 1: hedging revisited 31
5 Estimation and hypothesis testing - Example 2: the CAPM 33
6 Sample output for multiple hypothesis tests 39
7 Multiple regression using an APT-style model
7.1 Stepwise regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
8 Quantile regression 49
9 Calculating principal components 57
10 Diagnostic testing
10.1 Testing for heteroscedasticity . . . . . . . . . . . . . . . . .
10.2 Using White’s modified standard error estimates . . . . . .
10.3 The Newey-West procedure for estimating standard errors
10.4 Autocorrelation and dynamic models . . . . . . . . . . . .
10.5 Testing for non-normality . . . . . . . . . . . . . . . . . . .
10.6 Dummy variable construction and use . . . . . . . . . . . .
10.7 Multicollinearity . . . . . . . . . . . . . . . . . . . . . . . . .
10.8 The RESET test for functional form . . . . . . . . . . . . . .
10.9 Stability tests . . . . . . . . . . . . . . . . . . . . . . . . . . .
11 Constructing ARMA models 80
12 Forecasting using ARMA models 85
13 Estimating exponential smoothing models 89
14 Simultaneous equations modelling 91
15 The Generalised method of moments for instrumental variables 94
16 VAR estimation 97
17 Testing for unit roots 106
18 Cointegration tests and modelling cointegrated systems 109
19 Volatility modelling
19.1 Testing for ’ARCH effects’ in exchange rate returns .
19.2 Estimating GARCH models . . . . . . . . . . . . . .
19.3 GJR and EGARCH models . . . . . . . . . . . . . . .
19.4 Forecasting from GARCH models . . . . . . . . . . 121
20 Modelling seasonality in financial data
20.1 Dummy variables for seasonality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
20.2 Estimating Markov switching models . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
21 Panel data models 137
22 Limited dependent variable models 142
23 Simulation methods
23.1 Deriving critical values for a Dickey-Fuller test using simulation . . . . . . . . . . . . . 150
23.2 Pricing Asian options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
23.3 VaR estimation using bootstrapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
24 The Fama-MacBeth procedure 160
25 Using extreme value theory for VaR calculation 164