Announcement

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

  • grqreg, error r(198) invalid name

    I am trying to use grqreg from SSC (grqreg from http://fmwww.bc.edu/RePEc/bocode/g) and I get the error message 'invalid name r(198). From the grqreg help:
    Code:
    sysuse auto, clear
    
    . xi: qreg price mpg  i.foreign*i.rep78 headroom, nolog
    i.foreign         _Iforeign_0-1       (naturally coded; _Iforeign_0 omitted)
    i.rep78           _Irep78_1-5         (naturally coded; _Irep78_1 omitted)
    i.for~n*i.rep78   _IforXrep_#_#       (coded as above)
    note: _IforXrep_1_2 omitted because of collinearity
    note: _IforXrep_1_5 omitted because of collinearity
    
    Median regression                                   Number of obs =         69
      Raw sum of deviations    65163 (about 5079)
      Min sum of deviations 53809.48                    Pseudo R2     =     0.1742
    
    -------------------------------------------------------------------------------
            price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    --------------+----------------------------------------------------------------
              mpg |    -207.56   73.64451    -2.82   0.007    -354.9223   -60.19768
      _Iforeign_1 |    -419.44   2211.803    -0.19   0.850    -4845.248    4006.368
        _Irep78_2 |     909.88   2319.452     0.39   0.696    -3731.332    5551.092
        _Irep78_3 |     744.72   2144.908     0.35   0.730    -3547.231    5036.671
        _Irep78_4 |     762.56   2306.418     0.33   0.742    -3852.571    5377.691
        _Irep78_5 |    2961.16    2919.27     1.01   0.315    -2880.286    8802.606
    _IforXrep_1_2 |          0  (omitted)
    _IforXrep_1_3 |        520   2857.738     0.18   0.856     -5198.32     6238.32
    _IforXrep_1_4 |    1989.68   2713.246     0.73   0.466    -3439.513    7418.873
    _IforXrep_1_5 |          0  (omitted)
         headroom |     -149.2   468.5678    -0.32   0.751    -1086.802     788.402
            _cons |    8893.88   2738.334     3.25   0.002     3414.487    14373.27
    -------------------------------------------------------------------------------
    . grqreg, cons ci ols olsci
    o._IforXrep_1_2 invalid name
    r(198);
    
    . d,f
    
    Contains data from http://www.stata-press.com/data/r14/auto.dta
      obs:            74                          1978 Automobile Data
     vars:            21                          13 Apr 2014 17:45
     size:         3,848                          (_dta has notes)
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                  storage   display    value
    variable name   type    format     label      variable label
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    make            str18   %-18s                 Make and Model
    price           int     %8.0gc                Price
    mpg             int     %8.0g                 Mileage (mpg)
    rep78           int     %8.0g                 Repair Record 1978
    headroom        float   %6.1f                 Headroom (in.)
    trunk           int     %8.0g                 Trunk space (cu. ft.)
    weight          int     %8.0gc                Weight (lbs.)
    length          int     %8.0g                 Length (in.)
    turn            int     %8.0g                 Turn Circle (ft.)
    displacement    int     %8.0g                 Displacement (cu. in.)
    gear_ratio      float   %6.2f                 Gear Ratio
    foreign         byte    %8.0g      origin     Car type
    _Iforeign_1     byte    %8.0g                 foreign==1
    _Irep78_2       byte    %8.0g                 rep78==2
    _Irep78_3       byte    %8.0g                 rep78==3
    _Irep78_4       byte    %8.0g                 rep78==4
    _Irep78_5       byte    %8.0g                 rep78==5
    _IforXrep_1_2   byte    %8.0g                 foreign==1 & rep78==2
    _IforXrep_1_3   byte    %8.0g                 foreign==1 & rep78==3
    _IforXrep_1_4   byte    %8.0g                 foreign==1 & rep78==4
    _IforXrep_1_5   byte    %8.0g                 foreign==1 & rep78==5
    I have noticed from other posts that there are sometimes problems with grqreg and variable labels but I cannot see any obvious problems.

    I would be grateful for any advice.

    Thank you,
    Martyn

    Stata/IC 14.2, 64bit Windows 10

  • #2
    That program has the setting version 8.2. It won't necessarily support factor variable notation.

    I think you may need to re-rerun qreg and explicitly name all your predictors which are indicators or interactions.

    Conversely, using xi: and factor variable notation together is no longer advised in 14.2 (and some versions back).

    Comment


    • #3
      Problem solved. Thank you. I used the xi: notation because it was in the help menu and the implicit 14.2 factor notation also failed.

      Comment


      • #4
        Hello Nick and Martyn, could you describe how you solved your problem? I get the same error, and even if I rename my varibles, I still have the same error message because of the omitted categories: I include one dummy per district. Some districts are omitted in the regression and therefore will appear as "o.district23" for example and this makes grqreg unable to work.
        Thanks

        Comment

        Working...
        X