DOI: 10.3886/e163881
title: Data and Code for "The Response of Consumer Spending to Changes in Gasoline Prices"

description: <b>Data Build Appendix for “The Response of Consumer Spending to Changes in
Gasoline Prices"</b>

<b> </b>

By Michael
Gelman, Yuriy Gorodnichenko, Shachar Kariv, Dmitri Koustas, Matthew D. Shapiro,
Dan Silverman, and Steven Tadelis

 

Overview

We provide replication code to generate 4 figures and
6 tables in the paper. The raw
(unaggregated) transactions data from the App cannot be disclosed or shared, so
are not included in this repository. The
deposited data includes aggregated data for replication purposes (see below).
Raw data from the CEX are not included for practical purposes. The replicator
should expect the CEX build to run for about 2 hours.

 

<b>Statement about Rights</b><b></b>

• 
I certify that
the author(s) of the manuscript have legitimate access to and permission to use
the data used in this manuscript.

 

<b>Summary of Availability</b><b></b>

• 
Some data <b>cannot be made</b> publicly available.

 

<b>Details on each Data Source</b><b></b>

<b> </b>

<b>Anonymous App Data</b>

This research is
carried out in cooperation with a financial aggregation and bill-paying
computer and smartphone application (the “app”). The raw (unaggregated) transactions data from the App cannot be
disclosed or shared, so are not included in this repository. 

 

Consumer Expenditure Survey

Our paper uses both the CEX Interview Survey and the
CEX Diary Survey. In the directory “replication_files/Zsupplementary_data,” we
provide our final builds of the CEX data from which our readers can replicate
results reported in the paper. Our final build of the diary survey data is
named, “diarybuild.dta” and our final build of the interview survey data is
named, “CGKS_Expenditures_updated.dta.”

 

We do not provide the raw files due to their size, however
interested users can replicate our final build after downloading the raw files.
We obtained the raw files from the following sources: 

 

1980-1981 Interview
Survey *.txt files from NBER http://data.nber.org/ces/1980-1981/

1980-1981
Diary Survey (ICPSR 8235): https://doi.org/10.3886/ICPSR08235.v2

1982-1989
*.txt files from ICPSR: 

1982-1983 Diary Survey (ICPSR
8599): https://doi.org/10.3886/ICPSR08599.v1

1982-1983
Interview Survey (ICPSR 8598): https://doi.org/10.3886/ICPSR08598.v1

1984 Diary Survey (ICPSR
8628): https://doi.org/10.3886/ICPSR08628.v1

1984 Interview Survey (ICPSR
8671): https://doi.org/10.3886/ICPSR08671.v2

1985 Diary Survey (ICPSR 8905): https://doi.org/10.3886/ICPSR08905.v1

1985 Interview Survey (ICPSR 8904): https://doi.org/10.3886/ICPSR08904.v2

1986 Diary Survey (ICPSR 9114): https://doi.org/10.3886/ICPSR09114.v1

1986 Interview Survey (ICPSR 9113): https://doi.org/10.3886/ICPSR09113.v2

1987
Diary Survey (ICPSR 9333): https://doi.org/10.3886/ICPSR09333.v1

1987
Interview Survey (ICPSR 9332): https://doi.org/10.3886/ICPSR09332.v2

1988
Diary Survey (ICPSR 9570): https://doi.org/10.3886/ICPSR09570.v1

1988
Interview Survey (ICPSR 9451): https://doi.org/10.3886/ICPSR09451.v2

1989
Diary Survey (ICPSR 9714): https://doi.org/10.3886/ICPSR09714.v1

1989
Interview Survey (ICPSR 9712): https://doi.org/10.3886/ICPSR09712.v1 

1990-1995 *.txt files
from NBER http://data.nber.org/ces/

1996-2014 *.dta files
from NBER http://data.nber.org/ces/

 2015 *.dta files from BLS https://www.bls.gov/cex/pumd_data.htm#stata

 

