Announcement

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

  • Mixed effects Panel Data model

    when to know when to use mixed effects panel data model in stata?

  • #2
    When you have longitudinal data and you want to model the existing heterogeneity between groups (i.e. panels) by allowing for random intercepts and/or random slopes and/or cross-random effects. This is possible when you have a grouping variable, which groups more than one observation. Classicly, mixed effects models are used if you want to study e.g. patients nested within hospitals, students (level 1) nested within classrooms (level 2), etc. Mixed effects models allow you to surmount the ecological fallacy for instance.

    Hope this helps! I know this explanation was quite high level, I would be happy to help you further if you provide a more concrete example.

    Maxence

    Comment


    • #3
      Thank you Maxence Morlet Sir. In my study I have two sectors . manufacturing and services . And firms within these sectors . Plus I have control variables at the country level as GDP/ Capita and real exchange rate. So I can use tis model then. ? Also if you could suggest me any papers to refer to.

      Comment


      • #4
        Also if there are many control variables in the study, can a multi level panel regression take care of it.?

        Comment


        • #5
          Anuradha:
          the issue that suggests to go mixed is the nested design of your study (firms nested within sectors), as Maxence wisely highlighted.
          Controls variables do not play any role in going -mixed-, though (as they are plugged in the fixed portion of the -mixed- model).
          Please also note that you can model a random intercept model via -xtreg, mle-, too:
          Code:
          . use http://www.stata-press.com/data/r16/pig.dta
          (Longitudinal analysis of pig weights)
          
          
          . xtset id week
                 panel variable:  id (strongly balanced)
                  time variable:  week, 1 to 9
                          delta:  1 unit
          
          
          . xtreg weight week, mle
          
          Fitting constant-only model:
          Iteration 0:   log likelihood = -1827.2124
          Iteration 1:   log likelihood = -1827.2118
          
          Fitting full model:
          Iteration 0:   log likelihood = -1014.9757
          Iteration 1:   log likelihood = -1014.9268
          Iteration 2:   log likelihood = -1014.9268
          
          Random-effects ML regression                    Number of obs     =        432
          Group variable: id                              Number of groups  =         48
          
          Random effects u_i ~ Gaussian                   Obs per group:
                                                                        min =          9
                                                                        avg =        9.0
                                                                        max =          9
          
                                                          LR chi2(1)        =    1624.57
          Log likelihood  = -1014.9268                    Prob > chi2       =     0.0000
          
          ------------------------------------------------------------------------------
                weight |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
                  week |   6.209896   .0390124   159.18   0.000     6.133433    6.286359
                 _cons |   19.35561   .5974055    32.40   0.000     18.18472    20.52651
          -------------+----------------------------------------------------------------
              /sigma_u |    3.84935   .4058114                      3.130767    4.732863
              /sigma_e |   2.093625   .0755471                       1.95067    2.247056
                   rho |    .771714   .0393959                      .6876303    .8413114
          ------------------------------------------------------------------------------
          LR test of sigma_u=0: chibar2(01) = 472.65             Prob >= chibar2 = 0.000
          
          . mixed weight week || id:, stddev
          
          Performing EM optimization: 
          
          Performing gradient-based optimization: 
          
          Iteration 0:   log likelihood = -1014.9268  
          Iteration 1:   log likelihood = -1014.9268  
          
          Computing standard errors:
          
          Mixed-effects ML regression                     Number of obs     =        432
          Group variable: id                              Number of groups  =         48
          
                                                          Obs per group:
                                                                        min =          9
                                                                        avg =        9.0
                                                                        max =          9
          
                                                          Wald chi2(1)      =   25337.49
          Log likelihood = -1014.9268                     Prob > chi2       =     0.0000
          
          ------------------------------------------------------------------------------
                weight |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
                  week |   6.209896   .0390124   159.18   0.000     6.133433    6.286359
                 _cons |   19.35561   .5974059    32.40   0.000     18.18472    20.52651
          ------------------------------------------------------------------------------
          
          ------------------------------------------------------------------------------
            Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
          -----------------------------+------------------------------------------------
          id: Identity                 |
                             sd(_cons) |   3.849352   .4058119      3.130769    4.732866
          -----------------------------+------------------------------------------------
                          sd(Residual) |   2.093625   .0755472       1.95067    2.247056
          ------------------------------------------------------------------------------
          LR test vs. linear model: chibar2(01) = 472.65        Prob >= chibar2 = 0.0000
          
          .
          A good starting reference on multilevel models is https://uk.sagepub.com/en-gb/eur/mul...age/book235963, that was pointed out to my attention by Marcos Almeida some years ago (thanks Marcos).

          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            Thank you Carlo Lazzaro . you are so kind to answer my queries. will get back on this if I get stuck.

            Comment


            • #7
              Carlo Lazzaro Thank you for the remark, Carlo. A really interesting book!

              A good starting reference on multilevel models is https://uk.sagepub.com/en-gb/eur/mul...age/book235963, that was pointed out to my attention by Marcos Almeida some years ago (thanks Marcos).
              Best regards,

              Marcos

              Comment

              Working...
              X