Announcement

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

  • Results insignificant with xtset declare and significant without xtset declare

    Hi,
    I am analyzing panel data using Stata 18.

    xtreg CO2per FD CP FDI logPat logGDPperCapita logEnergy PopGrowth TradeGDP logIndustry, fe vce(robust)

    (CP is dummy variable)

    I use command xtset id time to declare before subsequently using any xtreg to run OLS, fe, re but most of the coefficients are not significant.
    I then try without xtset and everything becomes so good, both significance and the signs go the way I expected.
    Could you please help me explain the possible reasons.
    Is it possible to skip xtset and end up with the results without using it?

    This is how my panel data looks like

    Panel variable: CountryID (strongly balanced)
    Time variable: Time, 1998 to 2021
    Delta: 1 unit


    Thank you so much
    Last edited by Emmy Pham; 01 May 2024, 15:27.

  • #2
    There are no time fixed effects in the equation you show.

    xtset id time tells Stata your panel variable is id, and it will automatically perform within-transformation when you call xtreg, fe (I recommend always using xtreg, fe unless you have a time-invariant regressor of interest).

    By the Frisch Waugh theorem, the equivalent pooled ols regression to the equation you show is:

    Code:
    reg CO2per FD CP FDI logPat logGDPperCapita logEnergy PopGrowth TradeGDP logIndustry i.id, vce(robust)
    Note that there are still no time fixed effects, which I recommend you include.

    Comment


    • #3
      Emmy: If you use xtreg, fe after your xtset, you're including fixed effects at the level of the country. If you use reg without i.id then you are not using fixed effects -- instead, it is what is often called pooled OLS. It is rare that your estimates can be convincing without accounting for country FEs. And, as Maxence says, you should include i.year, too, to account for changes over time that affect the outcome and can be correlated with the explanatory variables.

      The reason fixed effects is so popular is that it helps to ensure your findings are not spurious. It isn't perfect, but it's typically a minimal requirement.

      Comment


      • #4
        reghdfe CO2per FD CP FDI logPat logGDPperCapita logEnergy PopGrowth TradeGDP logIndustry , absorb(id time) vce(robust)

        You don't have to xtset your data for reghdfe, so you'll see it's got nothing to do with that.

        Your issue is going to be the standard errors. If you have enough countries (near 30 but more better), then you can cluster(id). If not, there are issues, as the normal standard errors and robust errors (particularly bad) tend to over reject. In my simulations, robust errors are as good as a coin toss on the rejection rate.

        If you have few clusters, then you can use -boottest CP- to bootstrap the test statistic (ssc install boottest).

        The practitioner world needs JeffW to work his magic to get good SEs with few clusters (like he turned the black box of staggered treatments into OLS)--regress the inverted squares of the residuals multiplied by pi on the price of tea in China or some such voodoo.

        Comment


        • #5
          Thank you for all your valued feedback. As I am new to Stata, I need to do some research to understand every single word of all the above comments. I'll be back after a few days!

          Comment


          • #6
            I had to learn some R for a recent project, so I get it. It's not easy to learn new software, not to mention new techniques.

            Comment


            • #7
              Emmy:
              as an aside to previous excellent advice, I would recommend you to share what you typed and what Stata gave you back via CODE delimiters (as per FAQ). Thanks.
              Kind regards,
              Carlo
              (StataNow 18.5)

              Comment


              • #8
                Thank you experts, thanks to your feedback, I now know that I need to control time fixed effect using i.time and entity fixed effect using fe after xtset. Previously, I didn't know what i.id mentioned in your comments means!

                Comment

                Working...
                X