Econometric Analysis by Examples

Copyright© 2020 by Kuan-Pin Lin and WISER-Club
All Rights Reserved, 12-31-2020

<<< In Progress >>>


About the Book

This project is based on the first author's book on Computational Econometrics: GAUSS Programming for Econometricians and Financial Analysts (ETEXT Textbook Publishing, 2001). Now, all the examples are converted from Gauss to R and Python taking advantage of these open source language software and packages. We recommend using RStudio with R and Spyder with Python.

This book project provides a hands-on approach to econometric modeling and analysis using R and/or Python. It is aimed at students, reserchers, and professionals, with some prior knowledge of economics and statistics, who want to increase their econometrics vocabulary while learning a freely available yet powerful computer language. Programming experience is not assumed but will be gained by working on more than 70 examples of basic econometric modeling and analysis. For each example, the codes can be viewed and downloaded with the links to the data file(s) and the R and Python package(s) in use. The document of the book chapters will be provided soon.

About the Authors

Kuan-Pin Lin is a Professor of Economics at Portland State University. His fields of specialization cover econometrics, mathematical economics, and computational economics. Before accepting his current appointment at PSU, he was a Postdoctoral Research Fellow at Harvard University. In 1986, he was a Fulbright-Hayes Research Scholar with projects in Singapore, Taiwan, and China. In addition to teaching and research, he has written numerous computer programs. His work has appeared in a variety of publications including the Journal of Finance, Journal of Mathematical Economics, Journal of Economic Dynamics and Control, Economics Letters, Economic Modelling, and Computational Economics (formerly Computer Science in Economics and Management).

WISER-Club is a group of enthusiastic R/Python users (students, researchers and faculty members) at The Wang Yanan Institute for Studies in Economics, Xiamen University. For this book project, special thanks to the assistence of Fan Yu, Xian Lv, Yingdong Liu, Jingkun Qiu, and Junzhuo Gao.

Book Chapters and Examples


