/PoE

Commented R scripts for chapters 8, 9, 10, 12 of Principles of Econometrics, 4th edition. Heteroskedasticity; Regression with Time Series Data: Stationary Variable; Random Regressors and Moment Based Estimation; and 2 Regression with Time Series Data: Nonstationary Variables

Primary LanguageR

PoE

Commented R scripts for chapters 8, 9, 10, 12 of Principles of Econometrics, 4th edition (R. Carter Hill, William E. Griffiths and Guay C. Lim). (see table of contents of the book: http://www.principlesofeconometrics.com/poe4/poe4tocbrief.pdf)

Chapter 8 - Heteroskedasticity: Script "chap8.R" serves as a comprehensive guide to understanding heteroskedasticity. It walks you through the basics, equips you with the skills to detect it through various methods (Lagrange multiplier tests, the White test, and the Goldfeld-Quandt test). Additionally, it provides insights into working with heteroskedasticity-consistent standard errors, showcasing the use of the 'sandwich' package and how to compute Heteroskedasticity-Consistent confidence intervals.

Chapter 9 - Regression with Time Series Data: Stationary Variable: Script "chap9.R" delves into the application of time-series analysis focusing on stationary variables. It explores the concept of finite distributed lags and the significance of serial correlation, ACF correlograms, and formal tests for serially correlated errors like the Breusch-Godfrey and Durbin-Watson tests. Furthermore, it presents various models, such as Autoregressive Distributed Lag, and guides on choosing the best model using AIC and BIC. Lastly, it introduces forecasting techniques, including the use of exponential smoothing.

Chapter 10 - Random Regressors and Moment Based Estimation: Script "chap10.R" begins with a straightforward review of the core concepts of unbiasedness, consistency, and efficiency, discussing what happens in cases where regressors and the error term are correlated. It provides a practical example of least squares estimation in a wage equation. It then leads you through the process of using instrumental variables (IV) in the estimation, explains the challenges of weak instrumental variables, the workings of two-stage least squares (2SLS), and the importance of specification tests and testing instrument validity.

Chapter 12 - Regression with Time Series Data: Nonstationary Variables: Script "chap12.R" provides a discussion of time-series analysis with non-stationary variables. Starting with a comparison between stationary and non-stationary variables, it walks you through various models such as first-order autoregressive models with zero and non-zero means, as well as those that fluctuate around a linear trend. It also delves into the random walk models and introduces concepts of spurious regressions, unit root tests for stationarity, including the Dickey–Fuller and Augmented Dickey-Fuller tests, order of integration, and cointegration, ending with a look at the Error Correction Model.

Note: These scripts were written for my activities as a teaching assistant during my Ph.D. back in 2017. They were intended to help students apply the theory they learned from the book Principles of Econometrics (Hill et al). I revisited these notes in June 2023 to use parts of the code in my current job, and everything worked just fine. You might find outdated packages or minor needs of correction, so please let me know. Comments are more than welcome! 📚🚀