Announcement

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

  • How to create a panel in which at each date I observe several realisations of the same variable?

    Dear all,

    I have to create a panel with which I'll need to run fix effect models and to cluster errors. Each individual in the panel is a municipality. In each municipality, there are referenda that take place at different dates. For each date, I have like 4-5 referenda. Initially, I thought I could build a municipality-date panel. Of course, that does not work because there is more than one referendum on each date. One alternative is to create a municipality-vote id panel. However, I'm not sure that this is the best alternative.

    Any ideas/recommendations?

    Thank you,

    Arnau.

  • #2
    Well, I'm guessing you only have one observation per municipality#vote, so there can't be a municipality#vote panel data set as there is no repetition within that "panel." So just go ahead and -xtset- municipality-. Note that you do not need to specify a time variable when you -xtset- the data. When you omit the time variable, -xtset- will not care about the presence of multiple observations per municipality#date.

    Now, you pay a slight price for this. Most of the usual -xt- commands will still work properly. But you will be unable to use time-series operators such as lead and lag, nor will you be able to run any models with auto-regressive structure. But bear in mind that this price is imposed on you by your data design: if Municipality 1 has 2 referenda in Year T, then in Year T+1 the lagged value of any variable is undefinable because there is no way to know which of the 2 referenda should be thought of as "the" lag. Etc. So these restrictions are inherent in the nature of your data.

    So just -xtset municipality- and proceed.

    Comment


    • #3
      That makes sense. Thank you! Just to clarify: in a given year there are 4-5 dates (I know the exact day) in which there are referenda. Then, in each of these dates, there are, again, like 4-5 referenda taking place on the same day.

      Comment


      • #4
        Yes, that is consistent with what I understood when making my suggestions in #2.

        Comment

        Working...
        X