Econometrics Examples using R, based on Jeffrey Wooldridge's Introductory Econometrics, fifth edition

Jim JIANG (2014)


---- An Introduction by Ka-fu WONG

In the Spring of 2014, I taught Introductory Econometrics. Jim was one of my students -- among the best, if not the best. After the course, I suggested him to reinforce his learning of the subject by reproducing all the empirical examples of our textbook (Wooldridge's Introductory Econometrics) using R. This is not a paid job, you know. And, he completed the task in two months. That includes the time he had to self-learn the language R. I consider that an accomplishment. Don't you think so?

I believe some teachers and students will find this collection of R scripts useful. That is why I ask Jim's permission to put them there.

We sincerely hope that you will find the scripts useful. Even better, if you can find mistakes in the scripts or suggest ways to improve the scripts. I am sure Jim would be happy to learn from you. In either case, please do not hesitate to drop us an email (kafuwong@hku.hk).


---- A Sharing by Jim JIANG

I started working on this mini project with R almost right after I finished my introductory econometrics course -- thanks to the advice of Dr. Ka-fu Wong. R (a computing and statistical software) was completely new to me at the time, and I had to self-learn it from scratch. Together with Econometrics, the project was a real challenge. I am glad that I completed it in two months. Time well spent, and I learn a lot!

I reproduced all the examples on the chapters my introductory course covered using R. The reproduction of examples has essentially been a major revision process. It has deepened my understanding of the subject. Unlike utilizing pre-built packages, writing R scripts line by line gave me a better understanding of the rationale behind an econometric method, and allowed me to look into details that might have been ignored in my first learning of the subject.

R is a powerful computing and statistical tool. Programming in R is an important skill. When I look back today and compare the first and last scripts in the collection, I can see substantive improvement. I believe this mini project has laid foundation for my future learning and work with the language.

I would like to thank Dr. Ka-fu Wong for advising me to start the project and giving directions and assistance throughout. I hope others will find them useful.




---- The collection of R scripts

In this collection of R scripts, 31 of all the 105 data sets provided by Wooldridge's book were used. To reduce the length of the script, I developed a "source script" that collects functions for reporting regression results. This source script is needed by most of the example scripts. The source script may be downloaded here.

The required data sets and the source script can be downloaded here as a single .zip file. The complete collection of data set is downloadable on the companion website of the textbook, available in multiple formats.

Examples reproduced are from Chapters 2-8 and 10-12, basically the coverage of the course taught by Dr. Wong. These ten chapters have 89 examples in total; 10 of them are left out because there is no or little involvement of data sets in them. All the examples in the ten chapters are listed below. Please click on the hyperlink where available to download the script for any single example, or download all 79 of them here as a single .zip file.

 

>>>>>>>>>>> Right click to download! <<<<<<<<<<<

No.

Data Set

Title

2.1

N/A

Soybean Yield and Fertilizer 

2.2

N/A

A Simple Wage Equation

2.3

ceosal1

CEO Salary and Return on Equity

2.4

wage1

Wage and Education

2.5

vote1

Voting Outcomes and Campaign Expenditures

2.6

ceosal1

CEO Salary and Return on Equity

2.7

wage1

Wage and Education

2.8

ceosal1

CEO Salary and Return on Equity

2.9

vote1

Voting Outcomes and Campaign Expenditures

2.10

wage1

A Log Wage Equation

2.11

ceosal1

CEO Salary and Firm Sales

2.12

meap93

Student Math Performance and the School Lunch Program

2.13

N/A

Heteroskedasticity in a Wage Equation 

3.1

gpa1

Determinants of College GPA

3.2

wage1

Hourly Wage Equation

3.3

401k

Participation in 401(k) Pension Plans

3.4

gpa1

Determinants of College GPA

3.5

crime1

Explaining Arrest Records

3.6

wage1

Hourly Wage Equation

4.1

wage1

Hourly Wage Equation

4.2

meap93

Student Performance and School Size

4.3

gpa1

Determinants of College GPA

4.4

campus

Campus Crime and Enrollment

4.5

hprice2

Housing Prices and Air Pollution

4.6

401k

Participation Rates in 401(k) Plans

4.7

jtrain

Effect of Job Training on Firm Scrap Rates

4.8

rdchem

Model of R&D Expenditures

4.9

bwght

Parents' Education in a Birth Weight Equation

4.10

meap93

Salary-Pension Tradeoff for Teachers

5.1

N/A

Housing Prices and Distance from an Incinerator 

5.2

bwght

Standard Errors in a Birth Weight Equation

5.3

crime1

Economic Model of Crime

6.1

hprice2

Effects of Pollution on Housing Prices

6.2

hprice2

Effects of Pollution on Housing Prices

6.3

attend

Effects of Attendance on Final Exam Performance

6.4

ceosal1

CEO Compensation and Firm Performance

6.5

gpa2

Confidence Interval for Predicted College GPA

6.6

gpa2

Confidence Interval for Future College GPA

6.7

ceosal2

Predicting CEO Salaries

6.8

ceosal2

Predicting CEO Salaries

7.1

wage1

Hourly Wage Equation

7.2

gpa1

Effects of Computer Ownership on College GPA

7.3

jtrain

Effects of Training Grants on Hours of Trianing

7.4

hprice1

Housing Price Regression

7.5

wage1

Log Hourly Wage Equation

7.6

wage1

Log Hourly Wage Equation

7.7

N/A

Effects of Physical Attractiveness on Wage 

7.8

lawsch85

Effects of Law School Rankings on Starting Salaries

7.9

N/A

Effects of Computer Usage on Wages 

7.10

wage1

Log Hourly Wage Equation

7.11

mlb1

Effects of Race on Baseball Player Salaries

7.12

crime1

A Linear Probability Model of Arrests

8.1

wage1

Log Wage Equation With Heteroskedasticity-Robust Standard Errors

8.2

gpa3

Heteroskedasticity-Robust F Statistic

8.3

crime1

Heteroskedasticity-Robust LM Statistic

8.4

hprice1

Heteroskedasticity in Housing Price Equations

8.5

hprice1

Special Form of the White Test in the Log Housing Price Equation

8.6

401ksubs

Financial Wealth Equation

8.7

smoke

Demand For Cigarettes

8.8

mroz

Labor Force Participation of Married Women

8.9

gpa1

Determinants of Personal Computer Ownership

10.1

phillips

Static Phillips Curve

10.2

intdef

Effects of Inflation and Deficits on Interest Rates

10.3

prminwge

Puerto Rican Employment and the Minimum Wage

10.4

fertil3

Effects of Personal Exemption on Fertility Rates

10.5

barium

Antidumping Filings and Chemical Imports

10.6

fair

Election Outcomes and Economic Performance

10.7

hseinv

Housing Investment and Prices

10.8

fertil3

Fertility Equation

10.9

prminwge

Puerto Rican Employment

10.10

hseinv

Housing Investment

10.11

barium

Effects of Antidumping Filings

11.1

N/A

Static Model

11.2

N/A

Finite Distributed Lag Model

11.3

N/A

AR(1) Model

11.4

nyse

Efficient Markets Hypothesis

11.5

phillips

Expectations Augmented Phillips Curve

11.6

fertil3

Fertility Equation

11.7

earns

Wages and Productivity

11.8

fertil3

Fertility Equation

12.1

phillips

Testing for AR(1) Serial Correlation in the Phillips Curve

12.2

prminwge

Testing for AR(1) Serial Correlation in the Minimum Wage Equation

12.3

barium

Testing for AR(3) Serial Correlation

12.4

barium

Prais-Winsten Estimation in the Event Study

12.5

phillips

Static Phillips Curve

12.6

intdef

Differencing the Interest Rate Equation

12.7

prminwge

The Puerto Rican Minimum Wage

12.8

nyse

Heteroskedasticity and the Efficient Markets Hypothesis

12.9

nyse

ARCH in Stock Returns