1
$\begingroup$

I'm following the tutorial Fast Fixed-Effects Estimation: Short Introduction of the R package fixest.

The very first example is:

library(fixest)
trade <- fixest::trade
gravity_pois <- fepois(
  Euros ~ log(dist_km) | Origin + Destination + Product + Year,
  trade
)

The estimated coefficient is -1.52787 with a standard error of 0.115678

I want to understand what this code is doing exactly.

I tried to replicate the results with the following code:

library(sandwich)
library(lmtest)

gravity_pois2 <- glm(
  Euros ~ log(dist_km) + Origin + Destination + factor(Product) + factor(Year),
  trade,
  family = poisson
)

gravity_pois2_cl <- coeftest(gravity_pois2, vcov = vcovCL, cluster = ~Origin)

I obtain an estimated coefficient of approximately -1.527 with a standard error of approximately 0.1156.

The difference between the two estimated coefficients is in the order of $10^{-14}$, and between the two standard deviations is of the order of $10^{-5}$.

My question is: from an econometric point of view, are the two codes equivalent? Is the first code just syntactic sugar for the second?

I know I can read the source code of fixest, but I don't have the skills to understand it.

Moreover, fixest purports itself to be faster, so it is probably using some algorithms to compute the values different from glm.

Regardless of the algorithm, I would like to understand if, from an econometric point of view, the two estimates are the same.

In particular, I'm concerned about the estimate of the standard deviation, because the difference between the two is low but not too low (i.e. much higher than the difference in the estimated coefficients).

$\endgroup$

1 Answer 1

1
$\begingroup$

Short answer: No, that's all there is.

Longer answer: All of the documentation of fixest stresses that it is fast, user-friendly, and has features for exporting the results easily. I didn't search all of it, but none of it seems to claim that it does anything novel, statistically; just that it does things faster and easier. They even offer a page of benchmarks showing how much faster it is.

If you regularly deal with large data sets ($10^6$ or more observations) it looks like the time savings could be substantial, particularly for complex or difficult data sets.

$\endgroup$
3
  • $\begingroup$ "no" is the answer to the question "from an econometric point of view, are the two codes equivalent?"? $\endgroup$ Commented Mar 29 at 19:06
  • $\begingroup$ No, it's the answer to your title question: "Is there more?" The two are equivalent. $\endgroup$
    – Peter Flom
    Commented Mar 29 at 20:13
  • $\begingroup$ ok ok. Thank you very much! $\endgroup$ Commented Mar 30 at 0:05

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.