Announcement

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

  • Average ACF and PACF with panel data

    Hi,

    is there a command that extends corrgram to panel data?

    If not, do you have suggestions on how to compute the autocorrelation and partial autocorrelation plots and statistics in a panel setting?

    Thanks in advance.

  • #2
    I'm not aware of any. I think you have to iterate corrgram over the values of the panel identifier. -corrgram- leaves the autocorrelations behind in r() both as scalars for each lag and as a row matrix. So it goes like this:

    Code:
    clear*
    webuse grunfeld
    
    
    capture program drop one_company
    program define one_company
        tsset year
        corrgram invest
        matrix AC = r(AC)
        matrix PAC = r(PAC)
        local company = company[1]
        clear
        matrix combo = AC \ PAC
        svmat combo, names(col)
        gen statistic = cond(_n == 1, "AC", "PAC")
        gen company = `company'
        exit
    end
    
    runby one_company, by(company) status
    order company statistic, first
    Note: -runby- is by Robert Picard and me, and is available from SSC.

    Comment


    • #3
      Thanks Clyde.

      Do you know if there is a sensible way to "average" the ID-level ACF and PACF to obtain aggregate statistics? Assuming all the IDs follow the same data-generating process.

      Perhaps bootstrap?

      Comment


      • #4
        Sorry, I don't know. Perhaps somebody else who does will jump in.

        Comment


        • #5
          Thanks Clyde!

          Comment

          Working...
          X