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

Condfstat and CGM2 interaction #33

Open
EdJeeOnGitHub opened this issue Sep 8, 2020 · 0 comments
Open

Condfstat and CGM2 interaction #33

EdJeeOnGitHub opened this issue Sep 8, 2020 · 0 comments

Comments

@EdJeeOnGitHub
Copy link

Hi - big fan of the package!

There appears to be a bug where even with only one clustering variable the conditional fstat changes depending on which cmethod argument is used in felm. For example:

library(lfe)
#> Loading required package: Matrix
library(tidyverse)

set.seed(6)
fake_data <- matrix(rnorm(1000*5, 0, 1),
                    nrow = 1000,
                    ncol = 5) %>% 
  as_tibble() %>% 
  mutate(group = factor(rep(1:5, 200)))
#> Warning: `as_tibble.matrix()` requires a matrix with column names or a `.name_repair` argument. Using compatibility `.name_repair`.
#> This warning is displayed once per session.


lfe_fit_cgm <- felm(formula = V1 ~  1| group | (V2|V3 ~ V4 + V5) | group,
                data = fake_data,
                cmethod = "cgm")
lfe_fit_cgm2 <- felm(formula = V1 ~ 1 | group | (V2|V3 ~ V4 + V5) | group,
                     data = fake_data,
                     cmethod = "cgm2")



condfstat(lfe_fit_cgm)
#>                 V2       V3
#> cluster F 1.945907 2.995397
#> attr(,"df1")
#> [1] 1
condfstat(lfe_fit_cgm2)
#>                 V2        V3
#> cluster F 1.945907 0.0120056
#> attr(,"df1")
#> [1] 1

My understanding is that with only one clustering dimension cgm and cgm2 should return identical results?

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

1 participant