1 of 52

Data 88E: Economic Models

Lecture 2: Demand & Elasticity

Data 88: Economic Models, Fall 2023, UC Berkeley

2 of 52

Logistics

Concurrent Enrollment: Today we are going to take attendance on paper.

For concurrent enrollment - please make sure you sign next to your name!

Lab 1 and Project 1: You can access your first lab and project from the website. The first lab is due before next lecture at midnight on Sep 5th and the first project is due at midnight on Sep 19th. Please begin working on them soon!

Remember, if you cannot finish the assignments on time, you can still submit them for partial credit.

Data 88: Economic Models, Fall 2023, UC Berkeley

3 of 52

Lab and Project

The Gradescope assignments for both the lab and project are already set up. Later tonight, there will be a Ed post with instructions on how to submit the assignments. Please follow the instructions in the post carefully. Until then, you can work on the lab and project on your own - remember to save the files while you are working on them so you don’t lose any progress!

Pro Tip from Akhil: Use the Textbook and attend Office Hours! Helped me a lot.

Concurrent Enrollment - 79 applications! - Based on today’s attendance we hope to add you to the roster.

Please check that you are on Ed and Gradescope over the next couple of days- email if you have problems

Data 88: Economic Models, Fall 2023, UC Berkeley

4 of 52

My name! & Chat GPT

Due to some dutch people in New York 300 years ago…

My last name appears as two words “Van Dusen”

As in “Dear Professor Van Dusen”

Adhikari on GPT for Data 140 - Your boss will also be using it and thinking about whether you can be replaced by it…

�Jacob Steinhardt on GPT for Data 102 - You can use it but LLM will be setting the curve!

Data 88: Economic Models, Fall 2023, UC Berkeley

5 of 52

Roadmap

  1. Properties of the Demand Curve
    1. Textbook personal demand curve
    2. Chicken vs beef?
    3. Pandemic response?
  2. Scanner Data
      • Dominicks - Beer Data Set
  3. Class level Data
    • Survey to Demand curve
  4. Constructing the demand curve - a real world example - Avocados.csv
    • Expressing the demand curve mathematically
    • Different models for demand modeling
    • Elasticity - and Logs

Data 88: Economic Models, Fall 2023, UC Berkeley

6 of 52

Definition

Relationship between price of a good or service and the quantity demanded for that good or service at each price

Let’s start with an example from a textbook

�An individual person’s demand

Kms driven per semester

Data 88: Economic Models, Fall 2023, UC Berkeley

7 of 52

Demand Slopes Down - Law of Demand

Slopes down for 3 reasons:

  1. Decreasing Marginal Benefit - Diminishing Marginal Utility
    • You don’t need that much of any one good!
  2. Substitution Effect
    • You can get utility from other goods
  3. Income Effect
    • A cheaper price leaves more money in your pocket to buy more

Data 88: Economic Models, Fall 2023, UC Berkeley

8 of 52

  1. Demand Slopes Down - Demand Schedule

Decreasing Marginal Benefit

  • Tanks of gas per semester
  • First tank is worth a lot… last tank worth less

Data 88: Economic Models, Fall 2023, UC Berkeley

9 of 52

  1. Demand Slopes Down

Behind a smooth curve is a chunky staircase

Data 88: Economic Models, Fall 2023, UC Berkeley

10 of 52

  1. Demand Slopes Down

Data 88: Economic Models, Fall 2023, UC Berkeley

11 of 52

2) Income Effect

If price goes down, you have more money left to spend!

What do Canadians call their money?

Data 88: Economic Models, Fall 2023, UC Berkeley

12 of 52

3) Substitution Effect

If price of a good goes up, similar goods become relatively cheaper and more attractive

Data 88: Economic Models, Fall 2023, UC Berkeley

13 of 52

Price of Complements

Tolls?

Open Freeways?

Data 88: Economic Models, Fall 2023, UC Berkeley

14 of 52

Price of Substitutes

Lime? Bart? Uber?

Data 88: Economic Models, Fall 2023, UC Berkeley

15 of 52

Micromobility Demand

In 2019, people in the United States took 136 million trips on shared bikes, e-bikes, and scooters, 60% more than 2018.

Why?

Data 88: Economic Models, Fall 2023, UC Berkeley

16 of 52

Shifts in Demand Curve

Exogenous events (outside of the market) can affect the demand curve

  • Buyer's income
  • Consumer preferences
  • Expectation of future price/supply/demand
  • Changes in the price of related goods

Data 88: Economic Models, Fall 2023, UC Berkeley

17 of 52

