Announcement

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

  • Panel data - repeated time values within panel

    Hi All,

    I have a dataset that has the following format
    Company Dependent var Independent vars Company ID Date Rating agency 1 dummy Rating agency 2 dummy
    A Values Values 1 01/01/2015 0 1
    A Values Values 1 01/01/2015 1 0
    A Values Values 1 01/01/2014 1 0
    B Values Values 2 01/01/2015 0 1
    B Values Values 2 01/01/2014 0 1
    As you can see companies can have multiple values at the same period (as they are rated by 2 different agencies). The problem then arises that when I use xtset to define my panel data it throws the "repeated time values within panel". I wish to cluster errors by company and so I define the panel data set using "xtset CompanyID Date". Is there a way I can get round the error?

    I wish to distinguish between the two entries that stata perceives as the same (i.e. but isnt as the dummy variables differentiate between them) but still cluster errors bases on company (using company id). Do I need to create a new id? (will this lose clustering by company?)

    Any help would be appreciated.

    Laurence

  • #2
    xtset requires a panel identifier; it doesn't absolutely require a time variable. That still leaves the question of whether you are modelling the dependence structure correctly with whatever model you use under xt. Similarly, it may be that panels should be defined differently, but then Stata won't treat the same company in different panels any differently from different companies in different panels.

    Comment


    • #3
      Lawrence:
      a fix that springs to my mind without knowing anything substantive about your data would be to replace the two dummies concerning the rating agencies with a single one named, say, "both_agencies rating" with two categories, such as yes (if both agencies rated the company the same year); no, (if otherwise).
      That way, you may probably drop (or, at any, rate, rule out from the panel data regression) the redundancies Stata warned you about.
      Kind regards,
      Carlo
      (StataNow 18.5)

      Comment


      • #4
        I wish to define my panel using a time variable and by company. Thereby capturing variation over time and across companies. Similary I wish it to distinguish between observations captured using the two aforementioned dummy variables. But stata currently perceives multiple observations with different dummys as the same. Can I somehow force it to take account of these multiple observations with different dummys in the same time period, as later when I run my model the dummys are included to differentiate between the observations.

        Comment


        • #5
          Thanks Carlo Lazzaro but I actually have 3 ratings agencies ( 0 0 indicates A, 1 0 indicates B, 0 1 indicates C). The trouble being that the panel thinks it is observing multiple observations for the same company in the same period (as xtset will only accept 2 variables (usually time and id)). I need to get it to accept these multiple observations so I can distiguish between them later in my model that includes the dummy variables.

          Comment


          • #6
            There is no forcing here. Using company and time to define panels isn't consistent with the data which is why xtset complained. You have, as I understand it, a data structure that makes perfect substantive sense, but there is only one way to use xtset with it.

            Comment


            • #7
              Nick Cox, should I then redefine my panel, for instance create a new id that takes account of the dummy variables?

              Comment


              • #8
                Sorry, I can't add to previous comments as I don't know what models would make sense here.

                Comment


                • #9
                  Laurence:
                  you may want to investigate whether -egen- with -group- function can help you out in redefining your panel.

                  PS: Crossed in the cyberspace with Nick's reply.
                  Kind regards,
                  Carlo
                  (StataNow 18.5)

                  Comment


                  • #10
                    Cross-posted at http://stackoverflow.com/questions/3...s-within-panel

                    Please see our cross-posting policy, which is that you should tell us about it. http://www.statalist.org/forums/help#crossposting

                    8. May I cross-post to other forums?


                    People posting on Statalist may also post the same question on other listservers or in web forums. There is absolutely no rule against doing that.
                    But if you do post elsewhere, we ask that you provide cross-references in URL form to searchable archives. That way, people interested in your question can quickly check what has been said elsewhere and avoid posting similar comments. Being open about cross-posting saves everyone time.
                    If your question was answered well elsewhere, please post a cross-reference to that answer on Statalist.

                    Comment


                    • #11
                      On reviewing this, I'm left with a question that your description of your data leaves unanswered. Looking at your first two observations - company A in 2015, rating agency 2 then rating agency 1 - other than the dummy variables, what differs in the data between the two observations? Is the the dependent variable the "rating" (whatever that is) given by the agency, while the independent variables are are company characteristics identical in both observations? Or is the dependent variable the same in both observations, but (some of) the independent variables differ depending on the rating agency? Or is it some combination of both?

                      Comment


                      • #12
                        William Lisowski only the dependent variable differs (other than the dummy variable), the independent variables are all constant as they pertain to the company.

                        Comment


                        • #13
                          Laurence,

                          You have not been clear about your data (or your research question, for that matter.). In particular, your first post says you have ratings from 2 agencies; your 3rd, that you have ratings from 3 agencies, indicated by the combination of values from 2 agency dummies. I'm going to guess that what you describe as independent variables are financial variables which are constant for each firm-year pair. I'm also going to guess that the "dependent variable" is the rating from the agency indicated by your rating agency dummies. If that's all correct, I would restructure the data so you have one observation for each firm-year pair, with 3 0/1 dummies for the rating agencies A, B, and C, and separate variables for the ratings from each agency:
                          Comp CompID year ratingA ratingB ratingC var1 var2 dumA dumB dumC
                          A 1 2015 AAA AA . 101 1.1 1 1 0
                          A 1 2014 . AA . 103 2.1 0 1 0
                          B 2 2015 A Aaa 201 3.2 1 0 1
                          This setup allows you to use panel commands to calculate leads,lags and changes over time, for instance. Whether it works for yur estimation model I don't know, because you haven't been clear about your research question, either.
                          Last edited by Devra Golbe; 24 Jul 2016, 11:28. Reason: Accidently sent too soon.
                          Devra Golbe
                          Professor Emerita, Dept. of Economics
                          Hunter College, CUNY

                          Comment


                          • #14
                            Devra Golbe thanks. I see how you have set it up and did consider that, but the rating is the dependent variable and as such there can only be one.

                            rating = indepVars + dummyA + dummyB

                            where these particular dummies indicate which agency the rating is from.

                            As such I wish to stipulate a panel that varies over companies(rated) and time. Hence the use of "xtset companyID year". However, the data in this form seems to be creating problems in stata, as detailed above.

                            I cold set it up as suggested but then it would not be applicable for my model.

                            I have considered using a more generic ID and then clustering by the companyID. But I am still learning about this. The ideas are much appreciated.
                            Last edited by Laurence Jones; 24 Jul 2016, 11:55. Reason: better understanding of previous replies

                            Comment


                            • #15
                              I thought your unit of observation was the firm-year. The structure I suggested only has one observation for each firm and year.
                              Devra Golbe
                              Professor Emerita, Dept. of Economics
                              Hunter College, CUNY

                              Comment

                              Working...
                              X