Announcement

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

  • coefplot - could not determine 'at'

    Dear all,

    I am using coefplot to plot regression coefficients and I get the following error message "could not determine 'at'".

    I tried different ways to rename the coefficients such that they are all numerical (including: rename(*.i_score = *), rename(*.i_score = +*), or rename(*.i_score *)), but always get into the same issue. Any idea? How should I specify rename such that the coefficients are 1 instead of 1.i_score, 2 instead of 2.i_score, 3 instead of 3.i_score, etc ... Thank you !

    Here is my code:

    eststo dif: reg dif i.i_score, nocons

    coefplot dif, vertical rename(*.i_score = +) at(_coef) recast(line) lw(medthick) fcolor(*.5) ciopts(recast(rarea) fcolor(gs13) lc(gs13)) ///
    name(types1, replace) ci(99) yline(0) ytitle(dif) ///
    saving("$gph/dif", replace)
    eststo dif: reg dif i.i_score, nocons

    Here is the regression output

    . eststo dif: reg dif i.i_score, nocons coeflegend

    Source | SS df MS Number of obs = 205740176
    -------------+---------------------------------- F(98,205740078) > 99999.00
    Model | 39178662.9 98 399782.275 Prob > F = 0.0000
    Residual | 259249300 205740078 1.26008167 R-squared = 0.1313
    -------------+---------------------------------- Adj R-squared = 0.1313
    Total | 298427963 205740176 1.45050893 Root MSE = 1.1225

    ------------------------------------------------------------------------------
    dif | Coef. Legend
    -------------+----------------------------------------------------------------
    i_score |
    1 | .6851037 _b[1.i_score]
    2 | .6833043 _b[2.i_score]
    3 | .6816613 _b[3.i_score]
    4 | .677095 _b[4.i_score]
    5 | .6713571 _b[5.i_score]
    6 | .6641796 _b[6.i_score]
    7 | .6576174 _b[7.i_score]
    8 | .6490226 _b[8.i_score]
    9 | .640686 _b[9.i_score]
    10 | .6322079 _b[10.i_score]
    11 | .6236787 _b[11.i_score]
    12 | .6124259 _b[12.i_score]
    13 | .6022233 _b[13.i_score]
    14 | .5842316 _b[14.i_score]
    15 | .5643985 _b[15.i_score]
    16 | .5427588 _b[16.i_score]
    17 | .517291 _b[17.i_score]
    18 | .4952616 _b[18.i_score]
    19 | .4673092 _b[19.i_score]
    20 | .4492153 _b[20.i_score]
    21 | .4330801 _b[21.i_score]
    22 | .4216907 _b[22.i_score]
    23 | .4175002 _b[23.i_score]
    24 | .4136383 _b[24.i_score]
    25 | .41196 _b[25.i_score]
    26 | .4102114 _b[26.i_score]
    27 | .412311 _b[27.i_score]
    28 | .4106646 _b[28.i_score]
    29 | .4206287 _b[29.i_score]
    30 | .4234877 _b[30.i_score]
    31 | .4218849 _b[31.i_score]
    32 | .4413928 _b[32.i_score]
    33 | .4414671 _b[33.i_score]
    34 | .4497111 _b[34.i_score]
    35 | .4456577 _b[35.i_score]
    36 | .4523487 _b[36.i_score]
    37 | .4531262 _b[37.i_score]
    38 | .462381 _b[38.i_score]
    39 | .4623675 _b[39.i_score]
    40 | .4573392 _b[40.i_score]
    41 | .459336 _b[41.i_score]
    42 | .4659935 _b[42.i_score]
    43 | .4195283 _b[43.i_score]
    44 | .3923646 _b[44.i_score]
    45 | .4264785 _b[45.i_score]
    46 | .4275668 _b[46.i_score]
    47 | .4080053 _b[47.i_score]
    48 | .4006168 _b[48.i_score]
    49 | .3709248 _b[49.i_score]
    50 | .3468533 _b[50.i_score]
    51 | .4031322 _b[51.i_score]
    52 | .3833175 _b[52.i_score]
    53 | .4158226 _b[53.i_score]
    54 | .4302679 _b[54.i_score]
    55 | .4415432 _b[55.i_score]
    56 | .3926407 _b[56.i_score]
    57 | .5021992 _b[57.i_score]
    58 | .4311643 _b[58.i_score]
    59 | .4031733 _b[59.i_score]
    60 | .4494401 _b[60.i_score]
    61 | .3291483 _b[61.i_score]
    62 | .4441135 _b[62.i_score]
    63 | .3602386 _b[63.i_score]
    64 | .3649273 _b[64.i_score]
    65 | .3962161 _b[65.i_score]
    66 | .2496927 _b[66.i_score]
    67 | .3107658 _b[67.i_score]
    68 | .3194901 _b[68.i_score]
    69 | .3998589 _b[69.i_score]
    70 | .4920086 _b[70.i_score]
    71 | .4591911 _b[71.i_score]
    72 | .3208622 _b[72.i_score]
    73 | .6793398 _b[73.i_score]
    74 | .4321105 _b[74.i_score]
    75 | .5703114 _b[75.i_score]
    76 | .7827121 _b[76.i_score]
    77 | .3548735 _b[77.i_score]
    78 | .66047 _b[78.i_score]
    79 | .3806015 _b[79.i_score]
    80 | .2741243 _b[80.i_score]
    81 | .54312 _b[81.i_score]
    82 | .3517393 _b[82.i_score]
    83 | .4801462 _b[83.i_score]
    84 | .6171365 _b[84.i_score]
    85 | .6341682 _b[85.i_score]
    86 | .3996906 _b[86.i_score]
    87 | .3304702 _b[87.i_score]
    88 | .659016 _b[88.i_score]
    89 | .9236546 _b[89.i_score]
    90 | .4785199 _b[90.i_score]
    91 | .4749859 _b[91.i_score]
    92 | .3837018 _b[92.i_score]
    93 | .5115956 _b[93.i_score]
    94 | .510676 _b[94.i_score]
    95 | .5101774 _b[95.i_score]
    96 | 2.133209 _b[96.i_score]
    97 | .2255941 _b[97.i_score]
    98 | 1.277836 _b[98.i_score]
    ------------------------------------------------------------------------------
    r; t=101.93 18:41:05

    . coefplot dif, vertical keep(*.i_score) rename(*.i_score=+) at(_coef) recast(line) lw(medthick) fcolor(*.5) c
    > iopts(recast(rarea) fcolor(gs13) lc(gs13)) ///
    > name(types1, replace) ci(99) yline(0) ytitle(TITLE) ///
    > saving("$gph/dif", replace)
    (dif: could not determine 'at')

  • #2
    Here is a basic coefplot command using at(_coef) that works:
    Code:
    sysuse auto, clear
    eststo mpg: reg mpg i.foreign, nocons
    #delimit ;
        coefplot mpg,
                vertical
                rename(*.foreign = "") at(_coef)
                lw(medthick) fcolor(*.5) fcolor(gs13) lc(gs13)
                ;
    #delimit cr
    Added: for the benefit of other readers, coefplot is a community-contributed command that can be installed using
    Code:
    ssc install coefplot
    Last edited by Hemanshu Kumar; 26 Aug 2022, 23:54.

    Comment


    • #3
      Great ! That's exactly what I was looking for .Thank you so much!

      Comment

      Working...
      X