For the NBER files,
we store the data locally with the exact file structure at http://data.nber.org/ces/. For the ICPSR files, we download all files
and preserve the original file names. We
organize files in folders with the following file structure: CEX_[YEAR]/Diary
and CEX_[YEAR]/Interview, for Diary and Interview data, respectively. 

 

Our build of the raw CEX Interview Survey follows
Coibion, Gorodnichenko, Kueng, and Silvia (CGKS) (2012). We update the CGKS build through 2015. The
CGKS build performs the following steps: 
sums expenditures that occur in the same month as recommended by the
BLS, drops 4th and higher observations per interview, drops household with zero
food expenditures in any interview, and corrects panel expenditure variables
with sample breaks. 

 

Michigan Survey of Consumers

Consumer
gasoline price expectations are used in Figure 1. The raw data were downloaded
from https://data.sca.isr.umich.edu/sda-public/ and are found in the “1Build/Michigan_survey”
directory.

 

Other Data

- 
Daily AAA
gasoline prices downloaded from Bloomberg Terminal (3AGSREG) (Bloomberg L.P.
n.d.a.)

- 
New York Harbor
Conventional Gasoline Regular Spot Price (EER_EPMRU_PF4_Y35NY_DPGd), downloaded
from Bloomberg Terminal (Bloomberg L.P. n.d.b.)

- 
Gasoline futures,
downloaded from Bloomberg Terminal (XBW1-XBW24) (Bloomberg L.P. n.d.c.)

- 
BLS city average
gasoline prices back to 1976 (FRED series APU000074714).

- 
West Texas Intermediate spot oil prices (FRED series OILPRICE and
MCOILWTICO).

- 
CPI-U (FRED series CPIAUCSL).

<b>Software Requirements</b><b></b>

1. Bash

2. Stata (code was last run with version 17)

- 
the program “required_programs.do” will install all
dependencies locally, and should be run once.

Portions of the code use bash scripting, which may
require Linux.

<b> </b>

<b>Memory and Runtime Requirements</b><b></b>

Summary

Approximate time needed to reproduce the analyses on a
standard desktop machine:

CEX replication code runs in approximately 2 hours. 

App regressions were run on a compute cluster,
requiring approximately 500 hours, or 20 days, of total run time. 

Details

The CEX code was last run on a <b>6-core Intel-based laptop with MacOS version 10.14.4</b>.

Portions of the code were last run on a <b>32-core compute cluster with 64 GB of RAM</b>.
Computation took approximately 500 hours.

 

<b>Dataset list</b><b></b>

III.
Zsupplementary_data contains publicly available supplementary data used in the
analysis. An inventory of these files is given below: 

 


 
 
 
 
 
 
 Data file
 
 
 
 Source
 
 
 
 
 
 
 1
 
 
 
 3AGSREG_Daily.xlsx
 
 
 
 Bloomberg L.P. (n.d.a.)
 
 
 
 
 
 
 
 
 
 2
 
 
 
 APP_biweekly_distribution.dta
 
 
 
 Constructed from the raw App data
 
 
 
 
 
 3
 
 
 
 BLS_gas_price.xlsx
 
 
 
 BLS (n.d.)
 
 
 
 
 
 
 
 
 
 4
 
 
 
 CGKS_Expenditures_updated.dta
 
 
 
 Provided for convenience. Can be constructed using
 the files in 1/Build/CEX
 
 
 
 
 
 5
 
 
 
 diarybuild.dta
 
 
 
 Provided for convenience Can be constructed using
 the files in 1/Build/CEX
 
 
 
 
 
 6
 
 
 
 EER_EPMRU_PF4_Y35NY_DPGd.xls
 
 
 
 Bloomberg L.P. (n.d.b.)
 
 
 
 
 
 
 
 
 
 7
 
 
 
 XBW1-36_Comdty_Daily.xlsx.dta
 
 
 
 Bloomberg L.P. (n.d.c.)
 
 
 
 
 
 
 

 

