Announcement

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

  • Country/Time-Fixed Effects

    Hi all,

    I am an absolute beginner in stata and urgently need your help.

    I am doing a regression analysis on a panel dataset containing information on banks' balance sheets and income statements.
    I want to regress a few dependent variables (Profits, Size, Collateral) on Leverage and cluster standard errors at bank/firm level. My code:
    reg Leverage Profits Size Collateral, vce (cluster Bank_Name)

    Further, the regression should account for country & time fixed effects using the -xtreg- command and the fe option. I already created a numerical identifier for country:
    egen identifier_country = group(country)

    However, if I run xtset identifier_country year I get the following error message: "repeated time values within panel". This is because I the dataset contains information on multiple banks in the same year in the same country and stata sees this as repeated values.

    My question: How can I overcome this problem? Any suggestions?

    Thank you!

    Marius



  • #2
    Change your -xtset- command to just -xtset identifier_country-. Unless you are going to do analyses involving time series operators like lag and lead, or autoregressive correlation structures, you do not have to specify a time variable in -xtset-. And, as you can see, when you have multiple observations of the same country in the same year, you can't specify it.

    In any case, to get the time fixed effects into your model you need to include i.year in the list of predictors in your -xtreg- command. (You would have needed to do that even if you had been able to -xtset identifier_country year-. -xtreg- will automatically incorporate panel fixed effects, but it does not automatically incorporate time fixed effects.)

    Comment


    • #3
      If I understand correctly, the following code accounts for time- and country fixed effects and clusters at bank/firm-level.
      reg Leverage Profits Size Collateral i.year, vce(cluster Bank_Name)

      Can I know repeat the same code with time-fixed effects only and country-fixed effects only?

      Comment


      • #4
        Marius:
        to account for country fixed effect, you should add .i.country- in your code.
        That said, I fail to get why you do not switch to -xtreg- with the modified -paneid- that Clyde suggested.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          I switched to -reg- as I could not cluster at bank-level using vce(cluster bank_name) as a -xtreg- option. Whenever I run the code (see below), I receive an error message saying that "panels are not nested within clusters".

          xtset identifier_country
          xtreg Leverage Profits Size Collateral i.year, fe vce(cluster Bank_Name)

          Comment


          • #6
            Marius:
            can't you consider to use -Bank_Name- as -panelid- and plug -i.country- in the right-hand side of your regression equation?:
            Code:
            xtset Bank_Name year ///however, as Clyde wrore, -timevar- is not necessary if you do not plan to use time-series operator in your regression
            xtreg Leverage Profits Size Collateral i.year i.country, fe vce(cluster Bank_Name)///if this code fits your research needs, you can stick with default standard error unless you suspect heteroskedasticty and/or autocorrelation
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              Thank you, Carlo! I figured it out myself and came to the exact same regression. Perfect!
              Now, I still need to lag the independent variables by 1 year.



              Comment


              • #8
                Dear,

                Is there a difference between country-time fixed effects and adding country and time fixed effects separately?
                If so, am I adding the first one to my regression by interacting the country and time dummy?

                Best regards,
                Lucas

                Comment


                • #9
                  Lucas:
                  yes, there is.
                  As you surmise, the first option is an interaction:
                  Code:
                  i.country#i.time
                  whereas the second one (that I would sponsor) includes both -i.country- and -i.time- fixed effects in the right-hand side of your regression equation.
                  Kind regards,
                  Carlo
                  (Stata 19.0)

                  Comment

                  Working...
                  X