Top Banner
New Data in Macroeconomics Alberto Cavallo MIT & NBER Banco Central do Brasil - November 2017
39

New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Sep 21, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

New Data in Macroeconomics

Alberto Cavallo

MIT & NBER

Banco Central do Brasil - November 2017

Page 2: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

The 3vs: Volume, Variety, Variety%

Hadoop and Spark, Nosql, new database technologies

Machine learning, Neural Networks, Deep learning

Not what I will talk about!

For that, I recommend:

Data Science and Big Data Analytics (MIT Professional Education) https://mitxpro.mit.edu/courses/course-v1:MITxPRO+DSx+3T2017/about

Data Analysis for Social Scientists (MITX %Probability, Causality, R and visualization) https://www.edx.org/course/data-analysis-social-scientists-mitx-14-

310x-3

Machine Learning %Andrew NG - Coursera https://www.coursera.org/learn/machine-learning

%Big Data% and Computer Science

Page 3: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Zvi Griliches (1985), on the%uneasy alliance% between economists and data:

Economics and Data

Page 4: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

New technologies for data collection

New data, but not necessarily %big%

Traditional Macro Sources

Statistical Offices & Multi-lateral organizatoins

New Macro Sources

Administrative data (eg. tax, property records)

Scanner Data (eg. Nielsen)

Online Data (eg. Billion Prices Project)

Crowdsourced data (eg. Online survey, mobile phones)

Search data (eg. Google, Indeed)

Satellite Data (eg. lights, parking lots, tanker and crop heights)

Sensor data (smart phones, smart watches, IOT devices)

%New Data% and Macroeconomics

Page 5: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Advantages Disadvantages

• Representative sample • carefully-chosen goods • many retailers and locations

• Long Time Series• Collection of %posted prices in

stores

• Very costly to collect and access• Low frequency (monthly)• Limited number of goods and

varieties• Some unit values and imputed

prices• Difficult international comparisons

Each Data Source has Advantages and Disadvantages

CPI Data

Page 6: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Advantages Disadvantages

• Granularity• Some product details for all

goods sold• Transaction data

• Contains quantities and sometimes costs

• Frequency (weekly)

• High cost to collect/acquire• Limited coverage (supermarkets,

department stores)• Data characteristics vary greatly

depending on provider, location, time period, etc.

• Hard to compare internationally• Unit values and time-averages (eg:

prices are often calculated as sales/quantity in a week)

Each Data Source has Advantages and Disadvantages

Scanner Data

Page 7: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Advantages Disadvantages

• Frequency (daily)• Cheap to collect (but complicated)• Granularity

• All product details (brands, size, anything shown online)

• All goods and varieties available for sale (census)

• New goods automatically sampled

• Easier to compare internationally

• Fewer retailer and locations than CPI

• Short time series• Not all categories of goods and

services are online (not yet)• Online and Offline prices may

behave differently

Each Data Source has Advantages and Disadvantages

Online Data

Page 8: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Prediction and Forecasting

Use new metrics to predict a traditional variable

%google trends% and unemployment

twitter sentiment and stock market

Supervised machine learning

Nowcasting methods

Measurement opportunities

1. Improve data and methods for traditional statistics

Eg. online data for inflation

2. Measure things that could not be measured before

Eg.

– Mobile sensors to measure traffic patterns

– Satellite data to measure height of crops

Two main uses: Prediction and Measurement

Page 9: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

0.0

5.0

10.0

15.0

20.0

25.0

30.0

35.0

40.0

2004-1

2004-3

2004-5

2004-7

2004-9

2004-11

2005-1

2005-3

2005-5

2005-7

2005-9

2005-11

2006-1

2006-3

2006-5

2006-7

2006-9

2006-11

2007-1

2007-3

2007-5

2007-7

2007-9

2007-11

2008-1

2008-3

2008-5

2008-7

2008-9

2008-11

2009-1

2009-3

2009-5

2009-7

2009-9

2009-11

2010-1

2010-3

2010-5

2010-7

2010-9

2010-11

2011-1

2011-3

2011-5

CP

I YoY

Inflatio

n E

xpectatio

ns (D

i Tella U

niversity)

Annual Inflation Rate (%)

CP

I Annual Inflation

The C

ase of A

rgen

tina%s %

Missin

g%In

flation

Governm

ent starts to “m

onitor” the N

ational S

tatistics Agency

Page 10: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

0.0

5.0

10.0

15.0

20.0

25.0

30.0

35.0

40.0

2004-1

2004-3

2004-5

