Giter Site home page Giter Site logo

acdick / dsc-3-26-05-correlation-and-autocorrelation-in-time-series-lab-nyc-ds-career-031119 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from learn-co-students/dsc-3-26-05-correlation-and-autocorrelation-in-time-series-lab-nyc-ds-career-031119

0.0 1.0 0.0 822 KB

License: Other

Jupyter Notebook 100.00%

dsc-3-26-05-correlation-and-autocorrelation-in-time-series-lab-nyc-ds-career-031119's Introduction

Correlation and Autocorrelation in Time Series - Lab

Introduction

In this lab, You'll practice your knowledge on correlation, autocorrelation and the ACF and PACF.

Objectives

You will be able to:

  • Understand correlation in Time Series
  • Plot and discuss the autocorrelation function (ACF) for a time-series
  • Plot and discuss the partial autocorrelation function (PACF) for a time-series
  • Interpret ACF and PACF and Identify use cases both functions

The Exchange Rate Data

We'll be looking at the exchange rates dataset again. First, import the necessary libraries for time series and plotting. Then import the data (in exch_rates.csv) and make sure it's set in the correct time series format with the datetime as the index.

# your code here
# your code here

Plot the three exchange rates in one plot

# your code here

You can see that the EUR/USD and AUD/USD exchange rate are somewhere between rougly 0.5 and 2 between 2000 and 2018, where the Danish Krone is somewhere between roughly 4.5 and 9. Now let's look at the correlations between these time series.

# your code here

What is your conclusion here? You might want to use outside resources to understand what's going on.

Next, look at the plots of the differenced series. Use subplots to plot them rather than creating just one plot.

# your code here
# your code here
# your code here

Explain what's going on

Next, let's look at the "lag 1 autocorrelation" for the EUR/USD exchange rate. Create a "lag 1 autocorrelation" series, plot the result, and look at the correlation coefficient.

# your code here
# your code here
# your code here

Repeat this, but for a "lag 5 autocorrelation"

# your code here
# your code here

What's your conclusion here?

Knowing this, let's plot the ACF now.

# your code here

The series is heavily autocorrelated at first, and then there is a decay. This is a typical result for a series that is a random walk, generally you'll see heavy autocorrelations first, slowly tailing off until there is no autocorrelation anymore.

Next, let's look at the Partial Autocorrelation Function.

# your code here

This is interesting! Remember that Partial Autocorrelation Function gives the partial correlation of a time series with its own lagged values, controlling for the values of the time series at all shorter lags. When controlling for 1 period lags, the PACF is only very high for one-period lags, and basically 0 for shorter lags. This is again a typical result for Random Walk series!

The Airpassenger Data

Look at ACF and PACF for the airpassenger data and describe the result passengers.csv. Do this both for the differenced and regular series.

# your code here
# your code here
# your code here
# your code here
# your code here
# your code here
# your code here

Your conclusion here

The NYSE data

Look at correlation and autocorrelation functions for the NYSE data ("NYSE_monthly.csv")

# your code here
# your code here
# your code here

Your conclusion here

Summary

Great, you've now been introduced to correlation, the ACF and PACF. Let's move into more serious modeling with autoregressive and moving average models!

dsc-3-26-05-correlation-and-autocorrelation-in-time-series-lab-nyc-ds-career-031119's People

Contributors

loredirick avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.