Announcement

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

  • Heteroscedasticity with xtreg command

    Hello,

    I'm working with a strongly balanced panel data (210 countries) and timeframe (1985-2020)

    I've used this regression command (country and time fixed effects)

    Code:
    xtreg patrat rndd rinterest exports bureaucracy i.year, fe
    I'm aware that this estat hettest only works with reg command, but I've looked what's working in my case I did found xttest2 or xttest3 but both read 'command unrecognised'

    My supervisor told me that if heteroscedasticity is present, I need to use robust standard errors although he mentioned that these are usually biased estimates. He also mentioned that I need to focus more on testing whether there's autocorrelation or not.

    Any assistance is appreciated.

    Thanks


    Edit: I just found that I needed to install xttest3 package, I managed to get a heterescedasciticy test (Modified Wald test for groupwise heteroskedasticity).

    My following question why time variable have been omitted in my regression.

    Using this command
    Code:
    xtreg patrat rndd rinterest exports bureaucracy i.year, fe


    Code:
    Fixed-effects (within) regression Number of obs = 394
    Group variable: year Number of groups = 22
    
    R-squared: Obs per group:
    Within = 0.5289 min = 13
    Between = 0.3641 avg = 17.9
    Overall = 0.5033 max = 22
    
    F(4, 368) = 103.30
    corr(u_i, Xb) = -0.1273 Prob > F = 0.0000
    
    ------------------------------------------------------------------------------
    patrat | Coefficient Std. err. t P>|t| [95% conf. interval]
    -------------+----------------------------------------------------------------
    lagrnd | 5552.63 768.8641 7.22 0.000 4040.711 7064.548
    rinterest | 92.78694 165.1105 0.56 0.574 -231.8915 417.4654
    exports | 2.13e-08 1.47e-09 14.52 0.000 1.84e-08 2.42e-08
    bureaucracy | -3020.346 947.269 -3.19 0.002 -4883.085 -1157.607
    |
    year |
    1998 | 0 (omitted)
    2000 | 0 (omitted)
    2002 | 0 (omitted)
    2003 | 0 (omitted)
    2004 | 0 (omitted)
    2005 | 0 (omitted)
    2006 | 0 (omitted)
    2007 | 0 (omitted)
    2008 | 0 (omitted)
    2009 | 0 (omitted)
    2010 | 0 (omitted)
    2011 | 0 (omitted)
    2012 | 0 (omitted)
    2013 | 0 (omitted)
    2014 | 0 (omitted)
    2015 | 0 (omitted)
    2016 | 0 (omitted)
    2017 | 0 (omitted)
    2018 | 0 (omitted)
    2019 | 0 (omitted)
    2020 | 0 (omitted)
    |
    _cons | -6808.972 1251.709 -5.44 0.000 -9270.372 -4347.572
    -------------+----------------------------------------------------------------
    sigma_u | 3001.7472
    sigma_e | 11523.812
    rho | .06353971 (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    F test that all u_i=0: F(21, 368) = 1.06 Prob > F = 0.3953

    I also managed to make the xtserial work but do I need to put all variables I'm using in myregression after xtserial y x x1 etc. or what exactly.

    If I found having both heteroscedasticty and autocorrelation

    Does this command fixes both?

    Code:
    xtreg patrat lagrnd rinterest exports bureaucracy i.year, fe vce (robust)
    Last edited by Anass Wajib; 08 Apr 2024, 05:49.

  • #2
    Anass:
    if you have heteroskedasticity and/or autocorrelation, you can go -robust- or -vce(cluster panelid)- that do the very same job under -xtreg-.
    However, in your case 22 panels are below the arbitrary (at least) 30 ones that are recoemmended for reliable non-default standard errors.
    Perhaps you may want to calculate your regression with and without cluster-robust standard errors and assess the difference.
    Probably, your supervisor meant that default standard errors are biased if you have at least one of the aforementioned nuisances.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Carlo Lazzaro I appreciate your swift and detailed response as usual. How do you reckon to get my dataset to the recommended 30 mark?

      Comment


      • #4
        Anass:
        it's a matter of the number of panels included in your dataset; hence, there's nothing you can do to increase N, but have more panels.
        Your previous post showed
        Code:
         
         Group variable: year Number of groups = 22
        that is, N=22

        On a second tought, you have a N=T panel dataset (N=22; T=22).
        Therefore, you are at the limit with -xtreg-, that was conceived for N>T datasets.
        For more on clustering standard errors, see Cameron_Miller_Cluster_Robust_October152013.pdf (ucdavis.edu)
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          Carlo Lazzaro Thank you immensely for the pertinent insights. One last question, is there a command suitable for my case (N=T) or should I increase my N or maybe decrease my T?

          Comment


          • #6
            Anass:
            you may want to explore T>N Stata commands, such as -xtregar- and -xtgls-.
            That said, as far as I know, the most robust literature zooms in on N>T panel datasets.
            Kind regards,
            Carlo
            (StataNow 18.5)

            Comment


            • #7
              Carlo Lazzaro Can't thank you enough. Thank you for your valuable input.

              Comment

              Working...
              X