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 when specifying vcov in feglm.fit #237

Closed
etiennebacher opened this issue Nov 22, 2021 · 4 comments
Closed

Error when specifying vcov in feglm.fit #237

etiennebacher opened this issue Nov 22, 2021 · 4 comments

Comments

@etiennebacher
Copy link

etiennebacher commented Nov 22, 2021

Hello,

If I try to specify a vcov argument in a *.fit() function, I have this error:

library(fixest)
feglm.fit(iris$Sepal.Length, iris[, 2:3], iris$Species, family = "poisson", vcov = "hetero")
feols.fit(iris$Sepal.Length, iris[, 2:3], iris$Species, vcov = "hetero")
Erreur dans feglm.fit(iris$Sepal.Length, iris[, 2:3], iris$Species, family = "poisson",  : 
  Problem in the VCOV:

  l'argument "data" est manquant, avec aucune valeur par défaut
Erreur dans feols.fit(iris$Sepal.Length, iris[, 2:3], iris$Species, vcov = "hetero") : 
  Problem in the VCOV:

  l'argument "data" est manquant, avec aucune valeur par défaut

But we are not supposed to add the argument data in those functions. Did I miss something in the docs, or is it a bug?

(Tested with Github version)

@edrubin
Copy link

edrubin commented Nov 24, 2021

I've found the same issue for feols.fit() in versions 0.10.1 and 0.10.2.

The error outputted (from 0.10.1):

Error in feols.fit(y = visits_dt[, c("hr_mean")] %>% qM(), X = visits_dt[,  : 
  Problem in the VCOV:

  argument "data" is missing, with no default

My code:

  est2_all = feols.fit(
    y = visits_dt[,"hr_mean"] %>% qM(),
    X = visits_dt[,"sunrise"] %>% qM(),
    fixef_df = visits_dt[, .(lat_zone, naics_zone, week)] %>% qM(),
    weights = visits_dt[,total_visits],
    cluster = visits_dt[,county],
    lean = T,
    mem.clean = T
  )

Same issue if I just specify vcov = "cluster" rather than providing a variable to cluster on (will be different clustering in my case; just wanted to test it).

If I add a data argument, there's still an error (and a warning that notes that data is not a valid argument):

Error in feols.fit(y = visits_dt[, "hr_mean"] %>% qM(), X = visits_dt[,  : 
  Error in vcov_varnames %in% dataNames : object 'dataNames' not found
In addition: Warning message:
feols.fit(y = v...: data is not a valid argument for function feols.fit. 

Thanks for an amazing package!

@lrberge
Copy link
Owner

lrberge commented Nov 27, 2021

Hi and thanks for the words @edrubin!

I'm a bit annoyed tbh... I spend so much effort on error-handling. All that for you to end up with these lame error messages.... Very sorry! But that was easily fixed.

Thanks for the report!

@etiennebacher
Copy link
Author

Don't be sorry @lrberge, your package is great and you are very reactive to fix bugs, thanks a lot for your work

@edrubin
Copy link

edrubin commented Nov 27, 2021

Yes, thank you for your work, @lrberge!

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

3 participants