TIME SERIES ANALYSIS WITH
PYTHON
Aileen Nielsen
July, 13, 2016
aileen.a.nielsen@gmail.com
INSTALLATION INSTRUCTIONS
• Please install Conda per ‘quick install’ instructions:
http://conda.pydata.org/docs/install/quick.html
• Make sure you have the following packages installed:
•
•
•
•
•
pandas
numpy
Statsmodels
scikit-learn
scipy
• These would be good to have but are not essential:
•
•
pytz
hmmlearn
OUTLINE
• Why time series?
• Quick Pandas intro
• Dealing with dates in Pandas
• Reading + manipulating time-stamped data
• Common time series analytical tools
• Prediction
• Classification
CAVEATS
• Time series analysis is a particularly tricky & controversial field
• I’ll give some background as we move ahead, but you need to
read more when you want to do a real analysis
• Tests for goodness of fit, etc, are particularly error prone in time
series analysis
• Whenever I don’t specify, but should, assume it’s iid normally
distributed (‘error’ terms)
WHAT’S SPECIAL ABOUT
TIME SERIES?
WHERE DO TIME SERIES POP UP?
• Many of the most controversial
questions arise from time series
analysis
• Whenever we want to know the
future, we’re pretty much stuck with
time series analysis
• Ditto for thinking about causality in
‘natural experiments’
http://www.amstat.org/publications/jse/v21n1/witt.pdf
http://www.forbes.com/sites/neilhowe/2015/05/28/whats-behind-the-decline-in-
crime/#3e1e6be07733
SPEECH RECOGNITION
http://www.amstat.org/publications/jse/v21n1/witt.pdf
http://www.forbes.com/sites/neilhowe/2015/05/28/whats-behind-the-decline-in-
crime/#3e1e6be07733
PHYSICS EXPERIMENTS