Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • e(clust#) not working in reghdfe

    Hi,
    I ran into a problem where I do not know whether this is a bug or whether I am doing something wrong. I would like to extract the number of clusters used in each regression and ultimately save it as a scalar. According to the help file, this number should be stored in e(clust#). But this always seems to be empty. Consider the following MWE:

    Code:
    clear all
    sysuse auto
    
    reghdfe price weight length, absorb(rep78) vce(cluster rep78 foreign)
    
    di e(clust1) // should be 5, but returns .
    di e(clust2) // should be 2, but returns .
    
    di e(N_clust) // this works and correctly displays 2
    
    di e(N_clustervars) // this works too and displays 2
    What am I missing?

    (I'm running Stata 16.1 on a Mac and use the most recent version of reghdfe.)
    Last edited by Isabel Martinez; 27 Nov 2021, 12:50.

  • #2
    reghdfe is from SSC, as you are asked to explain (FAQ Advice #12). See

    Code:
    ereturn list

    Comment


    • #3
      The mystery has been solved (thank you Ercio Munoz for your Tweet!)

      It should be e(N_clust#), not e(clust#) as stated in the help file.

      Comment


      • #4
        It is no magic at all. Try #2, really! The broader point is that estimation results are stored in e().

        Comment


        • #5
          Andrew Musau : ok I see your point now, thank you. An explaining sentence re why -ereturn list- helps here would have made your original post more useful.

          Comment

          Working...
          X