Announcement

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

  • reghdfe how to get e(clust#)

    Hi all,

    Greetings. I am writing to ask how to export the number of each cluster used in the regression after reghdfe. I have panel data with country-year pairs. In the regression, I control fixed effects at the country and year level. Since my data is unbalanced, I want to know how many countries have been used in each regression. From the help file, it seems the information is stored in e(clust#). I tried to display `e(clust1)' or `e(clustcountry)', but didn't get the information I wanted. I also checked the "ereturn list" and the e(df_a) contains the total number of clusters including both countries and years. But I want to get the number of countries separately and I didn't find any local or global vars containing such information.

    Please help me if you know how to do it. Thank you very much in advance!

    Regards,
    Haiyan
    Last edited by haiyan lin; 11 Mar 2024, 00:21.

  • #2
    I solved my problem with the below code:

    distinct country if e(sample)
    display `r(ndistinct)'

    Hope it helps.

    Comment

    Working...
    X