Announcement

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

  • Number of clusters in fracreg

    I am working with data at the firm-year level where I am running a regression with standard errors clustered by firm. Because my dependent variable is a ratio between zero and one, I also estimate a fractional regression model. I noticed that the number of clusters in the fractional regression is greater than the number of clusters in the OLS regression containing the same variables and the same number of observations. Can someone please explain why? See an example of the same result below. Any thoughts are appreciated.

    Code:
    version 16
    cls
    webuse nlswork, clear
    gen prop_wks_work = wks_work / (wks_work + wks_ue)
    label variable prop_wks_work "Proportion of weeks worked last year"
    assert 0<=prop_wks_work & prop_wks_work<=1 if !missing(prop_wks_work) // The dependent variable takes values between zero and one.
    
    regress prop_wks_work age grade, vce(cluster idcode)
        quietly duplicates report idcode if e(sample)==1 // Store number of unique values of "idcode" in the sample.
        assert `e(N_clust)'==`r(unique_value)' // Number of clusters is equal to the number of unique values.
    
    fracreg logit prop_wks_work age grade, vce(cluster idcode)
        quietly duplicates report idcode if e(sample)==1
        display `e(N_clust)'
        display `r(unique_value)'

  • #2
    Dear Rafael,

    Thanks for pointing this out. This is a problem when the number of clusters is reported. You should get the same results from -fracreg logit- as you would typing:

    Code:
    glm prop_wks_work age grade, family(binomial) link(logit) vce(cluster idcode)
    In the example above, you get the same standard errors and point estimates, but the number of clusters is not displayed correctly in the note.

    Comment


    • #3
      Hi Enrique,

      Thank you for your prompt reply. I am glad the issue has no effect on the standard errors calculation. For the number of clusters stored in e(N_cluster), is there a place for me to report the bug for future fixes or are you reporting it?

      Thank you,

      Rafael

      Comment


      • #4
        Hi Rafael,

        I am reporting this bug and it will be fixed in a future update. Whenever you find something you can write to [email protected].

        Thanks

        Comment


        • #5
          Thank you very much, Enrique!

          Comment


          • #6
            This bug has been fixed in Stata 17 by the update of July 13, 2021. Thanks!

            Comment

            Working...
            X