Announcement

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

  • Repeated time values within panel

    Dear All,

    I would like to generate a gravity model including product and I have three-dimensional-panel data. When I try to generate xtset command w.r.t. destination and product, I have an error as repeated time values within panel.

    Moreover, I tried to group j and k into id and try to generate xtset as xtset id t but it gives me the same error.

    I will appreciate with your precious support.
    M.

    t k j exp_i ln_exp_i exp_j j_gdp j_ln_gdp
    1996 1205 528 1.854 0.6173455 296.894 5.693377
    1996 1206 40 40.291 3.696128 4.597279 2989.77 8.002951
    1996 1206 58 26.964 3.294503 27489.6 10.22156
    1996 1206 208 15.009 2.70865 3565.71 8.17912
    1996 1206 246 2.991172 25783.5 10.15749
    1996 1206 251 2417.353 7.790429 2.900212 2687.29 7.896287
    1996 1206 276 197.306 5.284756 7.391737 3485.87 8.156472
    1996 1206 300 57.139 4.045487 13749.1 9.528729
    1996 1206 372 0.748 -0.2903523 2835.9 7.950114
    1996 1206 380 456.444 6.123466 2381.65 7.775548
    1996 1206 528 219.883 5.393095 7.092826 296.894 5.693377
    1996 1206 724 1546.549 7.343781 3.502429 1619.84 7.390085
    1996 1206 752 12.957 2.561636 32999 10.40423
    1996 1206 826 4.918 1.592902 5.379565 2446.43 7.802385

  • #2
    As you don't show the actual command(s) used to "group j and k into id and try to generate xtset as xtset id t" it is impossible to say what you might have done wrong.

    Suffice it to say that when I use your example data and run:
    Code:
    egen id = group(k j)
    xtset id t
    it runs with no error messages.

    Now, your example data is rather scanty, and, in particular, it only continues one value of t. I suspect that the problem arises from other observations in your data set that are not shown. I suggest you post back with the actual code you are trying to use, and also with a new example data set that actually reproduces the error you are getting.

    One other suggestion: I have never known Stata to be wrong when it reports this duplicate time values error. You appear to believe that the combination of j and k as a panel identifier and t should work properly for -xtset-. If that is correct, then the combination of j, k, and t should uniquely identify observations. So you can find the observations that are causing your problem by running:
    Code:
    duplicates report j k t, gen(flag)
    browse if flag
    Then you will need to figure out whether these surplus observations for some combinations of j, k, and t are data errors, or whether they are correct observations and you need something more than just j and k to identify panels for your analysis, or whether the data are correct and complete and you really just shouldn't have a time variable in your -xtset- command.

    Comment

    Working...
    X