ECON 0150 | Economic Data Analysis

The economist’s data analysis skillset.


Part 1.3 | Time Series (Numerical) Data

Time Series Numerical Data

Tracking a numerical variable over time

> Time series data: one entity, many points in time

> Numerical variable: values that change over time (price, GDP, temperature)

> Key question: What are the trends and patterns over time?

Timeseries: Coffee Prices

What price should we expect in January 2026?

date price
2000-01-03 1.0545
2000-01-04 1.0300
2000-01-05 1.0550
2000-01-06 1.0225
2000-01-07 1.0250

> how might we use this data to predict the price in January 2026?

Timeseries: Coffee Prices

What price should we expect in January 2026?

> it’s difficult to know… do we choose the mode?

> lets just organize prices by their ordered index, time

Timeseries: Coffee Prices

What price should we expect in January 2026?

> lets indicate with a line that these points are in squence

Timeseries: Line Graph

What price should we expect in January 2026?

Timeseries: Background Shading

What price should we expect in January 2026?

> with background shading its easier to see periods with a negative trend in price

Exercise 1.3 | Timeseries



Lets use a linegraph to examine the trends in coffee prices.

  • Data: Coffee_Prices.csv

Exercise 1.3 | Timeseries

# Lineplot
sns.lineplot(prices, y='price', x='date')

S-T-E for Line Graphs

What we just did

Step Action
SELECT Coffee prices 2015-2025
TRANSFORM Order by date
ENCODE Date → x-position; Price → y-position; Sequence → connected line

> ENCODE uses position for both time and value — the line shows sequence

Timeseries: Longer Periods

Are prices over long periods comparable?

> was coffee about as expensive in 1980 as it is today?

Timeseries: Longer Periods

A dollar in 1980 ≠ a dollar in 2025

> no! a dollar today is worth much less than in 1980

> we need to adjust for inflation to compare across time

Real Coffee Prices

Adjusting for inflation changes the picture

> prices have actually dropped since 1980 and stabilized since 2000

Exercise 1.3 | Real Price Adjustment

Is there a trend in the real price of coffee?



Lets transform coffee prices from nominal dollars to real dollars.

  • Data: Coffee_Prices_CPI.csv

Exercise 1.3 | Real Price Adjustment

Is there a trend in the real price of coffee?

# Create real price column
data['real'] = data['price'] / data['today']
# Lineplot of real prices
sns.lineplot(data, x='date', y='real')

S-T-E for Real Price Adjustment

What we just did

Step Action
SELECT Coffee prices 1980-2025 with CPI data
TRANSFORM Divide nominal price by CPI adjustment factor
ENCODE Date → x-position; Real price → y-position; Sequence → connected line

> TRANSFORM converts nominal dollars to real (inflation-adjusted) dollars

Timeseries: Original Question

What price should we expect in January 2026?

> timeseries lineplots show us about the trends but is there something specific in January?

Seasonality: January

What price should we expect in January 2026?

> a boxplot gives us a picture of the prices just in January

> lets compare this to other months

Seasonality: Monthly Boxplots

In addition to the overall trend, are there monthly patterns?

> lets be more specific…

Seasonality: Monthly Boxplots

In which month was the record highest price set?

Seasonality: Monthly Boxplots

In which month was the record highest price set?

> look at the maximums

Seasonality: Monthly Boxplots

In which month was the record highest price set?

Seasonality: Monthly Boxplots

In which season are prices most spread out?

Seasonality: Monthly Boxplots

In which season are prices most spread out?

> look at the ranges

Seasonality: Monthly Boxplots

In which season are prices most spread out?

Seasonality: Multi-Boxplot

What is the trend in median price?

> look at the medians…

Seasonality: Quartile Lineplot

What is the trend in median price?

Seasonality: Quartile Lineplot

What is the difference between the largest and the smallest median price per pound?

> something like $1.30 - $1.21 = $0.09

Timeseries: Summary

Linegraphs show trends; multi-boxplots show between-period patterns.



  • Use a linegraph to show a numerical variable through time.
  • Highlight changes in a linegraph using shading.
  • Use a multi-boxplot to show the distribution between multiple periods.

Exercise 1.3 | Seasonality



Lets use a multi-boxplot to examine the seasonal patterns of coffee prices.

  • Data: Coffee_Prices.csv

Exercise 1.3 | Seasonality

# Multi-Boxplot
sns.boxplot(prices, y='month', x='price', whis=(0,100))

S-T-E for Multi-Boxplots

What we just did

Step Action
SELECT Coffee prices 2000-2025
TRANSFORM Group by month; calculate quartiles within each group
ENCODE Month → y-position; Price quartiles → box elements

> TRANSFORM groups by time period, then summarizes within each group

Building Blocks

What this unit adds to your toolkit

Block Part 1.3
Variables Numerical
Structures Timeseries
Operations Real price transformation; group by period
Visualizations Line plot; Multi-boxplot



> Next: Panel Data with both entity and time indexes!