Announcement

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

  • Coefplot labels order

    Hello to everyone!

    I'm having some troubles with coefplot and label option.

    I want to plot the regression results from:

    reghdfe smart_shr ib6.time##c.std_exc if time < 11 & tot_hire_imp < 8, absorb(id_impresa contr time ) vce(robust)

    when I use this code the order of coefficients is correct and the 6th period (the baseline) is plotted in the righ position

    *****GRAPH 1*****
    coefplot, baselevel drop(_cons) vertical yline(0)lwidth(medium) nolabels rename(*.time#c.std_exc= sem *time=sem) levels(95 99) bgcolor(white) ciopts(recast(rcap rspike) lwidth( medium ) fintensity(inten30) color(%50)) order(1sem 2sem 3sem 4sem 5sem 6.sem 7sem 8sem 9sem 10sem) xline(6, lpattern(dash))

    If I try to change the labels on the x axis however the 6th period is plotted in the wrong place

    *****GRAPH 2*****
    coefplot, baselevel drop(_cons std_exc ) vertical yline(0) lwidth(medium) nolabels rename(*.time#c.std_exc = sem *time = sem) levels(95 99) bgcolor(white) ciopts(recast(rcap rspike) lwidth(medium) fintensity(inten30) color(%50)) order(1.sem 2.sem 3.sem 4.sem 5.sem 6.sem 7.sem 8.sem 9.sem 10.sem) xline(6, lpattern(dash)) xlabel(1 "1-6/2017" 2 "7-12/2017" 3 "1-6/2018" 4 "7-12/2018" 5 "1-6/2019" 6 "7-12/2019" 7 "1-6/2020" 8 "7-12/2020" 9 "1-6/2021" 10 "7-12/2021", angle(45))

    I have tried many alternatives but I really cant get it right.

    Do you have any help?

    THANKS!!



    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(contr tot_hire_imp smart_shr time std_exc id_impresa)
    2  1        0  6    .3576297  1
    2  1        0  5    .4004426  2
    2  1        1  1    .6893833  3
    2  1        1  2    .5597356  3
    2  1        1  5   .57445127  4
    2  1        0  7    .2076905  5
    2  1        0  8    .0286627  5
    2  1        1  1    .6889245  6
    2  2        0  1    .4693434  7
    2  1        0  1    .2071526  8
    2  1        0  3 .0039322525  9
    2  2        0  1   .01302971 10
    2  1        0  5    .4204224 10
    2  1        1  6    .6161914 11
    2  1        1  1    .8948836 12
    2  1        0  7    .4106361 13
    2  1        0  6   .26076874 14
    2  1        0  9   .02672894 15
    2  1        0  7    .1079424 16
    2  1        0  2     .366684 17
    2  1        0  5  .003886765 18
    2  1        1  1    .9400924 19
    2  1        1  5    .6912759 20
    2  1        1  5    .9186656 21
    2  1        0 10    .4197324 22
    2  2        1  3    .8040955 23
    2  1        0  6    .5986309 24
    2  1        0  5  .003447571 25
    2  1        1  2   .48831785 26
    2  1        1  6    .8822047 27
    2  1        1  1    .9342622 28
    2  1        0  4    .9856864 29
    2  1        0  1    .4312878 30
    2  1        1  2   .12801225 31
    2  1        1  9     .870147 32
    2  1        1  7    .7715443 33
    2  1        1  8    .7001778 33
    2  1        1  9     .644223 33
    2  1        1  2    .6357448 34
    2  1        0  1    .9978225 35
    2  1        0  2    .4216856 36
    2  1        0  8   .12090927 37
    2  1        0  7   .11603672 38
    2  1        0  5    .4246306 39
    2  1        0  5    .1719759 40
    2  1        0  5   .10271522 41
    2  1        1  5   .23924465 42
    2  1        0  2    .9758113 43
    2  1        1  5    .3482759 44
    3  3 .3333333  1    .6520972 45
    3  1        1  2   .53047884 45
    2  1        0  2    .3601541 46
    2  1        0  3    .8782554 47
    2  1        0  2   .08150438 48
    2  1        1  6    .4955085 49
    2  1        0  5    .3427709 50
    2  1        0  5    .4726689 51
    2  1        0  7    .6961063 52
    2  1        1  2  .074221484 53
    2  1        1  1    .4074829 54
    2  1        0  6   .19676156 55
    2  2        0  6    .6620824 56
    2  1        0  5    .8771489 57
    2  1        1  1    .1942331 58
    2  1        0  5    .1998855 59
    2  1        1  5    .4907105 60
    2  2        0  3    .9390584 61
    2  1        0  2    .4111129 62
    2  1        1  5    .8004963 63
    2  1        0  5   .17111416 64
    2  1        1  3     .466184 65
    2  1        0  3    .9382072 66
    2  2        0  5    .4024155 67
    2  1        1  1    .9841411 68
    2  2        1  6   .14055465 69
    2  1        0  5    .4398566 70
    2  1        0  1    .8955406 71
    2  1        1  5    .6760237 72
    2  2        1  2    .9666038 73
    2  1        0  6    .4118744 74
    2  1        0  3   .22269204 75
    2  1        0  6    .7279246 76
    2  1        1  1    .5028067 77
    2  1        1  5   .04913438 78
    2  1        0  5     .368421 79
    2  1        0  1     .359981 80
    2  1        1  9    .7385288 81
    2  1        0  1    .9236897 82
    2  1        0  1  .009898527 83
    2 10        1  2   .15286434 83
    2  8     .875  3    .8840723 83
    2  3 .3333333  4   .12690851 83
    2  1        0  5    .2413106 84
    2  2        1  6    .4427792 84
    2  1        1  2    .8636661 85
    3  1        1  1     .840627 86
    2  1        0  6   .26105738 87
    2  2        1  6    .8938763 88
    2  1        1  5    .8565752 89
    2  1        0  3    .0944128 90
    end
    label values contr contr
    label def contr 2 "temp", modify
    label def contr 3 "other", modify
    *********************
    *****GRAPH 1*****
    *********************
    Click image for larger version

Name:	graph1.png
Views:	2
Size:	28.6 KB
ID:	1767054



    *********************
    *****GRAPH 2*****
    *********************

    Click image for larger version

Name:	gra.png
Views:	1
Size:	31.0 KB
ID:	1767055
    Attached Files

  • #2
    coefplot is from SSC, as you are asked to explain (FAQ Advice #12). Look at how the coefficients are labeled within -order()- across the two commands, paying attention to the periods (or lack thereof).

    Comment

    Working...
    X