0
$\begingroup$

I am working on a first-difference (FD) estimator for panel data (only two time periods).

I calculated manually the first difference of each variable (dependent and two regressors) and then run an OLS on the first-differenced model:

mydata$l_y <- Lag(mydata$y, -1)
mydata$l_x1 <- Lag(mydata$x1, -1)
mydata$l_x2 <- Lag(mydata$x2, -1)

mydata$delta_y <- mydata$y - mydata$l_y
mydata$delta_x1 <- mydata$x1 - mydata$l_x1
mydata$delta_x2 <- mydata$x2 - mydata$l_x2

fd1 <- lm(delta_y ~ 0 + delta_x1 + delta_x2, data = mydata)
coeftest(fd1, vcov=vcovHC(fd1, type="HC0"))

Then I run the FD estimation from the plm package on R but got completely different results:

fd2 <- plm(y ~ 0 + x1 + x2, data = mydata, model="fd")
coeftest(fd2, vcov=vcovHC(fd2, type="HC0"))

I am struggling to understand why the estimates are different. Any tips would be much appreciated.

$\endgroup$

1 Answer 1

0
$\begingroup$

This is hard to answer without an appropriate min. reproducible example (and then maybe it is rather on-topic on Stackoverflow).

Some guesses:

  • Lag is not a function contained in base R, it is unclear to me whether it respects the panel structure when lagging the data. plm's lag does so.
  • plm's FD model does first-differencing based on rows which can lead to different results when data is not time-consecutive.
$\endgroup$

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.