I am running a fixed effects model. My data consists of multiple variables for two time points for about 180 countries. My aim is to assess the effect that variable iv2 has on dv1, while controlling for other variables such as iv1. There is something odd though and I have the strong suspicion it has something to do with the two time points.


When I run the fixed effects regression, the predicted values as well as the residuals have the same absolute value, but the opposite sign. The outcome puzzles me and I cannot wrap my head around it. Obviously, the residuals now violate the regression assumption of independent errors (serial correlation). Why does the model show this behaviour? Does this compromise the analysis of the effectiv2 has on dv1?

I would appreciate a formal mathematical explanation, but an intuitive explanation as to why this behaviour occurs in a fixed effects model (and not in random effects, for example) will also do the trick.

Here is a reproducible example in R:

# load the data:
df <- structure(list(country = c(1, 1, 2, 2, 3, 3, 4, 4, 5, 5), year = c(2010, 
         2015, 2010, 2015, 2010, 2015, 2010, 2015, 2010, 2015), dv1 = c(28.61, 
         31.13, 38.87, 39.46, 68.42, 70.39, 79.36, 80.55, 70.14, 71.48
         ), iv1 = c(-20.68, 0, NA, NA, -19.41, -18.73, 24.98, 25.23, 21.23, 
         -21.06), iv2 = c(-4.23, NA, NA, NA, -4.92, -4.22, 9.19, 9.37, 
         4.15, -3.92)), .Names = c("country", "year", "dv1", "iv1", "iv2"
         ), row.names = c(2L, 3L, 5L, 6L, 8L, 9L, 11L, 12L, 14L, 15L),class ="data.frame")

# load the plm package

# Run the fixed effects regression
regoutput <- plm(dv1 ~ iv1 + iv2, data = df, 
                 model = "within", index = c("country", "year"))

# The predicted values and residuals:
    # [1]  0.0000000 -1.0660019  1.0660019 -0.2458495  0.2458495 -0.6692384  0.6692384

    # [1] -2.987628e-15  8.100187e-02 -8.100187e-02 -3.491505e-01  3.491505e-01 -7.615597e-04  7.615597e-04

1 Answer 1


From my perspective this outcome is caused by the fact that in a two-period framework, fixed effects comes down to first differences and you therefor,e in fact just have one time period left.

Therefore, you just have one row of residuals for $t=2$ or, with reverse sign, for $t=1$. As it comes to the mathematics observe that time demeaning can be written as

$y_2-\frac{1}{2}(y_{1}+y_{2})=(x_2-\frac{1}{2}(x_{1}+x_{2}))\beta+u_2-\frac{1}{2}(u_{1}+u_{2})=\frac{1}{2}\Delta y_{2}=\frac{1}{2}\Delta x_{2}\beta+\frac{1}{2}\Delta u_{2}$.

As $\hat{\beta}\equiv (X'X)^{-1}X'Y$ the $\frac{1}{2}$ cancels out. From the differencing in the residuals and depending on the question whether we regard fixed effects as doing $\frac{1}{2}\Delta y_{2}=\frac{1}{2}\Delta x_{2}\beta+\frac{1}{2}\Delta u_{2}$ or $-\frac{1}{2}\Delta y_{2}=-\frac{1}{2}\Delta x_{2}\beta+-\frac{1}{2}\Delta u_{2}$ (resulting from reverse differencing) the problem of the inverse mirroring of the residuals and the fitted values becomes clear.

On the other hand random effects is only a quasi-time demeaning and in fact only an approach to model the variance-covariance matrix. Therefore in such a case you do not loose as much information, but you have to accept stronger assumptions.

Regarding your question with the serial correlation it is important to note that faster fixed effects or in this case first differencing you loose one time period. Or in other terms, with two-period fixed effects you do cross-sectional OLS with the differenced variables. Hence, the question of serial correlation does not arise in this context. However, whenever you do fixed effects with $t>3$ you indeed create artificial serial correlation.

$\textit{"The Guide is definitive. Reality is frequently inaccurate."}$, Douglas Adams


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.