Announcement

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

  • Year Dummy (i.year) is OK but CountryType Dummy (i.CountryType) is omitted in Fixed effect regression

    I have banks panel data of 18 countries and want to run xtreg fixed effect with i.countryType (Developed, Emerging, Frontier) and i.year. I go fine with i.year but omit the results of countryType (i.countryType) variable. I run the following two commands but face the same results:
    xtreg Y X controls i.countryType i.year, fe
    xtreg Y X controls Dev Emer Frnt i.year, fe (Dev=1 if countries are developed; Emer=1 if countries are Emerging; Frnt=1 if countries are Frontier else 0 for all three columns)

    but the simple regression goes well and produce the results, I mean Stata does not omit the i.countryType and give results:
    reg Y X controls i.countryType i.year

  • #2
    It is impossible to give you a definitive answer because you do not say how you -xtset- the panel variable. But I'm going to guess that you used country as the panel variable. If that is the case, then you cannot include countryType in a fixed effects regression because countryType will not vary over time within country. Variables that do not vary within panel are always omitted from fixed effects regressions--they are colinear with the fixed effects themselves, so their effects are mathematically impossible to estimate in a fixed-effects model.

    If countryType is a variable of actual interest in your research hypothesis, then you must use -reg- rather than a fixed effects model for your analysis. Or you can use a Mundlak or correlated random-effects model to get both the between-country effect of countryType and fixed-effects estimates of those other variables that do vary within country. (See -xtreg, cre- if you have StataNow, or -xthybrid-, available from SSC, if you don't.) But if your research hypotheses do not require an estimate of the effect of countryType on your outcome variable Y, and you are including it just as a covariate ("control variable"), then just leave it out of the -xtreg, fe- and proceed without it. One of the nice things about fixed effects regressions is that they automatically adjust for the effects of all variables that are constant within panel, even variables that you have no data for and cannot even consider including in the regression model.

    Added: If you did not use country as the panel variable when you -xtset- your data, then there is some other problem. In that case, please post back showing example data that reproduces this problem, your -xtset- command and your complete -xtreg, fe- command. Please use -dataex- to show the example data so that those who want to help you can actually use the example data in their Stata setup to work with it. If you are running version 18, 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.
    Last edited by Clyde Schechter; 02 Nov 2024, 18:51.

    Comment


    • #3
      Thank you very much Dr. Clyde Schechter for your valuable information. I want to clarify that I want to compare the results of all three types of countries i.e. Developed, Emerging, and Frontier in my analysis.
      As per your requirements, the xtset and xtreg fe are under given (my panel is bank wise on yearly basis):
      xtset bank_code year, yearly
      xtreg $ylist $xlist $clist i.APAC i.year, fe (i.year run fine but i.APAC omitted in this command), However, when I run "reg $ylist $xlist $clist i.APAC i.year" it goes fine.
      Click image for larger version

Name:	Stata 1.bmp
Views:	1
Size:	70.6 KB
ID:	1766842
      Click image for larger version

Name:	Stata 2.bmp
Views:	1
Size:	1.58 MB
ID:	1766841
      Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.

      Comment


      • #4
        Khalilur:
        the -fe- estimator (unlike the -re- one), wipes out all the time-invariant variables.
        If APAC (I guess) is a bank id, it remains constant as time goes by. Subtracting the within-panel mean to a constant, gives back 0 or, in the -fe- parliance, no coefficient.
        In addition, please read the FAQ about how to share what you typed and what Stata gave you back and how to use -dataex-. Thanks.
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          Dear Dr. Lazzaro,
          Thanks for your time. APAC is not a bank rather type of country i.e. Developed (1), Emerging (2), or Frontier (3)

          Thanks and Regards,
          Khalil
          Last edited by Khalilur Rahman; 03 Nov 2024, 04:44.

          Comment


          • #6
            Khali:
            thanks for clarifying.
            The issue remains the same, though: if APAC does not change within panels (as expected), the -fe- estimator (unlike the -re- one) will give you back no coefficient.
            Kind regards,
            Carlo
            (StataNow 18.5)

            Comment


            • #7
              I see that O.P. did not -xtset- country as the panel variable. (Indeed, he couldn't, as it is a string variable.) However, the variable he did use, bank_code, appears to just be a numerical encoding of country. In the example data he shows, there is an exact 1:1 correspondence between values of bank_code and values of country. Assuming that remains true in his full data set, he is in the same position as he would be had country itself been used. countryType is time-invariant within bank_code, and so it is omitted.

              O.P. now states that he wants to compare the results for all three country types. In that case, he has to accept that he simply cannot use a fixed effects model for this purpose. In #2 I mentioned some alternative approaches that are available to him. I urge him to adopt one of those.

              Comment


              • #8
                On additional thought. O.P. says in #3:
                I want to clarify that I want to compare the results of all three types of countries i.e. Developed, Emerging, and Frontier in my analysis.
                The meaning of that sentence is unclear. If he wants to contrast the levels of the outcomes across the three types of countries, then everything I have said in #7 and earlier still holds. In particular, a fixed-effects estimator is simply incapable of doing that.

                But if he wants to contrast the effects of the variables in $xlist across the three types of countries, that is a different story. The interaction terms between countryType and the xlist variables will not, in general, be constant within country, and so these interactions can be estimated in a fixed effects model. If he wants to go this route, he has to remember to prefix all of the continuous variables in $xlist with c., to avoid having Stata treat them as discrete. After modifying $xlist in that way,
                Code:
                xtreg $ylist i.APAC##($xlist) $clist i.year, fe
                margins APAC, dydx($xlist)
                will do the job.

                I will spare everyone my usual rant about why these lists of variables should be stored in local, not global, macros.

                Comment


                • #9
                  Thank you very much again for all. (note: I mentioned CountryType which is basically APAC in my data.)
                  I should try explain it again, because I feel that I am lacking to deliver properly.

                  I have banks from different countries and those countries are categorized as D, E, and F (developed, emerging, frontier)
                  I have data of banks (Variable y) along with country level climate (variable x) data. So, country level climate data (variable x) will be same for all the banks belongs to same country.
                  the controls are mix of industry and country level data (variable c)
                  Now y= x + c + dummy (i.year i.APAC)
                  so that I can compare Developed, Emerging and Frontier countries.
                  in case of i.year I have results but in case of i.APAC my results are omitted. [Screenshot attached]

                  I have attached the sample data (excel file) for your perusal.
                  Thanks and Regards,
                  Khalil
                  Attached Files
                  Last edited by Khalilur Rahman; 03 Nov 2024, 13:37.

                  Comment


                  • #10
                    If each bank operates only in one country, as seems to be true in all the bank-level data sets that appear here on Statalist, then even if the full data set does not have a 1:1 correspondence between bank_code values and country values, it will still be the case that the variable APAC will not vary within the observations for any single bank. That's ecause all of a bank's observations are part of the same country, and that country's APAC is an unchanging value. So you are still in the same position. EverythingI have said in #2, #7, and #8 still applies.

                    Comment


                    • #11
                      Thank you very much Dr. Clyde Schechter.
                      Now I got it,
                      it will still be the case that the variable APAC will not vary within the observations for any single bank.
                      I will do 2,7,8 and will get back to the post if I face any problem again.

                      Regards,

                      Comment

                      Working...
                      X