Announcement

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

  • time-series operators not allowed (error in panel)

    Hello everybody,
    I have a panel data with this structure:
    (using dataex)

    input int Year str3 Country double(pop rgdpmad rgdppc rconpc gdp iy) float(tas pr tas_sd pr_sd Country_id d_gdp d_rgdppc d_rconpc l_d_gdp l_d_rgdppc l_d_rconpc)

    I set

    Code:
    tsset Country_id Year
    and I am trying to run a quantile regression on a given country in a given subsample

    Code:
    qreg d_rgdppc l_d_rgdppc pr pr_sd tas tas_sd d.pr d.pr_sd d.tas d.tas_sd if Country_id == 24 & (Year >= 1954 & Year <= 2013), quantile(0.10)
    Unfortunately, I get this error:

    Code:
    time-series operators not allowed
    r(101);
    
    end of do-file
    Could you explain please where I am wrong?
    Thank you for your support.
    Mike

  • #2
    qreg just doesn't support such operators. So, you need to create the variables yourself.

    Silly example:

    Code:
    . webuse grunfeld
    
    . tsset
           panel variable:  company (strongly balanced)
            time variable:  year, 1935 to 1954
                    delta:  1 year
    
    . qreg mvalue d.invest
    time-series operators not allowed
    r(101);
    
    . gen D_invest = d.invest
    (10 missing values generated)
    
    . qreg mvalue D_invest
    Iteration  1:  WLS sum of weighted deviations =  81352.169
    
    Iteration  1: sum of abs. weighted deviations =  81134.392
    Iteration  2: sum of abs. weighted deviations =  75891.695
    Iteration  3: sum of abs. weighted deviations =  74947.817
    
    Median regression                                   Number of obs =        190
      Raw sum of deviations 82722.75 (about 537.09998)
      Min sum of deviations 74947.82                    Pseudo R2     =     0.0940
    
    ------------------------------------------------------------------------------
          mvalue |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
        D_invest |   12.89556   .9146846    14.10   0.000      11.0912    14.69993
           _cons |   469.7206   51.64345     9.10   0.000     367.8455    571.5957
    ------------------------------------------------------------------------------

    Comment


    • #3
      Thank you very much for your help.

      Comment


      • #4
        Nick Cox do we need to generate the independent variables and control variables(in the model) in the same manner ?
        I am facing a similar issue

        Comment


        • #5
          If you have the same problem, then it's the same solution. As of Stata 17.0 time-series operators are not supported by qreg.

          Comment


          • #6
            Thanks Nick Cox

            Comment

            Working...
            X