Publications by Rui Fan

Econometrics Lab: Chapter 4

21.09.2021

In this lab exercise, you will learn: How to construct a scatterplot plot How to run an OLS regression in R lm: run OLS regression summary: obtain regression results coef: obtain estimated coefficients How to compute predicted value of \(y\), \(\hat{y}\) predict The data set used for this exercise is Growth.xlsx from E4.1 of Stock and Wats...

4315 sym R (4650 sym/30 pcs) 5 img

Econometrics Lab: Chapter 3

14.09.2021

In this lab exercise, you will learn: How to select a subset of data subset How to compute confidence intervals using R qnorm, qt, qf t.test How to conduct a statistical test using R pnorm, pt, pf t.test The data set used for this exercise is CPS96_15 from E3.1 of Stock and Watson (2020, e4). This data contains 13,201 observations on full-...

5683 sym R (4624 sym/64 pcs)

Econometrics Lab: Chapter 2

08.09.2021

In this lab exercise, you will learn how to: Clear all objects from the workspace: rm(list=ls()) Generate random variables from different distributions. Use the set.seed() function to ensure all results are reproducible. Normal distribution: rnorm Student t distribution: rt Uniform distribution: runif Obtain summary statistics: summary(). Plot...

3856 sym R (5612 sym/41 pcs) 7 img

Econometrics Lab: Chapter 5

30.09.2021

In this lab exercise, you will learn: Regression with dummy variables How to interpret coefficients How to construct CIs and conduct hypothesis test Heteroskedasticity Visual inspection for heteroskedasticity How to obtain robust standard errors (SE): vcovHC How to conduct significance test using robust SE: coeftest Exercise (Dummy Variable)...

11007 sym R (9598 sym/66 pcs) 6 img

Econometrics Lab: Chapter 6

06.10.2021

In this lab exercise, you will learn: Multiple Regression Using R \(lm(y \sim x_1+x_2+x_3)\) How to interpret results of multiple regressions. \(SER\), \(R^2\), and \(\bar R^2\). Exercise: The Gender Wage Gap The gender pay gap or gender wage gap is the average difference between the remuneration for men and women who are working. Women are ge...

4760 sym R (4534 sym/10 pcs)

Econometrics Lab: Chapter 7

17.10.2021

In this lab exercise, you will learn: No Perfect Multicollinearity Assumption To check imperfect multicollineartiy, find the sample correlation matrix for all independent variables using cor. Statistical Inference for Multiple Regressions linearHypothesis in package car. Heteroskedasticity robust SE: vcovHC Confidence interval using robust SE...

7182 sym R (12592 sym/36 pcs)

Econometrics Lab: Chapter 12

02.12.2021

In this lab exercise, you will learn how to obtain the TSLS estimator for the instrumental variable model. TSLS: ivreg( ) First-stage F test (test for weak IV): linearHypothesis( ) J-test (test for instrument exogeneity): linearHypothesis( , test=“Chisq”) and the \(p\)-value is 1-pchisq(J, df=m-k) Exercise: Demand for Cigarettes The relatio...

11942 sym R (9306 sym/32 pcs)

Econometrics Lab: Chapter 8

23.03.2022

In this lab exercise, you will learn: Nonlinear Regression Using R How to generate an interaction term or a polynomial term: \(I(x_1*x_2)\) or \(I(x^2)\) How to interpret results of multiple regressions, esp. with interaction terms. Multiple Regression with \(X\) and \(X^2\) as Independent Variables Find the value of \(X\) that minimizes or ...

4769 sym R (5934 sym/30 pcs) 1 img