Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with vcov = "cluster" in fit functions #240

Closed
etiennebacher opened this issue Nov 30, 2021 · 1 comment
Closed

Error with vcov = "cluster" in fit functions #240

etiennebacher opened this issue Nov 30, 2021 · 1 comment

Comments

@etiennebacher
Copy link

etiennebacher commented Nov 30, 2021

Hello, this is quite close to #237 but I couldn't reopen it so I create a new issue.

The fit functions work well with vcov = "hetero" but they don't with vcov = "cluster". For example:

library(fixest)

# Work
feglm(Sepal.Length ~ Sepal.Width + Petal.Length | Species, data = iris, family = "poisson", vcov = "cluster")
feols(Sepal.Length ~ Sepal.Width + Petal.Length | Species, data = iris, vcov = "cluster")

# Don't work
feglm.fit(iris$Sepal.Length, iris[, 2:3], iris$Species, family = "poisson", vcov = "cluster")
feols.fit(iris$Sepal.Length, iris[, 2:3], iris$Species, vcov = "cluster")
Error in feglm.fit(iris$Sepal.Length, iris[, 2:3], iris$Species, family = "poisson",  : 
  Problem in the VCOV:

  To compute the Clustered VCOV, we need a variable for the clusters. Since you didn't provide
it in the formula, we typically deduce it from a) the 'panel.id' identifiers, or b) the first
fixed-effect. Problem: a) no 'panel.id' was set in this estimation, and b) the estimation had
only zero fixed-effect. Please provide it in the formula.

(Tested with GitHub version)

@lrberge
Copy link
Owner

lrberge commented Nov 30, 2021

fit methods are a pain in the neck because fetching the variables with which to compute the SEs is unsafe by construction. That's why there's limited support for them (hac/conley won't work for example). But this was a bug indeed. Now fixed, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants