Announcement

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

  • How to include fixed and random effects in glm

    I have a panel data with two periods and I am using gml (for example gml Y X1 X2, family(binomial) link(logit) vce(cluster ident)) which is equivalent to fracreg to a analyze the data. We want to apply fixed effects and random effects. What option do I need to include in VCE to include fixed effect and random effect ?

    Thank you very much in advance for the help.

  • #2
    I find your statement confusing but guess that you want -meglm- rather than -glm-; see
    Code:
    help meglm

    Comment


    • #3
      Thank you very much for your reply. I am really sorry if my question sound little bit basic. If I want to perform a hausman test of two models: one using fixed effect and another random effect with meglm, how do I need to proceed? For example, if I use xtreg I would run first, xtreg y x, fe and save the estimations. Then I would run xtreg y x, re and save the estimations and finally I would perform a hausman test to see with model is more consistent. How do I proceed with the command meglm if I have a panel data?

      Comment


      • #4
        Josè:
        mixed models include both fixed and random effects: so you do not have to choose between the two (see -meglm- entry in Stata .pdf manual for more details).
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Originally posted by Jose Ferreras View Post
          If I want to perform a hausman test of two models: one using fixed effect and another random effect with meglm, how do I need to proceed?
          If you have binomial outcome data (it's ambiguous from your initial post above whether you have binomial or fractional), then you can use xtlogit. See this old post for a detailed illustration.

          Comment


          • #6
            Hi Carlos,
            I have been reading meglm- entry in Stata .pdf manual and I have a doubt. What test can I perform to ensure that the unobserved individual level effects is uncorrelated with the other covariates? For example in xtreg I can perform a hausman test compering fe and re to see which one is more consistent. However, how should proceed with meglm to test if the regressor Xit is correlated with the individual unobserved effect. As fare as I know, in those cases is recomended to used Fixed effect.

            Comment


            • #7
              Jose:
              the issue is why going -meglm- if you want to compare -fe- vs re- estimators when applied to a panel dataset.
              Can't you go -xtreg-, then?
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment


              • #8
                Our panel data has two different periods and the independent, control and the dependent variables comes from different years. Our dependent variables are restricted by an upper bound (6 is the maximum of sources/collaboration partners), so following a previous study we divide the dependent variables by their upper bound to restrict their values between 0 and 1. Such as transformation makes that fractional logit regression suitable for the analysis. As the command "fracreg" can not be used with panel data, we are using meglm with family (binomial), link(logit) and VCE (cluster ID). Taking into account the characteristics of our dependent variable, can we use xtreg? Or do you know any other command more suitable to use?

                Comment


                • #9
                  Thank you very much in advanced for the help in clarifying this basic doubt.

                  Comment


                  • #10
                    Jose:
                    if the resulting dependent variable is continouos after the procedure you described, you can go -xtreg-.
                    As usual, problems come alive when backtransforing, if this is an issue for your research.
                    Kind regards,
                    Carlo
                    (Stata 19.0)

                    Comment


                    • #11
                      I think this is a problem of terminology. In the mixed literature, a "fixed effect" is a parameter, and a "random effect" means coefficients are treated as random variables. This is not the usual of fixed effects widely used in econometrics. In that case, the heterogeneity is allowed to be correlated with the x(i,t). But there are very few cases where one can include unit-specific dummies to allow such correlation. So called "fixed effects" estimators that put in dummies d1, d2, ..., dN suffer from the incidental parameters problem. The only exceptions are linear models and Poisson regression.

                      I would start with a linear model. But then I would use the correlated random effects approach in Papke and Wooldridge (2008, Journal of Econometrics). Correlated RE is the compromise when you can't legitimately perform a "true" fixed effects analysis.

                      Comment


                      • #12
                        Thank you very much Woolddridge for you repply. I have a doubt of how to apply correlated RE. First, following previous suggestion I used xtreg to compare the estimates of a FE and RE model and then applied a hausman test. I obtained the following output:

                        xtreg breadth_colln c.approp_c##c.approp_c L.breadth_colln int_rd grupo size market_size, fe
                        xtreg breadth_colln c.approp_c##c.approp_c L.breadth_colln int_rd grupo size market_size, re

                        (b) (B) (b-B) sqrt(diag(V_b V_B))
                        fixed random Difference S.E.
                        approp_c . .0135792 .0379498 -.0243706 .0058293
                        approp_c #approp_c .0062616 -.0079134 .014175 .0032628
                        breadth_coll_L1 -0.1506826 .5347544 -.6854371 .0129562
                        int_rd .0000949 .0009559 -.000861 .001132
                        grupo .0059618 .0151441 -.0091823 .0127235
                        size .0166585 .0172908 -.0006323 .0086545
                        market_size 4.77e-06 .0057323 -.0057276 .0057788
                        b = consistent under Ho and Ha; obtained from xtreg
                        B = inconsistent under Ha, efficient under Ho; obtained from xtreg

                        Test: Ho: difference in coefficients not systematic

                        chi2(7) = (b-B)'[(V_b-V_B)^(-1)](b-B)
                        = 2814.56
                        Prob>chi2 = 0.0000

                        Based on these results we can not ignore the correlation betwwen the unobservated term and the independent term and we need to used FE to obtain more consistent estimates. However, if I want to introduce industry dummies in my study, how can I used correlated RE to introduce them in the model?

                        Comment


                        • #13
                          Jose:
                          type -search xthybrid- and take a look at its helpfile.
                          Kind regards,
                          Carlo
                          (Stata 19.0)

                          Comment


                          • #14
                            Jose: You seem to have changed your model to one that includes a lagged dependent variable. Neither fixed effects nor random effects is appropriate in this case. Fixed effects is only consistent has the number of time periods increases, but I think you have few time periods.

                            If you want a model with L.y, you should use the methods of Arellano and Bond, supported by xtabond and xtabond2. But this is when you use a linear model. If you want to use a binary response model, then you can use the correlated random effects approach from my 2005 paper in the Journal of Applied Econometrics. But you need to be careful in how you implement the CRE approach.

                            Comment


                            • #15
                              Thank you very much Carlo and Wooldridge for yours suggestions. I still have a important doubt. If my model include testing a non-linear term, let say the squared term of the X variable. Will it be xtabond suitable for perfoming the analysis?

                              Comment

                              Working...
                              X