2004-7

2004-9

2004-11

2005-1

2005-3

2005-5

2005-7

2005-9

2005-11

2006-1

2006-3

2006-5

2006-7

2006-9

2006-11

2007-1

2007-3

2007-5

2007-7

2007-9

2007-11

2008-1

2008-3

2008-5

2008-7

2008-9

2008-11

2009-1

2009-3

2009-5

2009-7

2009-9

2009-11

2010-1

2010-3

2010-5

2010-7

2010-9

2010-11

2011-1

2011-3

2011-5

CP

I YoY

Inflatio

n E

xpectatio

ns (D

i Tella U

niversity)

Annual Inflation Rate (%)

CP

I Annual Inflation

The C

ase of A

rgen

tina%s %

Missin

g%In

flation

National S

tatistics A

gency is officially “intervened”

Governm

ent starts to “m

onitor” the N

ational S

tatistics Agency

Page 11: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

0.0

5.0

10.0

15.0

20.0

25.0

30.0

35.0

40.0

200

4-1

200

4-3

200

4-5

200

4-7

200

4-9

200

4-1

1

200

5-1

200

5-3

200

5-5

200

5-7

200

5-9

200

5-1

1

200

6-1

200

6-3

200

6-5

200

6-7

200

6-9

200

6-1

1

200

7-1

200

7-3

200

7-5

200

7-7

200

7-9

200

7-1

1

200

8-1

200

8-3

200

8-5

200

8-7

200

8-9

200

8-1

1

200

9-1

200

9-3

200

9-5

200

9-7

200

9-9

200

9-1

1

201

0-1

201

0-3

201

0-5

201

0-7

201

0-9

201

0-1

1

201

1-1

201

1-3

201

1-5

CPI YoY Inflation Expectations (Di Tella University)

Ann

ual I

nfla

tion

Rat

e (%

)

Inflation Expectations (Survey - Di Tella University)

CPI Annual Inflation

The Case of Argentina%s %Missing%Inflation

National Statistics Agency is officially

“intervened”

Government starts to “monitor”

the National Statistics Agency

Page 12: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

0.0

5.0

10.0

15.0

20.0

25.0

30.0

35.0

40.0

200

4-1

200

4-3

200

4-5

200

4-7

200

4-9

200

4-1

1

200

5-1

200

5-3

200

5-5

200

5-7

200

5-9

200

5-1

1

200

6-1

200

6-3

200

6-5

200

6-7

200

6-9

200

6-1

1

200

7-1

200

7-3

200

7-5

200

7-7

200

7-9

200

7-1

1

200

8-1

200

8-3

200

8-5

200

8-7

200

8-9

200

8-1

1

200

9-1

200

9-3

200

9-5

200

9-7

200

9-9

200

9-1

1

201

0-1

201

0-3

201

0-5

201

0-7

201

0-9

201

0-1

1

201

1-1

201

1-3

201

1-5

CPI YoY Inflation Expectations (Di Tella University)

Ann

ual I

nfla

tion

Rat

e (%

)

Inflation Expectations (Survey - Di Tella University)

CPI Annual Inflation

The Case of Argentina%s %Missing%Inflation

National Statistics Agency is officially

“intervened”

Government starts to “monitor”

the National Statistics Agency

Page 13: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Cristina Kirchner, 11/2007, Interview in Pagina 12

%With what story [%relato%] do we address the topic of Indec? With the relato that one day the villains from the government came to an institution that measured everything well [.]? [we need to] admit that there are political interests [.] the measurement models are not the Bible, the Coran, or the Talmut%

The government%s response

Page 14: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Web-Scraping Online Data

• Every day, a robot downloads a public webpage, analyses its HTML code, extract price data, and stores it in a database

Page 15: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Lenovo X60s

Scraped 6 supermakets

7 hours every day

My initial %Computing Power%

Page 16: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Cavallo (2013) %Online vs Official Price Indexes: Measuring Argentina%s Inflation% -Journal of Monetary Economics 60(2), 152-165.

•Largest supermarket in each country•Categories covered include food , beverages, and household products

Page 17: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Methodology

Used data from the largest supermarket in each country, with about 11K daily products each.

All indexes:

Daily

Include sales

No product substitutions

Use all products available in each retailer

Missing values within price spells are completed using the last available price for each product.

Used standard CPI methods in these countries:

1. price changes are obtained at the product level,

2. then averaged inside categories using geometric means,

3. then aggregated across categories with a weighted arithmetic mean

Page 18: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Methodology

