Announcement

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

  • Unbalanced panel data analysis

    Hi dear all i hope you all fine ...i am undergoing a problem in running analysis on the data ,the description of which is given below.my data in unbalanced panel data as it is evidence from the result of the stata commands like xtset and xt describe. i am confused wether to run SYSTEM GMM or not ...either it is feasible for this type or data or not...i am currently doing my MPhil research thesis i need your help...any reading material which can help me coming out of this problem will be highly appreciated.THANKING EVERYONE IN ANTICIPATION

    xtset countrynum year
    panel variable: countrynum (unbalanced)
    time variable: year, 2001 to 2017
    delta: 1 unit

    . xtdescribe

    countrynum: 1, 2, ..., 102 n = 102
    year: 2001, 2002, ..., 2017 T = 17
    Delta(year) = 1 unit
    Span(year) = 17 periods
    (countrynum*year uniquely identifies each observation)

    Distribution of T_i: min 5% 25% 50% 75% 95% max
    1 17 17 17 17 17 17

    Freq. Percent Cum. | Pattern
    ---------------------------+-------------------
    100 98.04 98.04 | 11111111111111111
    1 0.98 99.02 | ................1
    1 0.98 100.00 | 1111111111111111.
    ---------------------------+-------------------
    102 100.00 | XXXXXXXXXXXXXXXXX
    Thanks & Regards

    Iftikhar Ali

    Stata 12 SE

  • #2
    Iftikhar:
    welocme to this forum.
    Stata can handle both balanced and unbalanced panel datasets with no problem.
    Fpr mopre details, take a lok at -xt- suite-related entries in Stata .pd manual.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      thank you Carlo Lazzaro ...i will study it ...i am new to this forum and to the stata as well ...i am using stata 12.se ... i will need further guidance too
      Thanks & Regards

      Iftikhar Ali

      Stata 12 SE

      Comment


      • #4
        Iftikhar:
        one of main goal of this forum is indeed to offer guidance via many interested listers.
        Just an advice: in orde to increase yourc hances of getting helpful replies, please read and act on the FAQ.
        It's also advisable to make clear in the signature of your post (so there's no need to repeat it in each post) which Stata release you're working with, as there's a constant evolution across subsequent Stata releases in terms of available commands.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          What's striking in the tabulation in #1 is that you have one panel in which all but the last year is present and one panel in which only the last year is present.

          I'll guess that an explanation is a typo in data entry. It could be as minor as data being originally "Pakistan" in 16 observations and "Pakistan " in 1 observation. Look carefully at the results of tabulating identifiers.

          Comment


          • #6
            after running the command of xtabond2 i get the error of "not sorted" although i sorted it before running the commmand of xtabond 2....i am not getting it

            sort country year

            . xtabond2 logeconomic_growth L.logeconomic_growth logaccounts logborrowers logdepositors logbank_branches logatms logdebit_c
            > ards loglife_insurance loginflation logpopulation logunemployement logsecondary_school logtrade, gmm(logeconomic_growth L.
            > logeconomic_growth logaccounts logborrowers logdepositors logbank_branches logatms logdebit_cards loglife_insurance) iv ( l
            > oginflation logpopulation logunemployement logsecondary_school logtrade) twostep robust

            not sorted
            r(5);

            Thanks & Regards

            Iftikhar Ali

            Stata 12 SE

            Comment


            • #7
              after running the below command i got the error of invalid iv please guiide.
              xtabond2 logeconomic_growth laglogeconomic_growth logaccounts logborrowers logatms logdebit_cards logbank_branches loglife_
              > insurance logdepositors, gmm ( logaccounts logborrowers logatms logdebit_cards logbank_branches loglife_insurance logdeposi
              > tors), iv (loginflation logpopulation logunemployement logsecondary_school logtrade) nolevel robust

              invalid 'iv'
              r(198);

              Thanks & Regards

              Iftikhar Ali

              Stata 12 SE

              Comment


              • #8
                Remove the comma from before iv()

                Did you resolve #5 above?

                Comment


                • #9
                  thank you so much Nick Cox and Carlo Lazzaro for being so much considerate.....@Nick Cox i am not getting your point...do you mean that i have made a typing mistake in the data section of the stata in which i have entered only one cross section i.e.country in the 17 years of time periods.?
                  using stata 12.se
                  Thanks & Regards

                  Iftikhar Ali

                  Stata 12 SE

                  Comment


                  • #10
                    Nick Cox respected sir i am getting the following error of no observation when i removed the comma before IV in #7.

                    . xtabond2 logeconomic_growth laglogeconomic_growth logaccounts logborrowers logatms logdebit_cards logbank_branches loglife_
                    > insurance logdepositors, gmm ( logaccounts logborrowers logatms logdebit_cards logbank_branches loglife_insurance logdeposi
                    > tors) iv (loginflation logpopulation logunemployement logsecondary_school logtrade) nolevel robust
                    Favoring speed over space. To switch, type or click on mata: mata set matafavor space, perm.
                    No observations.
                    r(2000);

                    ​​​​​​​using stata 12.se
                    Thanks & Regards

                    Iftikhar Ali

                    Stata 12 SE

                    Comment


                    • #11
                      I don't know that you made a mistake -- perhaps someone else did -- but look again at

                      Code:
                      . xtdescribe
                      
                      countrynum: 1, 2, ..., 102 n = 102
                      year: 2001, 2002, ..., 2017 T = 17
                      Delta(year) = 1 unit
                      Span(year) = 17 periods
                      (countrynum*year uniquely identifies each observation)
                      
                      Distribution of T_i: min 5% 25% 50% 75% 95% max
                      1 17 17 17 17 17 17
                      
                      Freq. Percent Cum. | Pattern
                      ---------------------------+-------------------
                      100 98.04   98.04 | 11111111111111111
                        1   0.98   99.02 | ................1
                        1   0.98 100.00 | 1111111111111111.
                      ---------------------------+-------------------
                      102 100.00 | XXXXXXXXXXXXXXXXX
                      So, 100 panels are fine, but one has 16 years and one has 1 year. My guess is that those two "panels" are really for just one country for which one observation has been entered wrongly.

                      Code:
                      tab country
                      to get the picture.

                      Comment


                      • #12
                        thanks Nick Cox i got your point there was error with one country whose 16 observation over a time period were pasted at one place and one observation was pasted at another place resulting in an error. now learning to move the row...is it possible to move row in stata just like excel spread sheet.
                        using stata 12.se
                        Thanks & Regards

                        Iftikhar Ali

                        Stata 12 SE

                        Comment


                        • #13
                          It won't just be the place. It will be the value. So edit the incorrect value to be correct. Once you have edited all country identifiers -- numeric as well as string -- then

                          Code:
                          xtset 
                          will automatically sort the data. No need for spreadsheet thinking here.

                          Comment


                          • #14
                            ok sir Nick Cox i have done almost some necessary editing in excel sheet and will import data again to stata...i have no words to express my feelings here that how much people are considerate and cooperative...i feel very nice here at this forum...i am learning new things here and look forward to learn more and oneday will help someone who might be struggling the way i am struggling.
                            Thanks & Regards

                            Iftikhar Ali

                            Stata 12 SE

                            Comment


                            • #15
                              hi sir Nick Cox i am getting the below error of not sorting of data before running gmm...can you share with me some expertise how should i sort my data for running difference and system gmm. the error is shown below
                              . xtabond2 lneconomic_growth l.lneconomic_growth lninflation lnpopulation lnunemployement lnsecondary_school lntrade lnacco
                              > unts lnborrowers lnbank_branches lndebit_cards lnlife_insurance lndepositors y*, gmm(l.lneconomic_growth) iv(lninflation ln
                              > population lnunemployement lnsecondary_school lntrade y*) noleveleq nodiffsargan robust small
                              not sorted
                              r(5);


                              . . xtabond2 lneconomic_growth l.lneconomic_growth lninflation lnpopulation lnunemployement lnsecondary_school lntrade lnacco
                              > unts lnborrowers lnbank_branches lndebit_cards lnlife_insurance lndepositors, gmm(l.lneconomic_growth) iv(lninflation lnpop
                              > ulation lnunemployement lnsecondary_school lntrade) noleveleq nodiffsargan robust small
                              not sorted
                              r(5);


                              the description of my data is given below
                              xtdescribe

                              countryid: 1, 2, ..., 100 n = 100
                              year: 2001, 2002, ..., 2017 T = 17
                              Delta(year) = 1 unit
                              Span(year) = 17 periods
                              (countryid*year uniquely identifies each observation)

                              Distribution of T_i: min 5% 25% 50% 75% 95% max
                              17 17 17 17 17 17 17

                              Freq. Percent Cum. | Pattern
                              ---------------------------+-------------------
                              100 100.00 100.00 | 11111111111111111
                              ---------------------------+-------------------
                              100 100.00 | XXXXXXXXXXXXXXXXX

                              further more stata is showing that my data is strongly balanced however there are some missing observation too in my data
                              xtset countryid year
                              panel variable: countryid (strongly balanced)
                              time variable: year, 2001 to 2017
                              delta: 1 unit









                              Thanks & Regards

                              Iftikhar Ali

                              Stata 12 SE

                              Comment

                              Working...
                              X