Announcement

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

  • Heterogeneity and Variability of variables for selected cases in Panel Data

    Dear All,
    I have a panel data with three waves and i am comparing the mean difference (mean comparison) of consumption and or Income (both are dependent variable and are continuous variables) on sex, rural/urban households (both coded as 0 and 1). I am also comparing the variability of consumption and income (Coefficients of variations of consumption and income). Please, i request you a guidance on the above issue,

    Thank you in Advance!
    .

  • #2
    Joerg Luedicke (StataCorp) Do you have any advice on this issue? Thank you.

    Comment


    • #3
      Yalfal:
      bumping your question and/or trying to reach Stata list contributors does not fix the lack of any useful details that interesetd listers would consider in replying.
      Please read (and act on) the FAQ to post more effectively. Thanks.
      Kind regards,
      Carlo
      (Stata 18.0 SE)

      Comment


      • #4
        Dear Carlo,

        Thank you for suggestion, let me explain in detail with example. I am comparing mean difference of consumption on sex of the household head on panel data,

        ttest food_cons_ann, by(Sex_hh)

        Two-sample t test with equal variances
        ------------------------------------------------------------------------------
        Group | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]
        ---------+--------------------------------------------------------------------
        0 | 7,350 17806.62 194.9903 16716.94 17424.39 18188.86
        1 | 2,367 12187.81 253.1479 12316.11 11691.4 12684.23
        ---------+--------------------------------------------------------------------
        combined | 9,717 16437.92 161.7196 15941.49 16120.91 16754.92
        ---------+--------------------------------------------------------------------
        diff | 5618.809 372.4309 4888.767 6348.851
        ------------------------------------------------------------------------------
        diff = mean(0) - mean(1) t = 15.0869
        Ho: diff = 0 degrees of freedom = 9715

        Ha: diff < 0 Ha: diff != 0 Ha: diff > 0
        Pr(T < t) = 1.0000 Pr(|T| > |t|) = 0.0000 Pr(T > t) = 0.0000

        is it valid to use the t test for panel data??

        Comment


        • #5
          Yalfal:
          no, because -ttest- assumes that the observations are independent (but due to the panel structure of your dataset they aren't).
          You should use the coefficients of the panel data regression and compare them via -test-.
          Kind regards,
          Carlo
          (Stata 18.0 SE)

          Comment


          • #6
            Dear Carlo,
            I have estimated a fixed effect panel regression model (nonfarm income as dependent and continuous, and sex of the household head as independent and dummy variable 0/1) in my data set. And I want to test if the coefficients are significantly different for sex group.

            xtreg nonfarm_income(i.Sex_hh), fe
            test 1.Sex_hh

            is is the correct ways of doing?

            Comment


            • #7
              Yalfal,
              yes it is.
              Please note that brackets are redundant:
              Code:
              . use "https://www.stata-press.com/data/r16/nlswork.dta"
              (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
              
              . xtreg ln_wage i.msp i.year, fe vce(cluster idcode)
              
              Fixed-effects (within) regression               Number of obs     =     28,518
              Group variable: idcode                          Number of groups  =      4,711
              
              R-sq:                                           Obs per group:
                   within  = 0.1060                                         min =          1
                   between = 0.0788                                         avg =        6.1
                   overall = 0.0722                                         max =         15
              
                                                              F(15,4710)        =      69.81
              corr(u_i, Xb)  = 0.0283                         Prob > F          =     0.0000
              
                                           (Std. Err. adjusted for 4,711 clusters in idcode)
              ------------------------------------------------------------------------------
                           |               Robust
                   ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
              -------------+----------------------------------------------------------------
                     1.msp |   .0025304   .0073558     0.34   0.731    -.0118904    .0169512
                           |
                      year |
                       69  |   .0869055   .0104597     8.31   0.000     .0663996    .1074114
                       70  |   .0725606   .0107678     6.74   0.000     .0514506    .0936706
                       71  |   .1240816   .0114248    10.86   0.000     .1016837    .1464796
                       72  |   .1356594   .0124313    10.91   0.000     .1112882    .1600306
                       73  |   .1506002   .0125345    12.01   0.000     .1260268    .1751736
                       75  |    .165097    .012694    13.01   0.000     .1402108    .1899832
                       77  |   .2213591   .0131519    16.83   0.000     .1955752    .2471431
                       78  |   .2570069   .0136809    18.79   0.000      .230186    .2838278
                       80  |    .264297   .0139082    19.00   0.000     .2370305    .2915636
                       82  |    .284492   .0139396    20.41   0.000     .2571638    .3118202
                       83  |   .3089943   .0143706    21.50   0.000     .2808212    .3371674
                       85  |   .3596244   .0140079    25.67   0.000     .3321623    .3870865
                       87  |   .3765222   .0144541    26.05   0.000     .3481855     .404859
                       88  |   .4348184   .0156146    27.85   0.000     .4042064    .4654304
                           |
                     _cons |   1.443117   .0105433   136.88   0.000     1.422447    1.463787
              -------------+----------------------------------------------------------------
                   sigma_u |  .40816356
                   sigma_e |  .30286574
                       rho |  .64491395   (fraction of variance due to u_i)
              ------------------------------------------------------------------------------
              
              . test 1.msp
              
               ( 1)  1.msp = 0
              
                     F(  1,  4710) =    0.12
                          Prob > F =    0.7309
              Kind regards,
              Carlo
              (Stata 18.0 SE)

              Comment


              • #8
                Dear carlo,

                Thank you for the detail example and Here is my result

                . xtreg nonfarm_income i.Sex_hh, fe vce(cluster HHID_Panel)

                Fixed-effects (within) regression Number of obs = 9,717
                Group variable: HHID_Panel Number of groups = 3,239

                R-sq: Obs per group:
                within = 0.0000 min = 3
                between = 0.0000 avg = 3.0
                overall = 0.0000 max = 3

                F(1,3238) = 0.68
                corr(u_i, Xb) = -0.0196 Prob > F = 0.4107

                (Std. Err. adjusted for 3,239 clusters in HHID_Panel)
                ------------------------------------------------------------------------------
                | Robust
                nonfarm_in~e | Coef. Std. Err. t P>|t| [95% Conf. Interval]
                -------------+----------------------------------------------------------------
                1.Sex_hh | -5665.164 6885.619 -0.82 0.411 -19165.78 7835.448
                _cons | 5863.905 1677.294 3.50 0.000 2575.241 9152.569
                -------------+----------------------------------------------------------------
                sigma_u | 108823.74
                sigma_e | 181372.37
                rho | .26470703 (fraction of variance due to u_i)
                ------------------------------------------------------------------------------

                .
                end of do-file

                . test 1.Sex_hh

                ( 1) 1.Sex_hh = 0

                F( 1, 3238) = 0.68
                Prob > F = 0.4107


                Thank you again

                Comment


                • #9
                  Yalfal:
                  as reported in -xtreg- outcome table, -test- highlighgts that, other things being equal, -gender- does not expain variation in the regressand.
                  But I do think that you have more relevant issues with your model:
                  - lack of informative predictors (it is hard to believe that -gender- is the only predictor of the data generating process you're investigating);
                  - as aconsequence of what above, your model is misspecified.
                  The chunks of code in the following toy-example (that elaborated on the previous one) can be tweaked to your code to test whether your model is (as I would bet) misspecified:
                  Code:
                  . use "https://www.stata-press.com/data/r16/nlswork.dta"
                  (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
                  
                  . xtreg ln_wage i.msp i.year, fe vce(cluster idcode)
                  
                  Fixed-effects (within) regression               Number of obs     =     28,518
                  Group variable: idcode                          Number of groups  =      4,711
                  
                  R-sq:                                           Obs per group:
                       within  = 0.1060                                         min =          1
                       between = 0.0788                                         avg =        6.1
                       overall = 0.0722                                         max =         15
                  
                                                                  F(15,4710)        =      69.81
                  corr(u_i, Xb)  = 0.0283                         Prob > F          =     0.0000
                  
                                               (Std. Err. adjusted for 4,711 clusters in idcode)
                  ------------------------------------------------------------------------------
                               |               Robust
                       ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                  -------------+----------------------------------------------------------------
                         1.msp |   .0025304   .0073558     0.34   0.731    -.0118904    .0169512
                               |
                          year |
                           69  |   .0869055   .0104597     8.31   0.000     .0663996    .1074114
                           70  |   .0725606   .0107678     6.74   0.000     .0514506    .0936706
                           71  |   .1240816   .0114248    10.86   0.000     .1016837    .1464796
                           72  |   .1356594   .0124313    10.91   0.000     .1112882    .1600306
                           73  |   .1506002   .0125345    12.01   0.000     .1260268    .1751736
                           75  |    .165097    .012694    13.01   0.000     .1402108    .1899832
                           77  |   .2213591   .0131519    16.83   0.000     .1955752    .2471431
                           78  |   .2570069   .0136809    18.79   0.000      .230186    .2838278
                           80  |    .264297   .0139082    19.00   0.000     .2370305    .2915636
                           82  |    .284492   .0139396    20.41   0.000     .2571638    .3118202
                           83  |   .3089943   .0143706    21.50   0.000     .2808212    .3371674
                           85  |   .3596244   .0140079    25.67   0.000     .3321623    .3870865
                           87  |   .3765222   .0144541    26.05   0.000     .3481855     .404859
                           88  |   .4348184   .0156146    27.85   0.000     .4042064    .4654304
                               |
                         _cons |   1.443117   .0105433   136.88   0.000     1.422447    1.463787
                  -------------+----------------------------------------------------------------
                       sigma_u |  .40816356
                       sigma_e |  .30286574
                           rho |  .64491395   (fraction of variance due to u_i)
                  ------------------------------------------------------------------------------
                  
                  . predict fitted, xb
                  (16 missing values generated)
                  
                  . g sq_fitted=fitted^2
                  (16 missing values generated)
                  
                  . xtreg ln_wage i.msp i.year fitted sq_fitted , fe vce(cluster idcode)
                  note: fitted omitted because of collinearity
                  
                  Fixed-effects (within) regression               Number of obs     =     28,518
                  Group variable: idcode                          Number of groups  =      4,711
                  
                  R-sq:                                           Obs per group:
                       within  = 0.1097                                         min =          1
                       between = 0.0781                                         avg =        6.1
                       overall = 0.0725                                         max =         15
                  
                                                                  F(16,4710)        =      68.97
                  corr(u_i, Xb)  = 0.0213                         Prob > F          =     0.0000
                  
                                               (Std. Err. adjusted for 4,711 clusters in idcode)
                  ------------------------------------------------------------------------------
                               |               Robust
                       ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                  -------------+----------------------------------------------------------------
                         1.msp |   .6518011   .0937206     6.95   0.000     .4680649    .8355374
                               |
                          year |
                           69  |   20.09825   2.903486     6.92   0.000     14.40606    25.79045
                           70  |   16.69646   2.411894     6.92   0.000     11.96802     21.4249
                           71  |   29.05008     4.1968     6.92   0.000     20.82239    37.27777
                           72  |   31.88262   4.606077     6.92   0.000     22.85255    40.91268
                           73  |   35.56855   5.138789     6.92   0.000     25.49412    45.64298
                           75  |   39.17903   5.660572     6.92   0.000     28.08166     50.2764
                           77  |   53.50018   7.730238     6.92   0.000     38.34529    68.65506
                           78  |   62.82777   9.078397     6.92   0.000     45.02986    80.62567
                           80  |   64.75995   9.357575     6.92   0.000     46.41472    83.10517
                           82  |   70.15422   10.13723     6.92   0.000      50.2805    90.02794
                           83  |   76.78349   11.09553     6.92   0.000     55.03106    98.53591
                           85  |   90.77676   13.11868     6.92   0.000     65.05801    116.4955
                           87  |   95.53557   13.80649     6.92   0.000     68.46839    122.6027
                           88  |   112.2912   16.22976     6.92   0.000     80.47332    144.1092
                               |
                        fitted |          0  (omitted)
                     sq_fitted |  -77.39406   11.22923    -6.89   0.000     -99.4086   -55.37952
                         _cons |   162.5849   23.38089     6.95   0.000     116.7474    208.4223
                  -------------+----------------------------------------------------------------
                       sigma_u |  .40811829
                       sigma_e |  .30225362
                           rho |  .64578926   (fraction of variance due to u_i)
                  ------------------------------------------------------------------------------
                  
                  . test sq_fitted
                  
                   ( 1)  sq_fitted = 0
                  
                         F(  1,  4710) =   47.50
                              Prob > F =    0.0000
                  
                  .
                  The -test- outcome proves the model to be misspecified.
                  Kind regards,
                  Carlo
                  (Stata 18.0 SE)

                  Comment


                  • #10
                    Carlo:
                    Households in the study sub-sample exhibited marked heterogeneity in terms of
                    sex, residence, literacy and whether a household had a single member. what i was try to see is
                    the differences in mean incomes (farm income, nonfarm income and total income) by sex, residence, literacy and whether a household had a single member, to confirm the heterogeneity.
                    Last edited by Yalfal Temesgen; 03 Feb 2021, 04:10.

                    Comment


                    • #11
                      Here is my result based on your example
                      . predict fitted, xb

                      . g sq_fitted=fitted^2

                      . xtreg nonfarm_income i.Sex_hh i.Wave fitted sq_fitted, fe vce(cluster HHID_Panel)

                      Fixed-effects (within) regression Number of obs = 9,717
                      Group variable: HHID_Panel Number of groups = 3,239

                      R-sq: Obs per group:
                      within = 0.0009 min = 3
                      between = 0.0000 avg = 3.0
                      overall = 0.0003 max = 3

                      F(5,3238) = 1.11
                      corr(u_i, Xb) = -0.0257 Prob > F = 0.3521

                      (Std. Err. adjusted for 3,239 clusters in HHID_Panel)
                      ------------------------------------------------------------------------------
                      | Robust
                      nonfarm_in~e | Coef. Std. Err. t P>|t| [95% Conf. Interval]
                      -------------+----------------------------------------------------------------
                      1.Sex_hh | 964.7182 8346.265 0.12 0.908 -15399.78 17329.21
                      |
                      Wave |
                      2 | 140.4106 2246.216 0.06 0.950 -4263.738 4544.559
                      3 | 185.2449 7342.39 0.03 0.980 -14210.96 14581.45
                      |
                      fitted | 1.383383 .8698441 1.59 0.112 -.3221172 3.088884
                      sq_fitted | -.0000339 .0000394 -0.86 0.390 -.0001112 .0000434
                      _cons | -269.862 3429.959 -0.08 0.937 -6994.972 6455.248
                      -------------+----------------------------------------------------------------
                      sigma_u | 108879.53
                      sigma_e | 181351.82
                      rho | .26495072 (fraction of variance due to u_i)
                      ------------------------------------------------------------------------------

                      . test sq_fitted

                      ( 1) sq_fitted = 0

                      F( 1, 3238) = 0.74
                      Prob > F = 0.3896

                      is that the -test- outcome proves the model misspecified?

                      Comment


                      • #12
                        Yalfal:
                        no, the opposite holds: your model seems well specified (or, more technically speaking, the functional form of the regressand seems to be correctly specified; see -linktest- entry in Stata .pdf manula for further details).
                        Kind regards,
                        Carlo
                        (Stata 18.0 SE)

                        Comment


                        • #13
                          Carlo
                          thank you very much and I am also comparing the Coefficients of variations of income (total income, nonfarm income and farm income) across percentiles, did you have suggestion, please

                          Comment


                          • #14
                            Yalfal:
                            hwhy not considering a panel data quantile regression instead of looking at CV (that has lost most of its appealing from 2000 on; https://www.routledge.com/Principles.../9781138593145).
                            Kind regards,
                            Carlo
                            (Stata 18.0 SE)

                            Comment

                            Working...
                            X