Get Started

Time series run chart

1. Time series run chart

Howdy. You now have some initial exploration of time series data and analysis under your belt. Now, let's take a deeper dive into the most frequent type of chart used to visualize this data and relevant metrics for analysis.

2. Visualizing a time series

In the previous exercises, you analyzed time-based variables using column or bar charts. Though useful for evaluating frequency and other metrics between time intervals, such as year...

3. Visualizing a time series

...and month...

4. Visualizing a time series

...as your analysis moves towards a day-level grain, they can become too crowded. The more common and effective graph at this point is to use a run chart.

5. What is a run chart?

A run chart is a graph which displays data in a time sequence. As you may have observed, it is simply a line chart. Here we see the New Germany Fund closing stock price for each day between June 2014 and May 2018. The line chart allows for finer detail without clutter. Likewise, it is easier to start understanding the broader trend.

6. Patterns in a time series

Two important types of trend patterns you might observe are cyclical and seasonality. A cyclical pattern exists when data exhibit rises and falls that are not of a fixed period. This pattern will usually occur over more than a year and not be very predictable in when it will rise or fall.

7. Patterns in a time series

Seasonality exists when a time series is influenced by seasonal factors (e.g., the quarter of the year, the month, or day of the week). It is always of a fixed and known period. For example, swimming pool attendance increases in the hotter months.

8. Evaluating the trend in the time series

Similar to what we did with scatter plots and evaluating relationships, one way to add a visual representation of the trend is a line. Here, the trend line informs us that as time increases, so does the stock price for this fund. However, it is obvious that the stock price does not follow a linear trend but rather something curvy and non-linear.

9. Trends with rolling averages

A common method for understanding the underlying trend for the time series is known as rolling, or moving, average. It is the average of the data point values over a specified time window, or the number of days to use in the average calculation. Here, we see the 7-day rolling average of the stock prices as a dark blue line.

10. Smoothing with rolling averages

This rolling average trend is also known as "smoothing". It is a technique which helps remove some of the random variation, the sporadic ups and downs, observed in the data. Removing the light-gray line representing the underlying data, we are left with the smoother 7-day rolling average trend.

11. Smoothing with rolling averages

The window size can be adjusted to make the trend line smoother or follow the underlying data more tightly. Here we see a rolling average of 14 days...

12. Smoothing with rolling averages

...and 28 days. As you may have noticed, the larger the window size, the smoother the trend line. The window size you use for analysis will depend on the data and the ultimate goal.

13. Anomalies in a time series

Similar to the distribution of a single variable, outliers can be detected with time series as well. In this case, they are often referred to as "anomalies". Looking again at the 28-day rolling average line chart...

14. Anomalies in a time series

...the dark grey circle highlights a possible anomaly in the time series. We won't be covering the exact math and process here in this lesson. Quite simply, an anomaly is a point in the time series which falls outside of the expected trend.

15. Let's practice!

Now it's your turn to build time series line charts and calculate rolling averages.