Official CPI category weights and compare online series to an equivalent official index (covering food, beverages, and household products)

URL: www.retailer.com/?cat=cerveja

Page 19: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Could roughly match CPIs in Brazil, Chile, Colombia & Venezuela

Online Indices seemed to work well in other countries

Source: Cavallo (2013) Online vs Official Price Indexes: Measuring Argentina′s Inflation - Journal of Monetary Economics. Vol 60.

Page 20: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Could roughly match CPIs in Brazil, Chile, Colombia & Venezuela

Online Indices seemed to work well in other countries

Source: Cavallo (2013) Online vs Official Price Indexes: Measuring Argentina′s Inflation - Journal of Monetary Economics. Vol 60.

Page 21: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Brazil, Chile, Colombia, Venezuela

Online indexes able to track main inflation trendsEven with only 1 retailer in each country

Matching was best In Chile and Colombia, where:

• Supermarkets have larger market shares (27% and 30%, vs. only 15% in Brazil)

• City concentrates population & accounts for most of the CPI (55% in Chile)

� Good news for Argentina : the supermarket used had 28% market share, Buenos Aires was 100% of CPI data

Page 22: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

In 4 years online prices increased 100% and the CPI only 25%!

But something was %wrong% with Argentina...

Source: Cavallo (2013) Online vs Official Price Indexes: Measuring Argentina′s Inflation - Journal of Monetary Economics. Vol 60.

Page 23: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

The annual inflation rates had similar dynamics over time

Different level but similar dynamics!

Source: Cavallo (2013) Online vs Official Price Indexes: Measuring Argentina′s Inflation - Journal of Monetary Economics. Vol 60.

Page 24: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

How was the Government doing this?

Many theories...

Page 25: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Alternative retailer (%low cost%)

Re-weighted index

Simpler %subsistence% index based on small basket

Cell-relative imputation when change was too high

Use only goods that had lowest ex-post inflation per category

Use only %price agreement% prices (price-controlled goods)

I tried lots of different things

Page 26: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Always higher inflation that reported by the government

Source: Cavallo (2013) Online vs Official Price Indexes: Measuring Argentina′s Inflation - Journal of Monetary Economics. Vol 60.

Page 27: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Take the online inflation rate and divide by 3.

Best way to approximate official inflation?

Source: Cavallo (2013) Online vs Official Price Indexes: Measuring Argentina′s Inflation - Journal of Monetary Economics. Vol 60.

Page 28: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

28

STATE STREET ASSOCIATES

Page 29: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

In 2011, things escalated%

Page 30: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

The rest of the world takes notice...

2012:

The Economist started publishing

our index every week instead

of the official data

2013:

IMF %censured% Argentina for its shady inflation statistics

Page 31: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

New Official CPI

New CPI in Jan 2014, as the country tried to borrow again in international markets � surprisingly accurate the first month

After holdhouts ruling in NY � quickly lost credibility again...

The Holdouts Effect

Page 32: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Eventually, INDEC stopped publishing:

Sub-indexes � things did not add up

Provincial data � some provinces reported much higher inflation

National CPI

Poverty index � inconsistent with announced %real wage% increases

%Poverty is now below 5%% President Cristina Kirchner, FAO 2015

https://www.youtube.com/watch?v=dorlmCVpltY

Severity of the Statistical Crisis

Page 33: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

By underestimating inflation, INDEC overestimated growth

New government in December 2016

could not find the hard drives where the CPI data was stored...

no official data for 6 months!

Severity of the Statistical Crisis

Page 34: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Since 2016, the CPI closely matches our online index

Source: www.inflacionverdadera.com - PriceStats - State Street

Page 35: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Since 2016, the CPI closely matches our online index

Source: www.inflacionverdadera.com - PriceStats - State Street

Page 36: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Since 2016, the CPI closely matches our online index

Source: www.inflacionverdadera.com - PriceStats - State Street

Page 37: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

Download chained monthly index from 1946 to the present at:

http://www.inflacionverdadera.com/argentina/

If you ever need historical data on Argentina%s Inflation

Page 38: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses

%Big Data% � huge measurement opportunity

New data collection tools (web, sensors, phones, satellites)

Build customized datasets that fit specific measurement and research needs

Anyone can do this!

Next session

The Billion Prices Project, daily inflation in 22 countries, and online-offline comparisons

Final Remarks

Page 39: New Data in Macroeconomics · services are online (not yet) • Online and Offline prices may ... Web-Scraping Online Data • Every day, a robot downloads a public webpage, analyses