Jim JIANG (2014)
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 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.
No. |
Data Set |
Title |
2.1 |
N/A |
Soybean Yield and Fertilizer |
2.2 |
N/A |
A Simple Wage Equation |
ceosal1 |
CEO Salary and Return on Equity |
|
wage1 |
Wage and Education |
|
vote1 |
Voting Outcomes and Campaign Expenditures |
|
ceosal1 |
CEO Salary and Return on Equity |
|
wage1 |
Wage and Education |
|
ceosal1 |
CEO Salary and Return on Equity |
|
vote1 |
Voting Outcomes and Campaign Expenditures |
|
wage1 |
A Log Wage Equation |
|
ceosal1 |
CEO Salary and Firm Sales |
|
meap93 |
Student Math Performance and the School Lunch Program |
|
2.13 |
N/A |
Heteroskedasticity in a Wage Equation |
gpa1 |
Determinants of College GPA |
|
wage1 |
Hourly Wage Equation |
|
401k |
Participation in 401(k) Pension Plans |
|
gpa1 |
Determinants of College GPA |
|
crime1 |
Explaining Arrest Records |
|
wage1 |
Hourly Wage Equation |
|
wage1 |
Hourly Wage Equation |
|
meap93 |
Student Performance and School Size |
|
gpa1 |
Determinants of College GPA |
|
campus |
Campus Crime and Enrollment |
|
hprice2 |
Housing Prices and Air Pollution |
|
401k |
Participation Rates in 401(k) Plans |
|
jtrain |
Effect of Job Training on Firm Scrap Rates |
|
rdchem |
Model of R&D Expenditures |
|
bwght |
Parents' Education in a Birth Weight Equation |
|
meap93 |
Salary-Pension Tradeoff for Teachers |
|
5.1 |
N/A |
Housing Prices and Distance from an Incinerator |
bwght |
Standard Errors in a Birth Weight Equation |
|
crime1 |
Economic Model of Crime |
|
hprice2 |
Effects of Pollution on Housing Prices |
|
hprice2 |
Effects of Pollution on Housing Prices |
|
attend |
Effects of Attendance on Final Exam Performance |
|
ceosal1 |
CEO Compensation and Firm Performance |
|
gpa2 |
Confidence Interval for Predicted College GPA |
|
gpa2 |
Confidence Interval for Future College GPA |
|
ceosal2 |
Predicting CEO Salaries |
|
ceosal2 |
Predicting CEO Salaries |
|
wage1 |
Hourly Wage Equation |
|
gpa1 |
Effects of Computer Ownership on College GPA |
|
jtrain |
Effects of Training Grants on Hours of Trianing |
|
hprice1 |
Housing Price Regression |
|
wage1 |
Log Hourly Wage Equation |
|
wage1 |
Log Hourly Wage Equation |
|
7.7 |
N/A |
Effects of Physical Attractiveness on Wage |
lawsch85 |
Effects of Law School Rankings on Starting Salaries |
|
7.9 |
N/A |
Effects of Computer Usage on Wages |
wage1 |
Log Hourly Wage Equation |
|
mlb1 |
Effects of Race on Baseball Player Salaries |
|
crime1 |
A Linear Probability Model of Arrests |
|
wage1 |
Log Wage Equation With Heteroskedasticity-Robust Standard Errors |
|
gpa3 |
Heteroskedasticity-Robust F Statistic |
|
crime1 |
Heteroskedasticity-Robust LM Statistic |
|
hprice1 |
Heteroskedasticity in Housing Price Equations |
|
hprice1 |
Special Form of the White Test in the Log Housing Price Equation |
|
401ksubs |
Financial Wealth Equation |
|
smoke |
Demand For Cigarettes |
|
mroz |
Labor Force Participation of Married Women |
|
gpa1 |
Determinants of Personal Computer Ownership |
|
phillips |
Static Phillips Curve |
|
intdef |
Effects of Inflation and Deficits on Interest Rates |
|
prminwge |
Puerto Rican Employment and the Minimum Wage |
|
fertil3 |
Effects of Personal Exemption on Fertility Rates |
|
barium |
Antidumping Filings and Chemical Imports |
|
fair |
Election Outcomes and Economic Performance |
|
hseinv |
Housing Investment and Prices |
|
fertil3 |
Fertility Equation |
|
prminwge |
Puerto Rican Employment |
|
hseinv |
Housing Investment |
|
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 |
nyse |
Efficient Markets Hypothesis |
|
phillips |
Expectations Augmented Phillips Curve |
|
fertil3 |
Fertility Equation |
|
earns |
Wages and Productivity |
|
11.8 |
fertil3 |
Fertility Equation |
phillips |
Testing for AR(1) Serial Correlation in the Phillips Curve |
|
prminwge |
Testing for AR(1) Serial Correlation in the Minimum Wage Equation |
|
barium |
Testing for AR(3) Serial Correlation |
|
barium |
Prais-Winsten Estimation in the Event Study |
|
phillips |
Static Phillips Curve |
|
intdef |
Differencing the Interest Rate Equation |
|
prminwge |
The Puerto Rican Minimum Wage |
|
nyse |
Heteroskedasticity and the Efficient Markets Hypothesis |
|
nyse |
ARCH in Stock Returns |