100% found this document useful (1 vote)
379 views835 pages

Yousef Time Series Analysis in Python 2020

This document provides an overview of time series analysis techniques in Python, including how to set up the environment, create time series objects from data, work with and visualize time series data, identify appropriate models like AR, MA, ARMA, ARIMA, GARCH for different types of time series patterns, measure volatility with ARCH models, and techniques for forecasting time series data. It includes Jupyter Notebook links demonstrating examples of various time series analysis and forecasting methods in Python.

Uploaded by

yousef shaban
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
100% found this document useful (1 vote)
379 views835 pages

Yousef Time Series Analysis in Python 2020

This document provides an overview of time series analysis techniques in Python, including how to set up the environment, create time series objects from data, work with and visualize time series data, identify appropriate models like AR, MA, ARMA, ARIMA, GARCH for different types of time series patterns, measure volatility with ARCH models, and techniques for forecasting time series data. It includes Jupyter Notebook links demonstrating examples of various time series analysis and forecasting methods in Python.

Uploaded by

yousef shaban
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 835

https://www.kaggle.

com/jagangupta/time-series-basics-exploring-traditional-ts

https://www.kaggle.com/thebrownviking20/everything-you-can-do-with-a-time-series
02 Setting Up the Environment

Why jupyter
Problem: Install three packages if you don’t have them.

1. matplotlib – a plotting library for Python and its numerical mathematics


extension NumPy

2. seaborn –  plotting library for Python and modeling in particular that is


based on matplotlib

3. arch - a statistical modelling package that we will employ throughout the


course

Solution:

1. Enter the Anaconda Prompt, as seen in the lecture and write:


pip install matplotlib

or
conda install matplotlib

You should receive a message that matplotlib is already installed (it comes
with Anaconda, remember?)

2. Enter the Anaconda Prompt, as seen in the lecture and write:


pip install seaborn

or
conda install seaborn

3. Enter the Anaconda Prompt, as seen in the lecture and write:


pip install arch
03 Introduction to Time Series in Python
013 Section-3-Introduction-to-Time-Series-Template
https://www.dropbox.com/s/59zz1ch8rabk5by/Section%203%20-%20Introduction%20to%20Time
%20Series%20-%20Template.ipynb?dl=0

013 Section-3-Introduction-to-Time-Series-Completed
https://www.dropbox.com/s/3ssi6wr8cuw1nkn/Section%203%20-%20Introduction%20to%20Time
%20Series%20-%20Completed%20.ipynb?dl=0
04 Creating a Time Series Object in Python
df_comp.dtypes
Out[8]:
date datetime64[ns]
spx float64
dax float64
ftse float64
nikkei float64
dtype: object

df_comp.date.describe()
Out[9]:
count 6269
unique 6269
top 1999-08-23 00:00:00
freq 1
first 1994-01-07 00:00:00
last 2018-01-29 00:00:00
Name: date, dtype: object
#Handling mssing values on DataSets

df_comp.isna()
df_comp.isna().sum()

df_comp.spx = df_comp.spx.fillna(method="ffill")
df_comp.isna().sum()

df_comp.ftse = df_comp.ftse.fillna(method="bfill")
df_comp.isna().sum()

df_comp.dax = df_comp.dax.fillna(value=df_comp.dax.mean())
df_comp.isna().sum()
017 Section-4-Creating-a-Time-Series-Object-in-Python-Template
https://www.dropbox.com/s/x50lb1h3dsb46bx/Section%204%20-%20Creating%20a%20Time
%20Series%20Object%20in%20Python%20-%20Template%20.ipynb?dl=0

017 Section-4-Creating-a-Time-Series-Object-in-Python-Completed
https://www.dropbox.com/s/nnrun96i0lvacs7/Section%204%20-%20Creating%20a%20Time
%20Series%20Object%20in%20Python%20-%20Completed%20.ipynb?dl=0

023 Appendix-Updating-the-Dataset
https://www.dropbox.com/s/b3eec9252hqqgkl/Updating%20The%20Data.ipynb?dl=0
05 Working with Time Series in Python
024 Section-5-Working-with-Time-Series-in-Python-Template
https://www.dropbox.com/s/qek5iy93vn9s058/Section%205%20-%20Working%20with%20Time
%20Series%20in%20Python%20-%20Template%20.ipynb?dl=0

024 Section-5-Working-with-Time-Series-in-Python-Completed
https://www.dropbox.com/s/yaz9ue79ao52wrv/Section%205%20-%20Working%20with%20Time
%20Series%20in%20Python%20-%20Completed%20.ipynb?dl=0
06 Picking the Correct Model
07 Modeling Autoregression The AR Model
08 Adjusting to Shocks The MA Model
046 Section-8-The-MA-Model-Template
https://www.dropbox.com/s/ikdi97raw63afmm/Sec
tion%208%20-%20The%20MA%20Model%20-
%20Template.ipynb?dl=0

046 Section-8-The-MA-Model-Completed
https://www.dropbox.com/s/jszpd43gay51jys/Sectio
n%208%20-%20The%20MA%20Model%20-
%20Completed.ipynb?dl=0
09 Past Values and Past Errors The ARMA Model
10 Modeling Non-Stationary Data The ARIMA
Model
\
prices
data
variables
11 Measuring Volatility The ARCH Model
dataFrame
Of Freedom
Than not
9
075 An ARMA Equivalent of the ARCH Model
12 An ARMA Equivalent of the ARCH The GARCH Model
Next
Variance
variances

11
Component
Have to match
Easier
Yesterday
Choice
31
13 Auto ARIMA
Sections

Include
D
AIC
14 Forecasting
Date ok
Results
Past
The testing set
15 Business Case

You might also like