Announcement

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

  • Panel Data. Fixed and Random effect. Prediction for each panel

    Hello,

    I´m working with panel data for my thesis and it is a small panel data only 17 countries and 15 years. What I´m exactly doing is analyzing the effect that corruption has on gdppercapita. I also use other variables but they are considered as "control variables" . I started with a simple model where I estimated FE and then RE but I cluster the SEs in order to deal with heteroskedasticity and autocorrelation problems (as it was recommmened previously in one of my quesion in the forum) and then to decide which one would be better I used the command "xtoverid". You can see my commands


    . xtreg gdppercapita cpi, fe cluster(country)

    Fixed-effects (within) regression Number of obs = 264

    Group variable: country1 Number of groups = 17

    R-sq: within = 0.1327 Obs per group: min = 14

    between = 0.4349 avg = 15.5

    overall = 0.3896 max = 16

    F(1,16) = 9.22

    corr(u_i, Xb) = 0.1529 Prob > F = 0.0079

    (Std. Err. adjusted for 17 clusters in country)

    Robust

    gdppercapita Coef. Std. Err. t P>t [95% Conf. Interval]

    cpi 179.3757 59.06557 3.04 0.008 54.16224 304.5891

    _cons 3996.204 2172.897 1.84 0.085 -610.1317 8602.54

    sigma_u 3507.3843

    sigma_e 1664.3803

    rho .81620361 (fraction of variance due to u_i)

    . estimates store fixed

    . xtreg gdppercapita cpi, re cluster(country)

    Random-effects GLS regression Number of obs = 264

    Group variable: country1 Number of groups = 17

    R-sq: Obs per group:

    within = 0.1327 min = 14

    between = 0.4349 avg = 15.5

    overall = 0.3896 max = 16
    Wald chi2(1) = 16.28

    corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0001

    (Std. Err. adjusted for 17 clusters in country)

    ------------------------------------------------------------------------------

    | Robust

    gdppercapita | Coef. Std. Err. z P>|z| [95% Conf. Interval]

    -------------+----------------------------------------------------------------

    cpi | 186.4174 46.20276 4.03 0.000 95.86163 276.9731

    _cons | 3706.284 1861.555 1.99 0.046 57.70428 7354.864

    -------------+----------------------------------------------------------------

    sigma_u | 3548.098

    sigma_e | 1664.3803

    rho | .81964107 (fraction of variance due to u_i)

    ------------------------------------------------------------------------------

    . estimates store random

    . xtoverid

    Test of overidentifying restrictions: fixed vs random effects

    Cross-section time-series model: xtreg re robust cluster(country)

    Sargan-Hansen statistic 0.277 Chi-sq(1) P-value = 0.5984


    So, "RE" would be better.

    But now what I want to do is to see is the effect of corruption on GDPpc for each panel or country that are 17. Thus to get it I considered the command :
    regress gdppercapita cpi i.country1, robust and my result was:

    . regress gdppercapita cpi i.country1, robust

    Linear regression Number of obs = 264
    F(17, 246) = 304.54
    Prob > F = 0.0000
    R-squared = 0.8871
    Root MSE = 1664.4

    ---------------------------------------------------------------------------------
    | Robust
    gdppercapita | Coef. Std. Err. t P>|t| [95% Conf. Interval]
    ----------------+----------------------------------------------------------------
    cpi | 179.3757 28.66853 6.26 0.000 122.9086 235.8428
    |
    country1 |
    Bolivia | -11210.48 573.2138 -19.56 0.000 -12339.51 -10081.45
    Brazil | -4950.039 715.173 -6.92 0.000 -6358.682 -3541.395
    Chile | -5945.007 1482.088 -4.01 0.000 -8864.208 -3025.806
    Colombia | -7667.335 730.9905 -10.49 0.000 -9107.133 -6227.536
    Costa Rica | -8053.332 839.9772 -9.59 0.000 -9707.797 -6398.867
    Dominican Rep. | -6624.862 731.7051 -9.05 0.000 -8066.068 -5183.656
    Ecuador | -6946.394 603.4958 -11.51 0.000 -8135.072 -5757.716
    El Salvador | -11079.91 634.8929 -17.45 0.000 -12330.43 -9829.387
    Guatemala | -9865.383 580.6589 -16.99 0.000 -11009.08 -8721.686
    Honduras | -12210.32 580.5106 -21.03 0.000 -13353.73 -11066.92
    Mexico | -1950.287 622.7526 -3.13 0.002 -3176.895 -723.6802
    Nicaragua | -12037.28 579.9553 -20.76 0.000 -13179.59 -10894.97
    Panama | -2904.92 1025.237 -2.83 0.005 -4924.282 -885.5568
    Paraguay | -8425.054 634.557 -13.28 0.000 -9674.912 -7175.196
    Peru | -9102.088 778.4872 -11.69 0.000 -10635.44 -7568.738
    Uruguay | -7608.453 1186.654 -6.41 0.000 -9945.751 -5271.155
    |
    _cons | 11409.83 1018.999 11.20 0.000 9402.753 13416.91
    ---------------------------------------------------------------------------------


    Therefore, my specific question is whether the command used to analyze the effect for each panel is correct ? Also because in the first time when I perform the xtoverid test to decides FE or RE, the result was RE and the corruption´s coefficient has "positive"sign in RE model but then when I perform for each panel, each panel coefficient is "negative".

    Thanks in advance.
    Elizabeth.

  • #2
    Elizabeth:
    - you should cluster on -country- the standard errors in -regress-, as your variable are not independent, due to their panel structure.
    Pease also note that, unlike -xtreg-, -robust- and -cluster- option do different jobs under -regress- (-robust- accounts for heteroskedasticity; -cluster- accounts for autocorrelation);
    - see the results of -predict- after -regress- and check whether they are positive or not;
    - for the future, please use CODE delimiters to share what you typed and what Stata gave you back. Thanks.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Thank you so much for your help Carlo.

      1) Regarding your first advice, cluster on -country-the standard error in -regress, that mean that instead of :
      regress gdppercapita cpi i.country1, robust
      I will have to write now
      regress gdppercapita cpi i.country1, robust cluster (country) ?

      2)I was using the option "predict" after my estimation and the command written is:
      predict gdppercapita_predict,xb
      scatter gdppercapita_predict cpi

      3) You can see again my result:
      Code:
      . regress gdppercapita cpi i.country1, robust cluster (country)
      
      Linear regression                               Number of obs     =        264
                                                      F(0, 16)          =          .
                                                      Prob > F          =          .
                                                      R-squared         =     0.8871
                                                      Root MSE          =     1664.4
      
                                        (Std. Err. adjusted for 17 clusters in country)
      ---------------------------------------------------------------------------------
                      |               Robust
         gdppercapita |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      ----------------+----------------------------------------------------------------
                  cpi |   179.3757   60.95615     2.94   0.010      50.1544    308.5969
                      |
             country1 |
             Bolivia  |  -11210.48   156.2001   -71.77   0.000    -11541.61   -10879.35
              Brazil  |  -4950.039   491.4589   -10.07   0.000    -5991.885   -3908.192
               Chile  |  -5945.007   2544.919    -2.34   0.033    -11339.99   -550.0195
            Colombia  |  -7667.335   388.5954   -19.73   0.000     -8491.12   -6843.549
         Costa Rica   |  -8053.332   1158.167    -6.95   0.000    -10508.54   -5598.128
      Dominican Rep.  |  -6624.862    9.65139  -686.42   0.000    -6645.322   -6604.402
             Ecuador  |  -6946.394   278.1124   -24.98   0.000    -7535.966   -6356.822
        El Salvador   |  -11079.91   468.6004   -23.64   0.000     -12073.3   -10086.52
           Guatemala  |  -9865.383   124.4521   -79.27   0.000    -10129.21   -9601.556
            Honduras  |  -12210.32   262.6194   -46.49   0.000    -12767.05   -11653.59
              Mexico  |  -1950.287   228.5855    -8.53   0.000    -2434.867   -1465.708
           Nicaragua  |  -12037.28   258.5557   -46.56   0.000     -12585.4   -11489.17
              Panama  |   -2904.92   269.7309   -10.77   0.000    -3476.724   -2333.116
            Paraguay  |  -8425.054   493.0917   -17.09   0.000    -9470.362   -7379.746
                Peru  |  -9102.088   403.8345   -22.54   0.000    -9958.179   -8245.997
             Uruguay  |  -7608.453   2106.543    -3.61   0.002    -12074.12   -3142.782
                      |
                _cons |   11409.83   1851.543     6.16   0.000     7484.734    15334.92
      ---------------------------------------------------------------------------------
      And then after that, the postestimation option "predict"
      Code:
      . predict gdppercapita_predict2, xb
      (8 missing values generated)
      
      . scatter gdppercapita_predict2 cpi
      So, with the "predict" option when I explore again my data I can see that I get the linear prediction from the fitted model but to conclude whether there is a positive or negative effect of corruption on gdppercapita for each country or panel I usually see or I interpret the sign of my coeeficient that I get in my regression that is he first estimation posted with the comman: regress gdppercapit cpi i.country, robust cluster(country). Is it right?

      4) I´m trying to use the CODE delimiters to share my results, I do not if now is right how is show my result.

      Thank you Carlo,
      Elizabeth.

      Comment


      • #4
        Elizabeth:
        1) your code should be (-robust- in redundant):
        Code:
        regress gdppercapita cpi i.country1,  cluster (country)
        2) and 3) If I get your results right, the -_cons- of your regression represent the omitted country (as Stata omits one of the level of each categorical variable to avoid dummy trap) when -cpi- is 0.
        Hence the predicted value for, say, Uruguay should be (what follows is a sort of -predict- by hand):
        Code:
        (11409.83-7608.453) + (cpi*<thevalueofcpireportedforUruguay>)
        That's the way I would follow to study the sign of coefficients.

        4) The way you used CODE delimiters is laudable.
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment

        Working...
        X