Announcement

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

  • Stata error, "repeated time values within panel"

    Hi everyone,

    I have a panel data of 5726 observations. I want to run a fixed effects model to capture regional effects. My command is

    encode commid, gen(comm_id)
    xtset comm_id region

    However, stata returns the error "repeated time values within panel". How can I fix this?

  • #2
    Either use -areg y x, absorb(region)-, or if you do not want to, explain better what is the structure of your data.

    Comment


    • #3
      This doesn't make any sense
      Code:
      xtset comm_id region
      You're telling Stata that the comm id var is your unit and region is your unit of time, and unless there's a new temporal metric I've not heard of, region can't be a time.

      The fact that you get repeated time samples is expected and necessary- it would be a little like if I did country continent in xtset, well we have many nations in the same continent, so of course we'll have repeated time values.
      Last edited by Jared Greathouse; 29 Apr 2022, 16:50.

      Comment


      • #4
        first, although Stata describes the second variable in the -xtset- command as a timevar, there is no reason this needs to be true - it just needs to be nested within the first variable

        second, re: #1, how you "fix" the situation depends on why it is true; please read, and follow the advice in the FAQ

        Comment


        • #5
          Thank you so much for replying. I'm trying to recreate a table from a paper for my term project and the goal of the project is to use logit (the author used LPM). For the Child fixed effects model my code is:
          xtset child_id round
          xtlogit y x1 x2 x3
          (this worked well)

          There's no year or time variable in the dataset, so I assume time is captured by "round" variable. So for the regional fixed effects model I assumed it would have been:
          xtset comm_id region

          but stata says repeated time values, even when I do:

          xtset comm_id round

          Comment


          • #6
            Wait, you can have regional FE with child_id as your unit of analysis. Point is, you need a set of unique identifiers. So you need to do xtset child_id round, g, and for your model just do
            Code:
            reg y x i.region i.round, vce(cl child_id)

            Comment

            Working...
            X