<b> </b>

In
addition, the following confidential files derived from App data are needed for
full replication but cannot be disclosed or shared: 

 


 
 
 
 
 
 
 Data file
 
 
 
 
 
 
 1
 
 
 
 gas_spending_for_fig3.dta
 
 
 
 
 
 
 
 
 
 2
 
 
 
 gas_spending_for_fig4.dta
 
 
 
 
 
 
 3
 
 
 
 totals_userXweek_2013.dta
 
 
 
 
 
 
 
 
 
 4
 
 
 
 gas_paper_build_dropccnosync_all.dta
 
 
 
 
 
 
 5
 
 
 
 gas_paper_build_dropccnosync_LARGE1.dta
 
 
 
 
 
 
 6
 
 
 
 gas_paper_build_dropccnosync_LARGE2.dta
 
 
 
 
 
 
 
 
 
 7
 
 
 
 gas_paper_build_dropccnosync_LARGE3.dta
 
 
 
 
 
 
 
 
 
 8
 
 
 
 gas_paper_build_core_dropccnosync_LARGE1.dta
 
 
 
 
 
 
 9
 
 
 
 gas_paper_build_core_dropccnosync_LARGE2.dta
 
 
 
 
 
 
 
 
 
 10
 
 
 
 gas_paper_build_core_dropccnosync_LARGE3.dta
 
 
 
 
 
 
 
 
 
 11
 
 
 
 gas_paper_build_core_dropccnosync_all_quarterly.dta
 
 
 
 
 
 
 
 
 
 12
 
 
 
 gas_paper_build_core_dropccnosync_all_cexstyle.dta
 
 
 
 
 
 
 

 
 
 
 
 

 

<b> </b>

<b>Description of programs/code</b><b></b>

0submit_MASTER.sh - submits all the files outlined
below. 

 

0) required_programs.do - Before running any of the
following, first run required_programs.do to install required Stata programs
via SSC. 

 

I) 1Build contains the Build files to be used in
2Estimation. These must be run first in order to perform estimation. The 1Build
directory is organized as follows: 

 

a) CEX - build files for the CEX

 

The build files for the CEX Interview Data are in the
directory “1Build/CEX/interview/CGKS_update”

 

0MASTER-cgks_replication.do<b> – </b>master do file. Calls other do files in the
directory to produce our build of the Interview Survey data, CGKS_Expenditures_updated.dta.

 

1interview_build_1980-2014.do<b> – </b>reads
raw CEX Interview Survey data from NBER and ICPSR

 

2CGKS_Expenditures_dk.do<b> – </b>performs
the CGKS build of the CEX Interview Survey expenditure data. Calls MTABaggregation.do.

 

MTABaggregation.do<b> – </b>constructs
categories of spending from underlying UCC codes

 

The build files for the CEX Diary Data are in the directory
“1Build/CEX/diary”

0diary_build.do<b> – </b>reads in the raw diary survey data
downloaded from NBER and produces our build of the diary data, diarybuild.dta.

b) Futures - Futures prices are used for constructing
the shocks to yield curves. 

 

step1-build_expectations_data_bloomberg.do
– reads in New York Harbor spot price and the futures downloaded from Bloomberg

step2-yc_surprise.do
– calculates the change in one-month ahead and the 24-month-ahead average
change in yield curves over different horizons. 


 

c) Michigan_survey - build files for the Michigan
Survey of Consumers. The Stata file and data dictionary are autogenerated by
the data provider. 

 

 d)
Misc – gasprices_to_dta.do converts raw data on gas prices to Stata *.dta
format. 

 

II) 2Main contains the files to create all tables and
underlying data for the figures in the paper. This code is organized as
follows: 

 

 a)
0overview

 i.
Table1.do - Table 1

 ii.
Fig1_PanelA+PanelB.do - Figure 1, Panels A and B

 

 b)
1cex_comparison – Code for comparisons to CEX. 

 i.
