Announcement

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

  • VAR error "Repeated time values in sample" even after defining panel dataset

    I have a panel dataset and I have defined accordingly.

    Code:
     xtset id week
           panel variable:  id (strongly balanced)
            time variable:  week, 1 to 73
                    delta:  1 unit
    However, when I use var (vector autoregression) command, I get an error:
    Code:
    . var logtw sumfse3
    repeated time values in sample
    r(451);
    I have made sure that the id and week combination uniquely identifies each entry. Would appreciate any advice. Thanks!

  • #2
    I don't do time-series analysis, but your data has an id variable which means that the time variable, week, is repeated by id. Correct?
    The command var however appears to expect only a single time-series.

    Comment


    • #3
      Yes, I have multiple observations (week) for each individual (id). In that case, how do I carry out a vector autoregression?

      Comment


      • #4
        Hi,
        There are two approaches to that; keeping in mind that applying VAR to panel data will complicate the error structure of the estimation, you might look it up in an econometrics book.

        1. If you want a formal VAR in panels look for the command <pvar>
        2. If you are looking for a crude VAR treatment of a panel data set you need to create a variable that uniquely identify every observation and doesn't cross seams when applying lags to variables. I would do the following as a suggestion;
        Code:
        gen x=id+10000
        gen t=week+1000
        gen xt=x+t
        sort xt
        tsset xt
        that all to give the data a pseudo time series structure

        Comment


        • #5
          Thanks...I'll try the crude approach to begin with.

          Comment


          • #6
            Hi Kevin, did you manage to solve this issue? I am experiencing the same problem with my data.

            Comment


            • #7
              How to determine the optimum lag length in panel data?

              Comment

              Working...
              X