Announcement

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

  • Panel data and ARIMA

    Hi

    I have tried to google and read various threads for days now, but unfortunately, I could not find an answer on the following issue...

    I am trying to do some STATA procedures (e.g. the correlogram) to analyse my data and to construct a forecast by the ARIMA model, but STATA states that my data sample includes multiple panels.
    I interpreted it as STATA thinks my dataset is a panel data. Therefore, I removed all variables besides the one I want to study along with a time variable, but it did not help on the issue. I am not sure what to do, to be able to make the correlogram and additional procedures to construct my ARIMA model. My data is weekly from 2021-2023, and it contains one unit after the remaining variables are removed from the data.

    Furthermore, I want to ask if it is even possible to do an ARIMA forecast with panel data? If yes, can I then use the procedures for time series after I define my data with tsset? Also, is it possible to use the arimaauto code?
    Thank you in advance, and I hope it makes sense.

    Best,
    Maria
    Last edited by Maria Philiposian; 31 Jan 2024, 10:32.

  • #2
    Originally posted by Maria Philiposian View Post

    I am trying to do some STATA procedures (e.g. the correlogram) to analyse my data and to construct a forecast by the ARIMA model, but STATA states that my data sample includes multiple panels.
    Show us your tsset command and output.

    Comment


    • #3
      Hi Andrew

      Thank you for the response. I attach a picture of the tsset command and the output.
      Also, I want to note that I have deleted week 52+53 and since they are not useful for my analysis.

      Best,
      Maria

      Click image for larger version

Name:	Skærmbillede 2024-01-31 kl. 18.20.08.png
Views:	1
Size:	79.2 KB
ID:	1741709

      Comment


      • #4
        So you have panel data and not time-series data. arima is a time-series estimator, so you cannot use it with panel data. The analysis of panel data differs from that of time-series data and you would not even want to use time-series methods on panel data. With panel data, you have several units, each observed over multiple periods:

        Code:
        webuse grunfeld, clear
        list company year invest if company<=3 & time<=5, sepby(company)
        Res.:

        Code:
        . list company year invest if company<=3 & time<=5, sepby(company)
        
             +-------------------------+
             | company   year   invest |
             |-------------------------|
          1. |       1   1935    317.6 |
          2. |       1   1936    391.8 |
          3. |       1   1937    410.6 |
          4. |       1   1938    257.7 |
          5. |       1   1939    330.8 |
             |-------------------------|
         21. |       2   1935    209.9 |
         22. |       2   1936    355.3 |
         23. |       2   1937    469.9 |
         24. |       2   1938    262.3 |
         25. |       2   1939    230.4 |
             |-------------------------|
         41. |       3   1935     33.1 |
         42. |       3   1936       45 |
         43. |       3   1937     77.2 |
         44. |       3   1938     44.6 |
         45. |       3   1939     48.1 |
             +-------------------------+
        With time-series data, you have one unit observed over multiple periods:

        Code:
        webuse air2, clear
        l t air in 1/20, sep(0)
        Res.:

        Code:
        . l t air in 1/20, sep(0)
        
             +----------+
             |  t   air |
             |----------|
          1. |  1   112 |
          2. |  2   118 |
          3. |  3   132 |
          4. |  4   129 |
          5. |  5   121 |
          6. |  6   135 |
          7. |  7   148 |
          8. |  8   148 |
          9. |  9   136 |
         10. | 10   119 |
         11. | 11   104 |
         12. | 12   118 |
         13. | 13   115 |
         14. | 14   126 |
         15. | 15   141 |
         16. | 16   135 |
         17. | 17   125 |
         18. | 18   149 |
         19. | 19   170 |
         20. | 20   170 |
             +----------+
        Last edited by Andrew Musau; 31 Jan 2024, 11:50.

        Comment


        • #5
          Hi Andrew

          Thank you very much for the respons.

          In my example, there is only one unit observed over multiple periods, but STATA still states my data as multiple panel data.
          E.g. from your example it will be the year variable and the invest variable, which I have.

          Should it not work in that case?

          Best,
          Maria

          Comment


          • #6
            If that is the case, you only need

            Code:
            tsset timevariable, weekly
            and drop the panel identifier.

            Comment


            • #7
              Hi Andrew

              Omg thank you so much! It works now
              That was a major help!! Have a great day.

              Best,
              Maria

              Comment

              Working...
              X