Announcement

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

  • Help in understanding error "sample may not include multiple panels" for panel data

    Hi,

    I am currently working on my dissertation with a set of panel data and i want to test my data for autocorrelation. However i keep encountering the error "sample may not include multiple panels" when i try to run a ben godfrey test for autocorrelation. Below is an example of my data set :

    Year Bank GNPA NNPA PSLNPA ANPA INPA SNPA PLNPA Mcap CAR BankID
    2022 Canara Bank 55652 18668 25515 9879 14253 1383 .001 41316.817 14.9 3
    2021 Canara Bank 60288 24442 27225 9467 14929 2829 .001 25063.356 13.18 3
    2020 Canara Bank 37041.15 18250.95 15521.48 6002.14 9011.28 508.06 .001 6816.8652 13.65 3
    2019 Canara Bank 39224.12 22955.11 13678.9 4947.72 8198.82 532.36 .001 21942.02 11.9 3
    2018 Canara Bank 47468.47 28542.4 12597.14 3850.8 8129.36 616.98 .001 19350.33 13.22 3
    2017 Canara Bank 34202.04 21648.98 8870.41 2757.31 5557.95 555.15 .001 18082.96 12.86 3
    2016 Canara Bank 31637.83 20832.91 7410.68 2159.3 4663.07 588.31 .001 10319.545 11.08 3
    2015 Canara Bank 13039.96 8740.09 4837.55 1410.31 3047.58 379.66 .001 17477.745 10.56 3
    2014 Canara Bank 7570.21 5965.46 2956.22 978.54 1727.45 250.23 .001 12193.377 10.63 3
    2022 State Bank of India 112023.37 27965.71 53262.03 30281.87 10832.34 9989.11 2158.71 440474.2 13.83 12
    2021 State Bank of India 126389.02 36809.72 56150.79 32392.47 11206.95 10198.53 2352.84 325123.6 13.74 12
    2020 State Bank of India 149091.85 51871.3 59717.53 32558.27 18738.88 5289.2 3131.18 175680.98 13.06 12
    2019 State Bank of India 172750.36 65894.74 48437.93 23335.83 12545.61 9674.48 2882.01 286256.91 12.72 12
    2018 State Bank of India 223427.46 110854.7 47657.6 20964.77 16020.84 7339.66 3332.33 223025.44 12.6 12
    2017 State Bank of India 112342.99 58277.38 22241.82 7354.64 11536.03 2378.55 972.6 233942.62 13.11 12
    2016 State Bank of India 98172.8 55807.02 24222.56 9839.11 11602.3 1747.36 1033.79 150791.94 13.12 12
    2015 State Bank of India 56725.34 27590.58 20206.32 10216.74 7087.13 1699.94 1202.51 199372.34 12 12
    2014 State Bank of India 61605.35 31096.07 18585.11 10327.11 4174.09 2424.62 1659.29 143170.32 12.44 12


    I sorted my data by creating a BankID column with the following command:

    egen BankID = group(Bank)

    I then used the command xtset BankID Year which gives me the below solution:

    Panel variable: BankID (strongly balanced)
    Time variable: Year, 2014 to 2022
    Delta: 1 year

    I want to test for autocorrelation by using the Breusch-Godfrey test but whatever I try I keep getting the error 'sample may not include multiple panels'. The commands I use are:
    regress ANPA GNPA Mcap CAR
    bgodfrey
    (and then I receive the error 'sample may not include multiple panels')

    Can someone help explain how to fix this error?

  • #2
    -bgodfrey- has, in modern Stata, been replaced by -estat bgodfrey-. Although I am not familiar with this command (in either of its instantiations), by examining the help file I can see that it clearly states that it is designed to be used only with time series data, not with panel data. That said, if it is meaningful to do this separately for each BankID (and I have no idea whether it is or not), then you can do it as follows. (I illustrate the code using the grunfeld.dta, as no example data was provided. It should be simple to adapt the code to your data and variables.)
    Code:
    webuse grunfeld, clear
    
    capture program drop one_bgodfrey
    program define one_bgodfrey
        tsset year
        regress mvalue kstock
        estat bgodfrey
        gen chi2 = r(chi2)[1,1]
        gen df = r(df)[1,1]
        gen p = r(p)[1,1]
        exit
    end
    
    runby one_bgodfrey, by(company)
    -runby- is written by Robert Picard and me, and is available from SSC.

    Comment


    • #3
      Saksham:
      welcome to this forum.
      As an aside to Clyde's helpful reply, you may want to take a look at the community-contributed module -xtserial-.
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        HI Friend
        what about creating years to be dummies
        that is tdum_2014 .......................... then use the model like Hausman-Taylor
        (xthtaylor) which account for the issue of endogeneity and time variant and invariant

        Comment


        • #5
          HI Saksham Gugnani
          what about creating years to be dummies
          that is tdum_2014 .......................... then use the model like Hausman-Taylor
          (xthtaylor) which account for the issue of endogeneity and time variant and invariant

          Comment

          Working...
          X