Announcement

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

  • Panel Data Analysis and Tests/Diagnostics

    Hello everyone,

    I recently started using Stata and already worked through a lot of forum posts, Stata help files, tutorials and youtube videos, however, nowhere I was able to find a properly structured approach to how to handle a complete panel data OLS regression analysis (from start to finish). After finding this forum I hope I receive some valuable advice, and please excuse if I might bother some of you with such (possibly) elementary questions. Thank you very much in advance!!

    This is my current approach - please comment if I miss some important steps or if additional analysis/tests might be relevant

    After generating my sample I start by declaring my dataset to be panel data: xtset

    I do a Hausman Test to choose between a fixed vs random effects model - my result: fe model (p-value < 0.05)
    xtreg var var fixed, fe
    estimates store fixed
    xtreg var var fixed, re
    estimates store random
    hausman fixed random

    Test for time fixed effects - my result: use time fixed effects (p-value < 0.1)
    xtreg var var i.year, fe
    testparm i.year

    Now how do I proceed? Which other tests are relevant before I can run my actual regression?

    Furthermore, how can I include an interaction term in my regression analysis?

    I appreciate all your help! Thank you very much!

  • #2
    I'm stuck on my own research and saw your topic with questions I've asked myself a long time ago.

    To include an interaction term, you could do the following: generate new_varname = var1*var2

    http://essedunet.nsd.uib.no/cms/topi...vel/ch1/6.html

    Comment


    • #3
      What Victoria Rogers suggests will work. But you would probably be better off using Stata's factor variables:

      Code:
      xtreg var1##var2, fe
      //etc.
      instead so that after estimation you can take full advantage of -margins- to look at things in depth.

      Careful: you don't say whether var1 and var2 are discrete or continuous variables. The ## notation assumes they are both discrete. If either is continuous, you must change the notation accordingly. For example c.var1##var2 if var1 is continuous and var2 discrete.

      Comment


      • #4
        berlino (your identifier sounds exactly as the name of a lovely German town translated in Italian. However, as per FAQ, please note the preference for real full names in this forum. You can re-register via the Contact us button at the bottom of the screen page):
        taking advantage from Clyde's smart advice, you may also want to add quadratic terms for one or more of your variables.
        Let's assume, for a toy example, that you are intended to perform a linear panel data analysis with age as the only independent continuous variable:
        Code:
        xtreg depvar c.age##c.age, fe
        // this code will give you back both quadratic and non-quadratic terms as predictors

        Eventually, you may want to consider cluster-robust standard errors instead of default ones:
        Code:
        xtreg depvar indepvar, fe vce(cluster panelidentifier)
        Kind regards,
        Carlo
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          Thank you very much for your replies so far, you are a huge help - and yes I will change my user name, sorry for that...

          Regarding the interaction term
          The beta coefficient of my interaction term (interaction between two dummy variables) will be the focus of my analysis. Does using "xtreg var1##var2, fe" still make sense? Furthermore, I apply a log-log model and obviously encounter some problems with the log of the interaction term which I use in my regression, i.e. Stata output: (omitted). How can I remedy this issue? I am a bit stuck here...

          Fixed effects model
          The Hausman Tests suggests to use a fixed effects model - now I would like to test whether I should add entity and/or time fixed effects. Which procedures would you recommend? And in case I use both, how do I code it in Stata?

          Panel data analysis procedure
          Which other tests/diagnostics are relevant before I can run my actual regression? Maybe you can recommend a tutorial/ressource?

          Kind regards

          Comment


          • #6
            berlino:
            Regarding the interaction term
            -help fvvarlist- will offer you all the Stata capabilities for interactions (or main effects plus interactions) between discrete variables;
            - it is difficult for me to advise further without seeing the Stata output (that you omitted). However, as per FAQ, in order to increase the chance of helpful replies, please report exactly what you typed and what Stata gave you back. Just out of curiosity: do you really need a log-log regression model?
            Fixed effects model
            Code:
            xtreg depvar indepvar1 ...indepvarn i.year i.entity, fe
            // please note: I do not know what you mean by entity.
            Anyway, I would repeat -hausman- after this new specification.
            Panel data analysis procedure
            The first advice on this topic is to start out from -xt- and -xtreg- entries in Stata 13.1 .pdf manual. I also assume that you are already experienced in econometrics and have one of the most recommended textbook on hand.

            Kind regards,
            Carlo
            Kind regards,
            Carlo
            (StataNow 18.5)

            Comment


            • #7
              Carlo thank you very much for your answers.

              Interaction Term
              - the problem with the interaction term (log of interaction term of two dummy variables) - Stata output: variable "omitted because of collinearity" ...
              - log-log regression model: yes I would like to use the model to directly derive elasticity

              Fixed effects model
              - I want to combine time and entity fixed effects (entity fixed effects = control for omitted variables that differ among panels but are constant over time)
              - I use Stata 11 IC and get the error r(103). The number of groups/entities is 3895
              - is there a way to fix that?

              Comment


              • #8
                berlino:
                Interaction Term
                - if predictors are omitted due to collinearity, the usual remedy is to change some independent variable (e.g rule out those causing collinearity) ​
                Fixed effects model
                - I'm not clear about what you mean by
                combine time and entity fixed effects
                and I have nothing to add to my previous reply #6.
                - error r(103) may be due to the fact that the number of groups/entity exceed the limits of your Stata version (please, see http://www.stata.com/products/which-...-right-for-me/).

                Kind regards,
                Carlo
                Kind regards,
                Carlo
                (StataNow 18.5)

                Comment


                • #9
                  Panel Data - Test for Autocorrelation and Heteroscedesticity
                  - I already established that a fixed effects model is appropriate, now I want to proceed with the tests/diagnostics
                  - I use Stata 11 IC, therefore my matsize is limited. Are there some alternatives to test panel data for autocorrelation and heteroscedesticity? "xtgls ... , igls panels(heteroskedastic)" is not working = matsize too small. Is for example the modified Wald test (xttest3) a good alternative?
                  - Also what is a good test for autocorrelation? I tried "xtcsd, pesaren abs", however I receive an error "too many values". An alternative might be the Wooldridge test. What do you think?
                  - Having tested for the above mentioned issues, which other tests are usually done before running the "final" regression?

                  I am not yet very experienced with analyzing panel data (and large samples in Stata), therefore I am very much looking forward to your recommendations and support.

                  Comment

                  Working...
                  X