SOLUTION: EEP IAS 118 UC Berkeley Gasoline Consumption Data Problem Set

Department of Agricultural and Resource Economics, UC Berkeley
Villas-Boas, Spring 2021
EEP/IAS 118 – Introductory Applied Econometrics
Problem Set 1
Due 9:30am on February 4, 2021
Submit materials (all handwritten/typed answers, Excel workbooks, and R reports) as one
combined pdf on Gradescope
Exercise 1 (Excel). Relationship between Gasoline Consumption Data and Price of Gasoline in
18 OECD countries We will use data from Baltagi (2005) on gasoline consumption for 18 OECD countries.
The original data span 19 years. In this first problem set we will only use the year 1960.
This exercise is to be completed using Excel. Looking at the first graph, there appears to be an association
between Gasoline consumption per car and the price of gasoline. We will establish a simple linear relationship
on a subset of 9 countries at a time.
Note: in economics, log always refers to the natural log, ln().
Table 1: Log of Gasoline Consumption Per Car and Log of Price of Gasoline
CountryName
sample 1
AUSTRIA
BELGIUM
CANADA
DENMARK
FRANCE
GERMANY
GREECE
IRELAND
ITALY
Log of Gasoline Consumption per car
logY
4.173244195
4.16401597
4.855238441
4.50198595
3.907704233
3.916953172
5.037405535
4.270420603
4.050728238
log of Gasoline Price
logX
-0.334547613
-0.165709611
-0.972106499
-0.195702601
-0.019598332
-0.185910784
-0.083547398
-0.076481181
0.165077076
(a) Use Excel to create a scatter plot of these observations. Don’t forget to (1) label the axes and their units,
and (2) title your graph. You should use the tables provided here for these calculations, not
the actual observations from the .csv data file.
(b) This question has two parts. First: Estimate the linear relationship between the log of Gasoline
consumption per car (log(Y)) and the log of gasoline prices (log(X)) by OLS, showing all intermediate
calculations as we saw in the lecture 3 slides (use Excel to create the table and show all the steps).
Second: interpret the value of the estimated parameters β̂0 and β̂1 .
[ i = β̂0 + β̂1 logXi
logY
i = {first 9 countries}
(c) In your table, compute the fitted value and the residual for each observation, and verify that the residuals
(approximately) sum to 0.
(d) According to the estimated relation, what is the predicted Yb (level, not log) for a country with a log
price of -2? (Pay attention to units)
(e) How much of the variation in per capita log gasoline consumption in these 9 countries is explained by the
log of price of gasoline in the countries?
(f) Repeat exercise (b) for one additional set of 9 countries below. You should use Table 2 provided
below for these calculations, not the actual observations from the .csv data file.
(g) Do your estimates of β̂0 and β̂1 change between Tables 1, and 2? Why?
(h) Save a copy of your Excel workbook as a pdf (OLS tables and scatter plot) to combine with the later work.
1
Department of Agricultural and Resource Economics, UC Berkeley
Villas-Boas, Spring 2021
Table 2: Log of Gasoline Consumpetion per car and Log of Gasoline Prices
CountryName
sample 2
JAPAN
NETHERLA
NORWAY
SPAIN
SWEDEN
SWITZERL
TURKEY
U.K.
U.S.A.
Log of Gasoline Consumpetion per car
logY
5.995286556
4.646268005
4.43504067
4.749409172
4.063010036
4.397621493
6.129552849
4.100244284
4.823964512
log of Gasoline Price
logX
-0.14532271
-0.201484804
-0.139689574
1.125310702
-2.52041588
-0.82321833
-0.253408214
-0.391085814
-1.121114893
Exercise 2 Functional Forms
(a) Suppose you estimate alternative specifications as given below for the year of 1972 using all countries:
A linear relationship: Ŷi = 121 + 2.23 Xi
A linear-log relationship: Ŷi = 4.5 + 0.06 log(X)i
) = 4 + 0.09 log(X)i
A log-log relationship: log(Y
i
Note that it is convention to always use the natural log.
(i) Interpret the parameter on gasoline price X (or log of gasoline price log(X)) in each of these
equations.
(ii) What is the predicted per car gasoline consumption in dollars for a country with a gasoline price of
2 in each of these equations?
Exercise 3. Importing data into R and Basic R first commands For the purposes of this class, we will
be using a cloud-based version of RStudio provided through UC Berkeley’s Datahub.1 The data files can be
accessed directly through Datahub and do not require you to install anything on your computer. This exercise
is designed to get you familiar with accessing the service, loading data, and obtaining summary statistics. To
start off, we’re going to use Jupyter notebooks to help familiarize you with some R commands. For help with
Jupyter and R, refer to the Coding Bootcamp Part 1 recording on bCourses and the corresponding interactive
notebook on Datahub.
(a) To access the Jupyter notebook for this problem set on Datahub, click the following link:
This Link
(b) Load the datafile dataPset1 1960.csv into R (since this is a “.csv” file, you should use the read.csv()
function).
(c) Provide basic summary statistics on the log of Gas Consumption per car (LGASPCAR) in the dataframe.
Use the summary() command. This function is part of base R, so you do not need to load any packages
before using it. What is the median value of log gasoline consumption per car?
(d) Next, generate custom summary statistics on the Log of Gasoline Price Variable(LRPMG) using the
summarise() function provided by dplyr. You will need to call the tidyverse package with the
library() function to use it (tidyverse is a collection of packages designed for data science. It includes
dplyr and several other packages we’ll use this term).
(e) Create a scatter plot of the LGASPCAR and LRPMG data. Use
figureAsked Print Preview in the menu and
choosing to ”print” the new tab as a pdf with Ctrl + P) and combine it with your excel workbook from
Exercise 1 for submission on Gradescope.
3
COUNTRY YEAR
LGASPCAR LINCOMEP LRPMG
LCARPCAP
AUSTRIA
1960 4.173244 -6.47428 -0.33455 -9.76684
BELGIUM
1960 4.164016 -6.21509 -0.16571 -9.40553
CANADA
1960 4.855238 -5.88971 -0.97211 -8.37892
DENMARK
1960 4.501986 -6.06173 -0.1957 -9.32616
FRANCE
1960 3.907704 -6.26436 -0.0196 -9.14571
GERMANY
1960 3.916953 -6.15984 -0.18591 -9.34248
GREECE
1960 5.037406 -7.16486 -0.08355 -12.1738
IRELAND
1960 4.270421 -6.72247 -0.07648 -9.69814
ITALY
1960 4.050728 -6.72749 0.165077 -10.1421
JAPAN
1960 5.995287 -6.9862 -0.14532 -12.2351
NETHERLA
1960 4.646268 -6.21636 -0.20148 -9.99845
NORWAY
1960 4.435041 -6.09036 -0.13969 -9.67505
SPAIN
1960 4.749409 -6.16609 1.125311 -11.5884
SWEDEN
1960 4.06301 -8.07252 -2.52042 -8.74268
SWITZERL
1960 4.397621 -6.15607 -0.82322 -9.2624
TURKEY
1960 6.129553 -7.80114 -0.25341 -13.4752
U.K.
1960 4.100244 -6.18685 -0.39109 -9.11762
U.S.A.
1960 4.823965 -5.69837 -1.12111 -8.01946

