Announcement

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

  • Specifying error structure in multilevel models

    I'm running multilevel model and attempting to specify error structure. The error message indicates possible duplicates at lowest level.
    Code Used:
    xtmixed sales int rdint emp year || reg: ||seg2: ind3 ind1, residuals(ar 1, by(firm) t(year))
    repeated time values within lowest-level panels
    r(459);

    I've checked for duplicates using the following.
    quietly by firm year: gen dup = cond(_N==1,0,_n)

    tab dup

    dup | Freq. Percent Cum.
    ------------+-----------------------------------
    0 | 7,112 100.00 100.00
    ------------+-----------------------------------
    Total | 7,112 100.00

    It doesn't seem that there are repeated time values at the lowest level. Does anyone have a suggestion?

    With best regards,
    Kurt

  • #2
    what version of Stata are you using? is it up-to-date? what was your xtset command?

    Comment


    • #3
      I am not entirely sure, because I have never encountered this specific problem before (autoregressive error structure doesn't play a very big role in my line of work), but I think that you are misunderstanding the error message.

      I do not think that Stata is complaining about duplication of year within firm. I believe Stata thinks that your lowest level in the hierarchy is seg2, and it is complaining that year is repeated within seg2. I think if you add -|| firm:- to your model specification, you will not get this message. I think you also will have no need of the -by(firm)- suboption within -residuals()- when you do that. (In fact, I don't think the -by(firm)- suboption even makes sense once you do that.)

      So, in short, I think you want:

      Code:
      xtmixed sales int rdint emp year || reg: ||seg2: ind3 ind1 || firm:, residuals(ar 1, t(year))

      Comment


      • #4
        Thank you both for answering so promptly. Dr. Schecter, your suggestion worked. Thank you.

        Comment


        • #5
          I agree with Clyde Schedter's remarks; they make sense. However, becuase "by" residual option was to estimate the variance for each level of the variable (in this case, the firm), it may make sense to keep it, I think.

          Also specify which version of Stata you're using. If you're using Stata 14, then use
          Code:
          mixed
          .
          Nathan E. Fosse, PhD
          [email protected]

          Comment

          Working...
          X