CEX_DIARY_compare_w_APP.do - Table 2, Panel A; Figure 3

 ii.
CEX_INTERVIEW_compare_w_APP.do - Table 2, Panel B; Figure 4

 iii.
CEX_INTERVIEW_baseline.do - Table 5, Panel B

 

c) 2app – Code for main regressions using app data. In
the folder "output", we provide the output from running the
estimation in 2app, which are inputs for Zmake_figures.do. 

 i.
gas_paper_regressions.do - Table 3; Table 4; Output for Figure 5

 ii.
gas_paper_hetero_Y_regressions.do - Table 6

 iii.
Zmake_figures.do - Makes Figure 5

 

<b>List of
tables and programs</b><b></b>

The
provided code reproduces:

• 
X
Selected tables and figures in the paper, as explained and justified below.

 


 
 
 Figure/Table #
 
 
 Program
 
 
 Output file
 
 
 Note
 
 
 
 
 Table 1
 
 
 0overview/Table1.do
 
 
 
 
 
 
 
 
 
 
 Table 2
 
 
 1cex_comparison /CEX_DIARY_compare_w_APP.do
 
 
 
 
 
 Table
 2, Panel B requires confidential data.
 
 
 
 
 Table 3
 
 
 gas_paper_regressions.do
 
 
 
 
 
 Requires
 confidential data to run. See “output” folder for regression output. 
 
 
 
 
 Table 4
 
 
 gas_paper_regressions.do
 
 
 
 
 
 Requires
 confidential data to run. See “output” folder for regression output. 
 
 
 
 
 Table 5
 
 
 CEX_INTERVIEW_regression.do
 
 
 
 
 
 Table
 5, Panel B.
 Table
 5, Panel A. Requires confidential data to run. See “output” folder for
 regression output.
 
 
 
 
 Table 6
 
 
 gas_paper_hetero_Y_regressions.do
 
 
 
 
 
 Requires
 confidential data to run. See “output” folder for regression output.
 
 


 


 
 
 Figure 1
 
 
 0overview/Fig1_PanelA+PanelB.do
 
 
 fig1.eps
 
 
 
 
 
 
 
 Figure 2
 
 
 n.a.
 
 
 
 
 
 Requires
 confidential data.
 
 
 
 
 Figure 3
 
 
 1cex_comparison
 /CEX_DIARY_compare_w_APP.do
 
 
 fig3.eps
 
 
 
 
 
 
 
 Figure 4
 
 
 1cex_comparison
 /CEX_INTERVIEW_compare_w_APP.do
 
 
 fig4a.eps,
 fig4b.eps, fig4c.eps
 
 
 Figures
 4b-4c requires confidential data.
 
 


 


 
 
 Figure 5
 
 
 2main/Zmake_figures.do
 
 
 fig5a.eps,
 fig5b.eps, fig5c.eps
 
 
 
 
 


 

<b>References</b>

Bloomberg
L.P. n.d.a. 3AGSREG. Retrieved 4/3/2016 from Bloomberg terminal.

Bloomberg
L.P. n.d.b. EER_EPMRU_PF4_Y35NY_DPG. Retrieved 4/3/2016 from Bloomberg
terminal.

Bloomberg
L.P. n.d.c. XBW1-36_Comdty_Daily. Retrieved 4/3/2016 from Bloomberg terminal.

Bureau of
Labor Statistics. 1980–2015. “Consumer Expenditure Survey.” United States
Department of Labor. https://www.bls.gov/cex/pumd_data.htm.

Bureau of
Labor Statistics (n.d.), “Average Price: Gasoline, Unleaded Regular (Cost per
Gallon/3.785 Liters) in U.S. City Average” [APU000074714]. Retrieved 6/3/2016.

Michigan
Survey of Consumers. 2006-2016. Surveys of Consumers SDA Archive.
Computer-assisted Survey Methods Program (CSM) at the University of California,
Berkeley. https://data.sca.isr.umich.edu/sda-public/

 

<br><br><br><br><br>