Purchase answer to see full
attachment

Order a unique copy of this paper
(550 words)

Approximate price: $22

Our Basic features
  • Free title page and bibliography
  • Plagiarism-free guarantee
  • Unlimited revisions
  • Money-back guarantee
  • 24/7 support
Our Options
  • Writer’s samples
  • Expert Proofreading
  • Overnight delivery
  • Part-by-part delivery
  • Copies of used sources
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

AcademicWritingCompany guarantees

Our customer is the center of what we do and thus we offer 100% original essays..
By ordering our essays, you are guaranteed the best quality through our qualified experts.All your information and everything that you do on our website is kept completely confidential.

Money-back guarantee

Academicwritingcompany.com always strives to give you the best of its services. As a custom essay writing service, we are 100% sure of our services. That is why we ensure that our guarantee of money-back stands, always

Read more

Zero-plagiarism tolerance guarantee

The paper that you order at academicwritingcompany.com is 100% original. We ensure that regardless of the position you are, be it with urgent deadlines or hard essays, we give you a paper that is free of plagiarism. We even check our orders with the most advanced anti-plagiarism software in the industry.

Read more

Free-revision guarantee

The Academicwritingcompany.com thrives on excellence and thus we help ensure the Customer’s total satisfaction with the completed Order.To do so, we provide a Free Revision policy as a courtesy service. To receive free revision the Academic writing Company requires that the you provide the request within Fifteen (14) days since the completion date and within a period of thirty (30) days for dissertations and research papers.

Read more

Privacy and Security policy

With Academicwritingcompan.com, your privacy is the most important aspect. First, the academic writing company will never resell your personal information, which include credit cards, to any third party. Not even your lecturer on institution will know that you bought an essay from our academic writing company.

Read more

Adherence to requirements guarantee

The academic writing company writers know that following essay instructions is the most important part of academic writing. The expert writers will, therefore, work extra hard to ensure that they cooperate with all the requirements without fail. We also count on you to help us provide a better academic paper.

Read more

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2020 at 10:52 AM
Total price:
$26
The price is based on these factors:
Customer Academic level
Number of pages required
Urgency of paper