Announcement

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

  • Problems clustering/robust standard errors multilevel mixed effects

    Hi All,

    I have an issue with performing my multilevel mixed effects regressions analysis with clustered standard errors. I don't know what going wrong. I have a panel with firms located in several countries (50) and I use lags of the independent variables. I have checked whether the firms are constant within the countries over the years and that is the case. I make use of interaction variables.

    If I do a regression analysis without clustering the standard errors everything works fine, so, my regression analysis is:

    mixed y l.c.x1*l.c.x2 l.x1 l.x2 l.x3 l.yeardummies l.industrydummies|| ccode:

    the ccode is the country-level variable (highest hierarchical level). However, I want to cluster the standard errors of course, so I followed the help mixed command in stata with , vce (cluster ccode) or vce(robust):

    mixed y l.c.x1*l.c.x2 l.x1 l.x2 l.x3 l.yeardummies l.industrydummies || ccode: , vce(cluster ccode)

    But then, I get the error all the time: “error obtaining scores for robust variance” r(430).

    I have no clue what goes wrong. I have also tried:

    mixed y l.c.x1*l.c.x2 l.x1 l.x2 l.x3 l.yeardummies l.industrydummies [pw=firm] || ccode: , pweight(ccode) pwscale(size)

    But again I receive: “error obtaining scores for robust variance” r(430).

    Does anyone has an idea what is going on?

    Best wishes and many thanks,

    Michiel de Roo

  • #2
    p. 492 of the Manual entry for mixed

    5. Robust standard errors are clustered at the top level of the model, and this will always be true unless you specify vce(cluster clustvar), where clustvar identifies an even higher level of grouping.
    So your first syntax was correct. Further clustering on the highest level unit isn't needed. It ordinarily shouldn't matter, but perhaps the lagged variables have triggered the error.

    Your code is peculiar (lagged dummy variables are zero or one), but I can't say anything more. However in future posts, please show all real code and results, as requested by FAQ 12, not made-up code (the phrase" L.c.x1*L.c.x2" would throw an error).
    Last edited by Steve Samuels; 05 May 2016, 07:01.
    Steve Samuels
    Statistical Consulting
    [email protected]

    Stata 14.2

    Comment


    • #3
      Dear Steve,

      Thank you very much for your reply. I think indeed that the lag variables are triggering the errors, but I find this still very strange since Stata allows me to cluster the standard errors if I don't use lags of the independent variables. If I then compare the standard errors with the regression analysis that is not clustering the standard errors at the highest hierarchical level with the one that does, the standard errors are considerably different.

      Moreover, the "help xtmixed" command argues that it is possible to cluster the standard errors:

      xtmixed depvar [fe_equation] [|| re_equation] [|| re_equation ...] [, options]

      One of the "options" is

      SE/Robust
      vce(vcetype) vcetype may be oim, robust, or cluster clustvar

      So I'm not sure that further clustering on the highest hierarchical level isn't needed. Sorry for not posting the full code, it's just a very long equations and I thought it does not make it easier to understand the question/problem.

      Best wishes,

      Michiel

      Comment


      • #4
        You are quite right; I misinterpreted the statement in the Manual: it is robust standard errors, i.e. from vce(robust), which are equivalent to those from vce(cluster).
        Steve Samuels
        Statistical Consulting
        [email protected]

        Stata 14.2

        Comment


        • #5
          Michiel de Roo discovered a bug in mixed. We will have it fixed in the next update. In the meantime, a workaround is to generate the required time-series variables by hand, here is an example:

          Code:
          set seed 12345
          webuse nlswork, clear
          by idcode: gen t = _n
          keep if idcode < 2000
          xtset idcode t
          gen L_age = L.age
          by idcode: gen pw = runiform()
          by idcode: replace pw = pw[1]
          mixed ln_w grade age L_age ttl_exp tenure || id:, vce(cluster id)
          mixed ln_w grade age L_age ttl_exp tenure [pw=hours] || id:, pweight(pw)

          Comment


          • #6
            Rafal Raciborski (StataCorp) It seems that the problem still persists, but now in other form. I wasn't able to get the results with robust standard errors running a mixed regression with all the regressors being lagged (using the Stata
            Code:
            l.
            command). I re-run it again, without lagged regressors and it worked. After that, I created the lagged regressors by hand, I included them in the mixed regression with
            Code:
            vce(robust)
            , it worked but this time the LR test is not shown to compare the results with the OLS regression. I tried to get the LR test via
            Code:
            esttab
            but still does not work. Neither with xtmixed nor with mixed.
            L.E. Is LR test affected by the robust standard errors specification? Thank you.
            Last edited by Nicu Sprincean; 18 Sep 2018, 18:34.

            Comment


            • #7
              Please send your code and data to Stata Technical Services at [email protected].

              Comment

              Working...
              X