Elasticity along a curve - From Textbook

Data 88: Economic Models, Fall 2023, UC Berkeley

18 of 52

Elasticity

Inelastic - price changes and quantity does not

Medical necessity

Steeper Curve

Elastic - price changes and quantity moves more

Lots of Substitutes

Flatter Curve

Data 88: Economic Models, Fall 2023, UC Berkeley

19 of 52

Types of Elasticity

Price Elasticity of Demand (% Change in Quantity Demanded) / (% Change in own Price)

PED >1 - elastic

demand is responsive to price - for a given change in P -> bigger change in Q

PED<1 - inelastic

demand is NOT responsive to price - for a given change in P -> smaller change in Q

Income Elasticity of Demand

(% Change in Quantity Demanded) / (% Change in Income)

Cross Price Elasticity of Demand

(% Change in Quantity Demanded of Good A) / (% Change in Price of Good B)

XED > 0 - Substitute

Increase in price for Good B -> Increase in Demand for Good A

XED < 0 - Complement

Increase in price for Good B -> Decrease in Demand for Good A

Data 88: Economic Models, Fall 2023, UC Berkeley

20 of 52

A debate - beef vs chicken - Preferences or Prices?

Pounds Consumed per person per year

Data 88: Economic Models, Fall 2023, UC Berkeley

21 of 52

A debate - beef vs chicken - Preferences or Prices?

source Jayson Lusk

Data 88: Economic Models, Fall 2023, UC Berkeley

22 of 52

A debate - beef vs chicken - Preferences or Prices?

source Jayson Lusk

Ratio of chicken price to beef price

Data 88: Economic Models, Fall 2023, UC Berkeley

23 of 52

A debate - beef vs chicken - Preferences or Prices?

Data 88: Economic Models, Fall 2023, UC Berkeley

24 of 52

A debate - beef vs chicken - Preferences or Prices?

Data 88: Economic Models, Fall 2023, UC Berkeley

25 of 52

Price of Chicken and Beef during Covid-19

How do you think chicken and beef prices fluctuated?

  • Chicken - Consumers perceive link between virus and poultry
    • In India, chicken prices have decreased by 70%
    • “People were avoiding consumption of meat, fish, chicken, and egg” -
  • Economic Times of India
  • Beef - Supply change interruption because meat packing factories are a covid hotspot
    • The retail price for beef in April was $6.22 per pound — 26 cents higher per pound than the month before (BLS)
    • At the same time, at the end of April, the average price for a steer was below $100 per hundred pounds; the five-year average for that same week was about $135 per hundred pounds
    • Unexpected price fluctuations → USDA investigation
  • Politico

Data 88: Economic Models, Fall 2023, UC Berkeley

26 of 52

Beef Processors Price Fixing Lawsuit

https://www.wcax.com/2021/06/10/unpacking-price-fixing-concerns-meat-processing-industry/

Data 88: Economic Models, Fall 2023, UC Berkeley

27 of 52

Interesting aside - Data and Price Fixing - Agri Stats

https://www.usnews.com/news/best-states/indiana/articles/2021-08-07/data-service-sued-for-facilitating-anti-competitive-behavior

Data 88: Economic Models, Fall 2023, UC Berkeley

28 of 52

Scanner Data - an early “Big Data”

UPC Codes - Laser Scanners

How to make a Demand Curve

Run experiments - track outcomes

Sales

Coupons

Placement on the Shelf, on the Aisle

Data 88: Economic Models, Fall 2023, UC Berkeley

29 of 52

A Meme from 1992 ?!?!

Data 88: Economic Models, Fall 2023, UC Berkeley

30 of 52

Front Page of NYT

Data 88: Economic Models, Fall 2023, UC Berkeley

31 of 52

Applied Economics and Bigger Data !

1990s - Scanner Data - before the internet!

A first example of Big Data

Data had previously been collected from consumer surveys

Sample vs Census

Improve measurement of consumer basket of goods

Basket Changes over time

Can we make a better CPI based on consumption behavior?

Measure choices between premium and generic -

Patent and OTC - patent expires but demand remains

Do rich and poor pay the same prices

Data 88: Economic Models, Fall 2023, UC Berkeley

32 of 52

Household vs Firm

Household sample - Nielsen - Nationally Representative sample of 120,000 household

Households scan everything they buy

Household level attributes eg income level, zip code

Firm Sample

Firms have product, brand data