Chapter I Introduction
Chapter II R Basics Python Basics DataTopic
Example 2.1 Example 2.1 --Let's Begin
Example 2.2 Example 2.2 LONGLEY.TXT   File I/O
Example 2.3 Example 2.3 "Data Transformation
Example 2.4 Example 2.4 "Data Analysis
Chapter III Linear Regression Models
Example 3.1 Example 3.1 LONGLEY.TXT Simple Regression
Example 3.2 Example 3.2 "Residual Analysis
Example 3.3 Example 3.3 "Multiple Regression
Example 3.4 Example 3.4 CJX.TXT Cobb-Douglas Production Function
Example 3.5 Example 3.5 "Testing for Structural Change
Example 3.6 Example 3.6 "Residual Diagnostics
Chapter IV Dummy Variables
Example 4.1 Example 4.1 ALMON.TXT Seasonal Dummy Variables
Example 4.2 Example 4.2 "Dummy Variable Trap
Example 4.3 Example 4.3 CJX.TXT Testing for Structural Change: Dummy Variable Approach
Chapter V Multicollinearity
Example 5.1 Example 5.1 LONGLEY.TXT Condition Number and Correlation Matrix
Example 5.2 Example 5.2 "Theil's Measure of Multicollinearity
Example 5.3 Example 5.3 "Variance Inflation Factors (VIF)
Example 5.4 Example 5.4 "Ridge Regression and Principal Components
Chapter VI Nonlinear Optimization
Example 6.1 Example 6.1 --One-Variable Scalar-Valued Function
Example 6.2 Example 6.2 --Two-Variable Scalar-Valued Function
Example 6.3 Example 6.3 YED20.TXT Estimating Probability Distributions
Example 6.4 Example 6.4 "Mixtures of Probability Distributions
Example 6.5 Example 6.5 JUDGE.TXT Minimizing Sum-of-Squares Function
Example 6.6 Example 6.6 "Maximizing Log-Likelihood Function
Chapter VII Nonlinear Regression Models
Example 7.1 Example 7.1 JUDGE.TXT CES Production Function
Example 7.2 Example 7.2 MONEY.TXT Box-Cox Variable Transformation
Example 7.3 Example 7.3 JUDGE.TXT Hypothesis Testings for Nonlinear Models
Example 7.4 Example 7.4 MONEY.TXT Likelihood Ratio Tests of Money Demand Equation
Chapter VIII Discrete and Limited Dependent Variables
Example 8.1 Example 8.1 GRADE.TXT Probit Model of Economic Education
Example 8.2 Example 8.2 "Logit Model of Economic Education
Example 8.3 Example 8.3 FAIR.TXT Tobit Analysis of Extramarital Affairs
Chapter IX Heteroscedasticity
Example 9.1 Example 9.1 GREENE.TXT Heteroscedasticity-Consistent Covariance Matrix
Example 9.2 Example 9.2 "Goldfeld-Quandt Test and Correction for Heteroscedasticity
Example 9.3 Example 9.3 "Breusch-Pagan Test and Correction for Heteroscedasticity
Example 9.4 Example 9.4 "Multiplicative Heteroscedasticity
Chapter X Autocorrelation
Example 10.1 Example 10.1 CJX.TXT Heteroscedasticity-Autocorrelation-Consistent Covariance Matrix
Example 10.2 Example 10.2 "Tests for Autocorrelation
Example 10.3 Example 10.3 "Cochrane-Orcutt Iterative Procedure
Example 10.4 Example 10.4 "Hildreth-Lu Grid Search Procedure
Example 10.5 Example 10.5 "Higher Order Autocorrelation
Example 10.6 Example 10.6 "ARMA(1,1) Error Structure
Example 10.7 Example 10.7 "Nonlinear ARMA Model Estimation
Chapter XI Distributed Lag Models
Example 11.1 Example 11.1 USYC87.TXT Testing for Autocorrelation with Lagged Dependent Variable
Example 11.2 Example 11.2 "Instrumental Variable Estimation
Example 11.3 Example 11.3 ALMON.TXT Almon Lag Model Revisited
Example 11.4 Example 11.4 "Almon Lag Model Once More
Chapter XII Generalized Method of Moments
Example 12.1 Example 12.1 YED20.TXT Gamma Probability Distribution
Example 12.2 Example 12.2 GMMQ.TXT A Nonlinear Rational Expectation Model
Example 12.3 Example 12.3 USYC87.TXT GMM Estimation of U. S. Consumption Function
Chapter XIII System of Simultaneous Equations
Example 13.1 Example 13.1 KLEIN.TXT Klein Model I
Example 13.2 Example 13.2 "Klein Model I Reformulated
Example 13.3 Example 13.3 BWQ.TXT
BWP.TXT
Berndt-Wood Model
Example 13.4 Example 13.4 "Berndt-Wood Model Extended
Example 13.5 Example 13.5 KLEIN.TXT Klein Model I Revisited
Chapter XIV Unit Roots and Cointegration
Example 14.1 Example 14.1 USYC87.TXT Augmented Dickey-Fuller Test for Unit Roots
Example 14.2 Example 14.2 "Cointegration Test: Engle-Granger Approach
Example 14.3 Example 14.3 "Cointegration Test: Johansen Approach
Chapter XV Time Series Analysis
Example 15.1 Example 15.1 BONDS.TXT ARMA Analysis of Bond Yields
Example 15.2 Example 15.2 USINF.TXT ARMA Analysis of U. S. Inflation
Example 15.3 Example 15.3 "ARCH Model of U. S. Inflation
Example 15.4 Example 15.4 DMBP.TXT GARCH Model of Deutschemark-British Pound Exchange Rate I
Example 15.5 Example 15.5 "GARCH Model of Deutschemark-British Pound Exchange Rate II
Chapter XVI Panel Data
Example 16.1 Example 16.1 AIRLINE.TXT One-Way Panel Data Analysis: Dummy Variables Approach
Example 16.2 Example 16.2 "One-Way Panel Data Analysis: Deviation Approach
Example 16.3 Example 16.3 "Two-Way Panel Data Analysis
Example 16.4 Example 16.4 IFCGM.TXT
IFCCH.TXT
IFCGE.TXT
IFCWE.TXT
IFCUS.TXT
Panel Data Analysis for Investment Demand: Deviation Approach
Example 16.5 Example 16.5 "Panel Data Analysis for Investment Demand: SUR method
Chapter XVII Least Squares Prediction
Example 17.1 Example 17.1 GDP96.TXT Ex-Post Forecasts and Forecast Error Statistics
Example 17.2 Example 17.2 "Ex-Ante Forecasts


R/Python Software and Resources

References (Econometrics with R/Python)

References (Econometrics)