Announcement

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

  • Error in using lpirf in panel data analysis

    I acquired Stata 18.0 BE with the aim of using the new command 'lpirf' for my panel data analysis. However, I am getting an error "sample may not include multiple panels." Am not sure why. Could you please help. Many thanks in advance.'

  • #2
    This command is listed under multivariate time series commands:

    Menu

    Statistics > Multivariate time series > Local-projection IRFs
    The error you reported is consistent with attempting to use a time-series command on panel data. You can either analyze the panels separately or review your objectives and identify the appropriate panel data command to achieve them.

    Comment


    • #3
      Many thanks Andrew for your quick response. However, the same command seems to work for panel data on Stata 18.0 SC, is it something to do with the Stata version?

      Comment


      • #4
        Originally posted by Hope Chavula View Post
        Many thanks Andrew for your quick response. However, the same command seems to work for panel data on Stata 18.0 SC, is it something to do with the Stata version?
        Testing it, you are correct that it appears to work on panel data. However, the dataset I used is balanced (see below). Did you use xtset to declare your data as a panel? If possible, share a sample of your data that reproduces the issue.

        Code:
        webuse xtcoint, clear
        xtset id time
        lpirf productivity rddomestic
        Res.:

        Code:
        . xtset id time
        
        Panel variable: id (strongly balanced)
         Time variable: time, 1973q3 to 2010q4
                 Delta: 1 quarter
        
        . 
        . lpirf productivity rddomestic
        
        Local-projection impulse–responses
        
        Sample: 1974q1 thru 2009q1                        Number of obs       = 14,100
                                                          Number of impulses  =      2
                                                          Number of responses =      2
                                                          Number of controls  =      2
        
        ------------------------------------------------------------------------------
                     |     IRF   
                     | coefficient  Std. err.      z    P>|z|     [95% conf. interval]
        -------------+----------------------------------------------------------------
        productivity |
        productivity |
                 F1. |   .5972556   .0078891    75.71   0.000     .5817932     .612718
                 F2. |   .7115623   .0092038    77.31   0.000     .6935231    .7296014
                 F3. |   .6404786   .0107876    59.37   0.000     .6193353    .6616218
                 F4. |   .6346332   .0119052    53.31   0.000     .6112993     .657967
                 F5. |   .6027369   .0129061    46.70   0.000     .5774413    .6280325
                 F6. |   .5879871   .0137476    42.77   0.000     .5610424    .6149319
                 F7. |   .5639736   .0144986    38.90   0.000     .5355568    .5923904
                 F8. |   .5463117   .0151555    36.05   0.000     .5166075     .576016
                     |
          rddomestic |
                 F1. |  -.0109031   .0078307    -1.39   0.164    -.0262509    .0044448
                 F2. |  -.0045621   .0110922    -0.41   0.681    -.0263024    .0171781
                 F3. |  -.0062796    .013594    -0.46   0.644    -.0329233    .0203641
                 F4. |  -.0066773   .0157839    -0.42   0.672    -.0376131    .0242586
                 F5. |  -.0016276   .0176637    -0.09   0.927    -.0362478    .0329925
                 F6. |   .0052505   .0194093     0.27   0.787    -.0327912    .0432921
                 F7. |   .0045273   .0210546     0.22   0.830    -.0367389    .0457935
                 F8. |   .0057958   .0225769     0.26   0.797    -.0384541    .0500457
        -------------+----------------------------------------------------------------
        rddomestic   |
        productivity |
                 F1. |   .0434403   .0085276     5.09   0.000     .0267266     .060154
                 F2. |    .031321   .0099487     3.15   0.002      .011822      .05082
                 F3. |   .0362414   .0116606     3.11   0.002      .013387    .0590957
                 F4. |    .043186   .0128687     3.36   0.001     .0179638    .0684082
                 F5. |   .0528011   .0139506     3.78   0.000     .0254585    .0801438
                 F6. |   .0477604   .0148601     3.21   0.001     .0186351    .0768857
                 F7. |   .0473829    .015672     3.02   0.002     .0166664    .0780995
                 F8. |   .0264282    .016382     1.61   0.107    -.0056799    .0585364
                     |
          rddomestic |
                 F1. |   1.005617   .0084644   118.81   0.000     .9890269    1.022207
                 F2. |   1.005613   .0119898    83.87   0.000     .9821135    1.029113
                 F3. |   1.026681   .0146941    69.87   0.000     .9978807     1.05548
                 F4. |   1.017735   .0170612    59.65   0.000     .9842953    1.051174
                 F5. |   1.029924   .0190931    53.94   0.000     .9925019    1.067346
                 F6. |   1.038743   .0209801    49.51   0.000     .9976223    1.079863
                 F7. |    1.03513   .0227585    45.48   0.000     .9905244    1.079736
                 F8. |   1.020095    .024404    41.80   0.000     .9722642    1.067926
        ------------------------------------------------------------------------------
        Impulses:  productivity rddomestic
        Responses: productivity rddomestic
        Controls:  L2.productivity L2.rddomestic

        Comment


        • #5
          Hello Andrew and Hope,

          I cannot reproduce this issue. I looked, and this was a bug before the November 13 update. It should error out in all cases. If the problem persists after updating, please let me know and I will dig deeper.

          P.S: Andrew, thank you for all your contributions on the forum.

          Comment


          • #6
            Thanks Enrique Pinzon (StataCorp) for the explanation and closure. It has been a while since I updated my Stata installation, which explains why the command executes in #4. I have done it now and can confirm that it errors out as it should.

            Code:
            . webuse xtcoint, clear
            (Fictitious cointegration data)
            
            . 
            . xtset id time
            
            Panel variable: id (strongly balanced)
             Time variable: time, 1973q3 to 2010q4
                     Delta: 1 quarter
            
            . 
            . lpirf productivity rddomestic
            sample may not include multiple panels
            r(459);

            Comment

            Working...
            X