Q1

\[\text{Cor}(\Delta u_{it},\Delta u_{it+1})\] \[= \frac{\text{Cov}(u_{it}-u_{it-1},u_{it+1}-u_{it})}{\sqrt{\text{Var}(u_{it}-u_{it-1})\text{Var}(u_{it+1}-u_{it})}} = \frac{-\text{Var}(u_{it})}{\sqrt{4\text{Var}(u_{it})^2}} = -0.5\]

C1

i)

lm1 <- lm(rental$lrent ~ rental$y90 + rental$lpop + rental$lavginc + rental$pctstu)
tidy(lm1)

The positive and significant coefficient on \(y90\) implies that, other things in the equation fixed, nominal rents grew by over 26% over the 10 year period. The significant coefficient on \(pctstu\) means that a 1% increase in \(pctstu\) is associated with 0.5% increase in rent.

ii)

Not valid, since we find \(a_i\) which is fixed effect in the regression, the errors across the two time periods for each city are positively correlated. This invalidates the usual OLS standard errors and t statistics.

iii)

lm2 <- lm(rental$clrent ~  rental$clpop + rental$clavginc + rental$cpctstu)
tidy(lm2)

The effect of \(pctstu\) is over twice as large as we estimated in the pooled OLS equation. 1% increase in \(pctstu\) is significantly going to increase rental rates by about 1.1%.

iv)

library(plm)
library(lmtest) 
lm_fe <- plm(rental$lrent ~ rental$y90 + rental$lpop + rental$lavginc + rental$pctstu,
                     data = rental,
                    index = c("city"), 
                    model = "within")
tidy(lm_fe)
# Or you can use mean differencing method directly through lm base function.
# First obtain the demeaned data in each group, city, then just run the ols without the intercept,
# you will get the same result.

The coefficient on \(y90t\) is identical to the intercept from the first difference estimation, and the slope coefficients and standard errors are identical to first differencing method in iii).

Note that we do not report an intercept because it gets removed by the time demeaning, namely

\[y_{it} = \alpha + x_{it}\beta + u_i+\epsilon_{it} \implies y_{it} - \bar{y_i} = (x_{it}-\bar{x_i})\beta + (u_i-u_i)+(\epsilon_{it}-\bar{\epsilon_i}).\]

# If you would like to get heteroskedasticity-robust errors for inference,
# use the following function
# coeftest(lm_fe, vcov. = vcovHC, type = "HC1")