Announcement

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

  • How to deal with Unbalanced Panel in STATA???

    Hi all!
    I have a moderately unbalanced panel with n=32 and T=13. When I xtset the data in STATA, it shows that the panel is highly balanced, which is not true.
    When I run OLS and FE,RE tests, STATA excludes 17 countries and only 16 countries are left, the observations are also reduced.
    I want STATA to deal with all 33 countries rather than excluding any. Kindly help me with this, I don't know much about STATA.
    MILLIONS of Thanks in anticipation.
    Regards!

  • #2
    I don't think you'll be able to get much in the way of helpful advice without showing us more detail. To help you out we will need to see exactly what commands you gave and exactly how Stata responded. Please do not do this by posting a screenshot. Also don't try to retype anything. Instead, run your commands, and then paste everything from the Results window into a code block here on the forum. To create a code block, open the advanced editor (click on the underlined A button), then click on the # button. Two code-block delimiters will appear: paste everything from your Results window between them. That will enable everyone to see exactly what happened, and it will be easily readable. My guess is that you will quickly get a helpful response after that.

    Comment


    • #3
      Show us the results of

      Code:
       
      xtset 
      xtdescribe
      Before you reply, please visit the FAQ Advice, especially Section 12 on using CODE delimiters and Section 18 on the name "Stata".

      Comment


      • #4
        Maham:
        some asides on previous authoritative advices:
        -xt- suite in Stata adopts listwise deletion for missing values. Hence, if any variable of country shows missing values, Stata will drop country.
        The only way to make Stata to consider all the countries is to solve the missingness first.
        As often recommended on this list, you may want to take a look at -help ipolate-; however, a tour through -help mi- and related entries in Stata 13.1 .pdf manual would be useful for getting some guidances that can help you out assessing the mechanism that drives the missingness of your data.
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          Code:
           . xtset
                 panel variable:  cc (strongly balanced)
                  time variable:  years, 2000 to 2012
                          delta:  1 unit
            . xtdescribe
                  cc:  1, 2, ..., 32                                     n =         32
             years:  2000, 2001, ..., 2012                             T =         13
                     Delta(years) = 1 unit
                     Span(years)  = 13 periods
                     (cc*years uniquely identifies each observation)
            Distribution of T_i:   min      5%     25%       50%       75%     95%     max
                                  13      13      13        13        13      13      13
                 Freq.  Percent    Cum. |  Pattern
           ---------------------------+---------------
                 32    100.00  100.00 |  1111111111111
           ---------------------------+---------------
                 32    100.00         |  XXXXXXXXXXXXX
          Originally posted by Nick Cox View Post
          Show us the results of

          Code:
          xtset
          xtdescribe
          Before you reply, please visit the FAQ Advice, especially Section 12 on using CODE delimiters and Section 18 on the name "Stata".

          Comment


          • #6

            Originally posted by Clyde Schechter View Post
            I don't think you'll be able to get much in the way of helpful advice without showing us more detail. To help you out we will need to see exactly what commands you gave and exactly how Stata responded. Please do not do this by posting a screenshot. Also don't try to retype anything. Instead, run your commands, and then paste everything from the Results window into a code block here on the forum. To create a code block, open the advanced editor (click on the underlined A button), then click on the # button. Two code-block delimiters will appear: paste everything from your Results window between them. That will enable everyone to see exactly what happened, and it will be easily readable. My guess is that you will quickly get a helpful response after that.
            Code:
             xtset cc years
                   panel variable:  cc (strongly balanced)
                    time variable:  years, 2000 to 2012
                            delta:  1 unit
              . xtreg  hh primaryedu secondaryedu tertiaryedu  educationindex gdppc unemplrate inequality urbanization pbexponedu
              Random-effects GLS regression                   Number of obs      =        51
            Group variable: cc                              Number of groups   =        14
              R-sq:  within  = 0.7964                         Obs per group: min =         1
                   between = 0.1790                                        avg =       3.6
                   overall = 0.0808                                        max =         8
              Random effects u_i ~ Gaussian                   Wald chi2(9)       =    119.51
            corr(u_i, X)       = 0 (assumed)                Prob > chi2        =    0.0000
              ------------------------------------------------------------------------------
                      hh |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
              primaryedu |  -3.759626   1.853806    -2.03   0.043    -7.393019   -.1262333
            secondaryedu |   .5509176   2.492081     0.22   0.825    -4.333471    5.435306
             tertiaryedu |   3.706063   1.393706     2.66   0.008       .97445    6.437675
            educationi~x |  -1171.572   621.6672    -1.88   0.059    -2390.017    46.87365
                   gdppc |  -.0029857   .0019526    -1.53   0.126    -.0068127    .0008412
              unemplrate |  -.1726307   1.974256    -0.09   0.930    -4.042101     3.69684
              inequality |  -8.506763   2.168062    -3.92   0.000    -12.75609    -4.25744
            urbanization |  -6.685247   2.340082    -2.86   0.004    -11.27172   -2.098771
              pbexponedu |   7.760604   6.681281     1.16   0.245    -5.334466    20.85567
                   _cons |   1952.627   403.3294     4.84   0.000     1162.116    2743.138
            -------------+----------------------------------------------------------------
                 sigma_u |  405.09919
                 sigma_e |  26.077674
                     rho |  .99587315   (fraction of variance due to u_i)
            ------------------------------------------------------------------------------

            Comment


            • #7
              Thanks a LOT everyone. With your help and support , I hope I'll land on a solution soon.
              One more thing, as STATA drops 16 countries and runs OLS only on 13 countries. I want to know which countries have been dropped. Is there any way to find out?
              Last edited by Maham Furqan; 18 Dec 2014, 09:05.

              Comment


              • #8
                One more thing, as STATA drops 16 countries and runs OLS only on 13 countries. I want to know which countries have been dropped. Is there any way to find out?
                After the -xtreg- command run -tab cc if e(sample)-. That will give you a list of the countries that are not dropped, and you can figure out which are the others. The problem you are encountering will arise due to missing values on one or more of the regression variables resulting in no observations for the country left to include in the regression.

                Comment


                • #9
                  I think I see the misunderstanding here. To Stata, "strongly balanced" means that there is an observation for each panel and each time.

                  This dataset is strongly balanced:

                  Code:
                  . l
                  
                       +-----------+
                       | i   t   y |
                       |-----------|
                    1. | 1   1   . |
                    2. | 1   2   . |
                    3. | 2   1   . |
                    4. | 2   2   . |
                       +-----------+
                  
                  . xtset i t
                         panel variable:  i (strongly balanced)
                          time variable:  t, 1 to 2
                                  delta:  1 unit
                  Naturally, you can do nothing useful with this dataset as there are missing values for the other variables (here just y).

                  Otherwise put, it is not missing values that imply weak balance; it is omitted observations, namely those that are implied by the cross-combination of identifiers and times but not in the dataset.

                  You have missing values, and so Stata will exclude observations with missing values from any statistical calculations. You have two choices only: to do what you can, or to impute or interpolate values somehow. There is no white magic in either solution.

                  On which countries have been excluded, consider for example

                  Code:
                  xtreg whatever
                  tab cc if !e(sample)


                  Please do read the FAQ Advice and act upon it: the spelling is "Stata".
                  Last edited by Nick Cox; 18 Dec 2014, 09:34.

                  Comment


                  • #10
                    Oh...I get it now. A huge thanks for your help.
                    I'll be in touch. Thanks again. God bless.

                    Comment


                    • #11
                      I am trying to run a fixed-effect panel threshold model but keeps saying my panel is not balanced and the xtset says my panel variables are strongly balanced. i use stata13.

                      Comment


                      • #12
                        Temitope:
                        welcome to the list.
                        As per FAQ, please show us what you typed and what Stata gave you back.
                        There's a sort of conflicting statements in your post: how can you have a panel data that is strongly balanced and not balanced at the same time (provided that you -xtset- you data in the same way in both the instances)?
                        Kind regards,
                        Carlo
                        (StataNow 18.5)

                        Comment

                        Working...
                        X