Ec 485 Project 1: Elasticity of Demand for Gasoline (partial)
Spring 2021
Read the article “Evidence of a Shift in the Short-Run Price Elasticity of Gasoline Demand” by Hughes, Knittle and Sperling, The Energy Journal, January XXXXXXXXXXYou will create a data set containing the same data as the authors use, and attempt to reproduce some of their results.
A. Read the paper, specifically pages pp XXXXXXXXXX, and Sections 4 and 5 (Discussion and Conclusion).
Answer the following questions:
A1. What is the authors’ hypothesis about the elasticity of demand for gasoline?
A2. Previous research has found what range of estimates for the elasticity of demand for gasoline and how do the authors plan to improve upon these existing estimates?
A3. Explain how a measure of demand elasticity will be useful for tax policy and for environmental policy.
B. Build the Data Set and Read it into R
1. What Data to Get:
Create a data set of the variables necessary to run the regressions in Tables 1, 2 and 4. Your data should run from January 1975 to November 2020, although the authors’ data end in Mar XXXXXXXXXXThe authors’ discussion of their data set is weak. For example, you have to read quite carefully to realize that they use per capita monthly consumption of gasoline and real per capital disposable personal income in their model. They also indicate that they deflate these monthly series using the implicit GDP price deflator, which is only available quarterly. (If you can find a monthly GDP price deflator, please share it with me!).
Gasoline Consumption and Price data:
In their model presentation, the authors tell us that their dependent variable is the log of monthly per capita gasoline consumption. The gasoline consumption comes from the EIA, specifically they used the monthly “product supplied” of Finished Motor Gasoline. Google “product supplied” and “crude oil and petroleum products”. It is best to download the (XLS file). The data begin in 1945, but you will only need from XXXXXXXXXXWatch out for units and frequency. The authors clearly state that they used monthly product supplied. It was not daily, but monthly. You will divide this monthly consumption by a population variable to yield a per capita monthly consumption. Lastly, the gasoline in measured in ba
els, but the authors use gallons, so you will convert to gallons. These changes should be done in R, *not* in you Excel or CSV file.
The price of gasoline comes from the CPI- City average data for regular unleaded gasoline (and leaded for 1975 values), which they got from the BLS. It can be challenging to find what you need on the BLS web site, so I suggest that you google: BLS city average gasoline. This should give you a link to the co
ect page at the BLS. You can then specify the date range you need. The data values for 1975 leaded gasoline are posted on Canvas under Project 1.
ST. Louis FRED data:
You can find all other variables at the St. Louis Fed’s FRED (such as the real disposable per capita income, population, inflation, interest rates, unemployment rates) site. Go to Data Categories, find the series that you want and click on its title. A graph of the series should pop up. On the far right of the page, there is an EDIT graph option that allows you to change the units, frequency of the variable prior to downloading the data. Make sure to specify the date range that you want, XXXXXXXXXX – most recent is good. You can clean up you data after you download all of the variables.
Every data series that you download should be MONTHLY, and seasonally adjusted, where available.
You will need a measure of population. You should choose “Population includes resident population plus armed forces overseas” It is not ideal but the other available measures exclude children.
You need to deflate the nominal price of gasoline and to construct a measure of inflation. Use the Personal Consumption Expenditures: Chain-type Price Index monthly found at FRED under inflation and price indexes. For the rate of inflation, you can have FRED calculate it for you. From the DOWNLOAD button, change the units of measurement from levels (the index) to "% change from a year ago" (a measure of inflation). You will need both the index and the inflation rate.
For the one year Treasury Bill, you can use the 1-Year Treasury Constant Maturity Rate, because the other 1-year rate has missing values. For the 10 year rate, used the 10 year Treasury Constant Maturity.
You should get all of your "raw" data into a CSV file. I strongly suggest that you include a column for year and a column for month both of which are numeric. Do not use an Excel formatted month-year column. Make sure that our first column is “year” (1984 – 2020) and the second column is “month” (integers XXXXXXXXXXThis will be demonstrated in class.
Any variables that need to be “created” (such as the real price of gasoline = nominal price/price deflator) and per capita monthly gasoline consumption in gallons should be constructed in R, not in Excel. Your spreadsheet will have the variables necessary for constructing new variables using R.
2. Construct Necessary Variables:
You will need to construct new variables, such as the real price of gasoline, the logs of the real price, per capita consumption, the unemployment rate, the interest rates, and inflation rate, as well as monthly dummy variables. Also, the authors clearly state: “Prices and income are converted to constant 2000 dollars” so you will need to re-base the real per capital personal disposable income to be in 2000$. To construct the real price of gasoline and express it in 2000 dollars, suppose that your nominal price series is named pgas and that your deflator is named pdef, and that it is based to 100 in the year 2005. First, you want to rebase it to 2000. You do this by finding the average value of pdef in 2000. Suppose this average was XXXXXXXXXXThe code below shows you how to create a new deflator (based to 1.0 in 2000, not 100!) and use it to construct a real price of gas based in 2000 dollars.
mydat$pdef00 = mydat$pdf/94.6
mydat$rpgas = mydat$pgas/mydat$pdef00
You will need a set of 12 dummy variables for the months. There are number of different ways to get R to include monthly dummies, such as the factor(month) command. The command: lm(y ~ x + as.factor(month)) will do it, but the default is that R will use the first value of factor (in this case, January) as the omitted
eference group. The authors of the paper used the last month, December, as the reference group. You already should have a column in the data frame named “month” that takes on values 1 through 12. Use this variable to create 12 dummy variables:
gasdf$d1 = ifelse(gasdf$month==1,1,0)
gasdf$d2 = ifelse(gasdf$month==2,1,0)
gasdf$d3 = ifelse(gasdf$month==3,1,0)
etc…
C. Analysis: Data Discussion
C1. Construct a table of descriptive statistics. Present a table of descriptive statistics containing the mean, standard deviations, min and max values for your three main variables plus the three macro variables: per capita gasoline consumption, real per capita disposable income, and real price of gasoline; tbill rates, unemployment rate and inflation rate. Make sure to include time period, units of measurement and data definitions/sources (such as the name of your price deflator, base year, tbill rate, etc.).
You want to calculate these descriptive statistics for three specific time periods: Time Period 1: Nov 1975 – Nov 1980, Time period 2: March 2001 – March 2006, and Time Period 3: Feb 2015 – Feb XXXXXXXXXXBe sure to include units of measurement. Make sure that your table includes the statistics only for those variables to be used in the analysis: per capita consumption, real price of gasoline in 2000$, real per capital disposable income in 2000$, unemployment rate, one-year and ten-year treasury rates, rate of inflation.
To capture only specific variables for the table of statistics, you can create a list of these variable name, and subset by using something like:
myvars=c(“var1”,”var2”,”var3”,”var4”)
newdf = bigdf[myvars]
stargazer(newdf, …)
The following commands will create three data frames co
esponding to the three time periods needed for your analysis. It is first necessary to create a data variable in R.
gasdat = read.csv("~gasoline.csv")
str(gasdat)
obs=551
start=" XXXXXXXXXX"
date= seq(as.Date(start),by="months",length=obs)
gasdf = cbind(date,gasdat)
gasdf1 = subset(gasdf, date>=" XXXXXXXXXX" & date <= " XXXXXXXXXX")
gasdf2 = subset(gasdf, date>=" XXXXXXXXXX" & date <= " XXXXXXXXXX")
gasdf3 = subset(gasdf, date>=" XXXXXXXXXX" & date <= " XXXXXXXXXX")
C2. Write a detailed paragraph that discusses the descriptive statistics for the main variables in your models: per capita gasoline consumption, real price of gasoline and real per capita personal disposable income. Give a better discussion than the authors gave in their paper! What was the peak real price of gas in the three subperiods, and how do the peak prices for the first two subperiods compare to what the authors report on page 96? How does your average per capita consumption in gallons compare to what the authors report on page 96 and how has the average changed in the latest subperiod?
C3. Graph 1: construct time-series graph of the main variables in your models: per capita gasoline consumption, real price of gasoline and real per capita personal disposable income using the full time series (not the separate subperiods). Figure 1 in paper shows real price of gasoline and per capita consumption on the same graph. If you can get this done in R, good. If not, separate graphs are sufficient. The authors do not show a plot of real per capita disposable income, but you should.
par(mfrow = c(3,1)) # set up the graphics
plot(x=df$date, y=df$var1 xlab="date",
ylab="var name", main="my title",pch=1,type="l", bg="blue")
plot(x=df$date, y=df$var2, xlab="date",
ylab="var name",
main="my title",pch=1,type="l", bg="green")
plot(x=df$date, y=df$var3, xlab="date",
ylab="var name",
main="my title",pch=1,type="l", bg="green")
Comment on each of the time series graphs. (Be
ief: what do they tell you/confirm about the data?)
Graph 2: Produce a graph similar to Figure 2 in the paper. The authors overlay the real