Announcement

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

  • Fixed effects

    Hello,

    I have a question regarding fixed effects. I want to analyze the selling behavior of investors on the stock market. Therefore, I have transaction data of retail investors showing whether a stock was purchased or not including the price, the number of stocks, the date, investor identifier, the stock identifier (cusip) and a sell indicator (equal to 1 if the stock was sold) and so on. Now, I want to run a regression with the sell indicator being the dependent variable and I want to include time- and investor fixed effects. I know that I can declare my dataset with
    Code:
    xtset investor date
    to a panel data set and then apply
    Code:
    xtreg sell etc. i.date, fe
    to include time and investor fixed effects. My problem is that investor and date do not uniquely identify my data because an investor can buy multiple times on the same day. It is also not possible to do
    Code:
    reg sell etc. i.date i.investor
    as I have over 100,000 investors and therefore Stata is not able to run this code. I read in other posts that I can just use
    Code:
    xtset investor
    and then apply
    Code:
    xtreg
    but I am not sure whether this is the right way to go.

    I would be grateful if someone could help me with this issue!

  • #2
    You do not have a panel dataset. However, as long as you do not use any time-series operators

    xtset investor
    should work fine.

    Comment


    • #3
      I actually have a panel dataset as I have more than one entity and more than 1 time period. And what do you mean with time-series operators? If
      Code:
      xtset investor
      works than I would include time-fixed effects in my regression.

      Comment


      • #4
        Jana:
        Andrew's suspect is legal, as you do not report what Stata gave you back (-repeated time values within panel-, aka -r(451)-).
        That said:
        1) as per Andrew's helpful advice, provided that you're not intrested in using time-series operators (cuch as lags and leads), -xtset panelid- will work fine;
        2) you can safely include -i.timevar- (as you should when you go -xtreg, fe-) even -xtset- does not include the T indentifier of your panel dataset.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Thank you! Then I will use -xtset panelid-

          Comment


          • #6
            Originally posted by Jana He View Post
            I actually have a panel dataset as I have more than one entity and more than 1 time period.
            Ah, no! You can aggregate your data to generate a panel dataset by restricting it to at most one observation per entity per time period. At the moment, you have repeated observations data. Consult any econometrics textbook for the definition of a panel dataset. Carlo has addressed your second question.
            Last edited by Andrew Musau; 15 Dec 2022, 08:51.

            Comment

            Working...
            X