` Firms have different locations

https://www.cpgdatainsights.com/answer-business-questions/sales-drivers-analysis-panel-data/

Data 88: Economic Models, Fall 2023, UC Berkeley

33 of 52

Another Meme! Trading Privacy for Pennies?

Data 88: Economic Models, Fall 2023, UC Berkeley

34 of 52

Nielsen - leveraging big data since 1923

Originator of the term market share

What do people watch?

Fox news is the top news source

When will ABC be on top

New episodes during ratings “sweeps week “

Now - buy the information directly from

Comcast / DirecTV / Roku …..

Leverage data from multiple markets

What do people buy ?

Coke vs Pepsi Crest vs Colgate

Data 88: Economic Models, Fall 2023, UC Berkeley

35 of 52

Is Nielsen Panel Data still relevant / important?

https://www.nielsen.com/insights/2023/what-is-panel-data-and-why-does-it-matter/

Data 88: Economic Models, Fall 2023, UC Berkeley

36 of 52

Combining Panels and Big Data

Data 88: Economic Models, Fall 2023, UC Berkeley

37 of 52

Nielsen Data Reporting

Data 88: Economic Models, Fall 2023, UC Berkeley

38 of 52

UC Berkeley Access

https://guides.lib.berkeley.edu/c.php?g=4395&p=5048306

Data 88: Economic Models, Fall 2023, UC Berkeley

39 of 52

UC Berkeley Access

Data 88: Economic Models, Fall 2023, UC Berkeley

40 of 52

Faber and Fally, Firm Heterogeneity in Consumption Baskets

https://www.nber.org/system/files/working_papers/w23101/w23101.pdf

Data 88: Economic Models, Fall 2023, UC Berkeley

41 of 52

Faber and Fally, Firm Heterogeneity in Consumption Baskets

https://www.nber.org/system/files/working_papers/w23101/w23101.pdf

Data 88: Economic Models, Fall 2023, UC Berkeley

42 of 52

Dominick’s - A Chicago area Supermarket Chain

https://www.chicagobooth.edu/research/kilts/datasets/dominicks

Data 88: Economic Models, Fall 2023, UC Berkeley

43 of 52

Domenicks Data

Data 88: Economic Models, Fall 2023, UC Berkeley

44 of 52

Exploring the Beer Data Price vs Quantity

Data 88: Economic Models, Fall 2023, UC Berkeley

45 of 52

UPC - what makes a unique item?

Data 88: Economic Models, Fall 2023, UC Berkeley

46 of 52

Problems -

We don’t know the data

Data Cleaning!!!

Merging similar Items with different SKUs?

Data 88: Economic Models, Fall 2023, UC Berkeley

47 of 52

Demand Demo - Go and fill a form in the notebook

WEB Page - Building a Demand Curve - Demand_Curve.ipynb

How much would you be willing to pay for?

  • Cup of Coffee
  • Gourmet Burrito
  • 2 Greek Theater Tickets
  • iPhone 15

Hint - dispersion is good… some of you should bid high or low!

Data 88: Economic Models, Fall 2023, UC Berkeley

48 of 52

Google Form - > Google Sheet

Data 88: Economic Models, Fall 2023, UC Berkeley

49 of 52

Demand Curve from Class Data

Google Form for 4 goods

Please make a bid on each good

How much would you be willing to pay for …..

Google Form outputs to Google Sheets

Google Sheets to Jupyter Notebook

  • via .csv - file to download and upload
  • Via API - read directly

What do we need to do to make a demand curve

Data 88: Economic Models, Fall 2023, UC Berkeley

50 of 52

Demand Curve from Survey Data

Please discuss

  1. What would it take to make this survey data into a demand curve?
  2. What transformation would you make to the data
  3. What would you want to graph from this data to make something like a demand curve

Demand

P

Q

Data 88: Economic Models, Fall 2023, UC Berkeley

51 of 52

Reflection of Survey Data

How do we get from raw data to demand curve?

  1. Import data
  2. Convert to numeric data
  3. Count bids by price
  4. Cumulative sums of bids by price
  5. Graph the demand curve’s line
  6. Get slope and intercept from data
  7. Graph the slope and intercept on top of demand line

Q_demand_burrito = np.flip(np.cumsum(np.flip(burritos_table.group("price", sum).column(1))))

Data 88: Economic Models, Fall 2023, UC Berkeley

52 of 52

Lecture Notebooks

Price Elasticity of Demand - PriceElasticity.ipynb

Beers - Scanner Data from Domenick’s - ScannerData_Beer.ipynb

Survey Demand data - demand-curve-Fa23.ipynb

Avocados Data - slides-pt2.ipynb

Data 88: Economic Models, Fall 2023, UC Berkeley