Announcement

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

  • Replace axis labels with value labels in combined graph (xtdidregress, trendplots, xlabel)

    I have a case similar to Labeling second axis in a twoway graph with two y-axes - Statalist.
    I use -xtdidregress-, and postestimation command -trendplots-.
    This produces two graphs: a left graph with "observed means", and a right graph with a "linear-trends model".
    I reversed the time of the x-axis (because this is a DID in reverse setting). I reverse my time variable for this.
    However, in the plot (only in the plot, not the model), I want to display the "real" time, i.e. 1 to 4 instead of 4 to 1.
    To solve this, I use:
    HTML Code:
    label define waverevl 1 "4" 2 "3" 3 "2" 4 "1"
    label values waverev waverevl
    xtdidregress (cesd10astd `ctrls') ($treat), group($q) time(waverev) vce(cl $cl)
    estat trendplots, xlabel(, valuelabel)
    This produces the desired result in the left graph. However, -xlabel(, opt)- seems not to apply to the right graph.
    Any ideas how to solve this? And if so, where could I check what the command -trendplots- actually produces? I suspect it uses a form of graph combine, in which case solving this should be similar.

    Click image for larger version

Name:	Screenshot 2023-03-08 171112.png
Views:	1
Size:	38.6 KB
ID:	1704902

  • #2
    This is a bug that we will have fixed with the next update, we apologize for the inconvenience. In the meantime, rather than using the valuelabel suboption, specify the labels directly in the xlabel() option. Here is an example:
    Code:
    webuse hospdd, clear
    didregress (satis) (procedure), group(hospital) time(month)
    estat trendplots, xlabel(1 "7" 2 "6" 3 "5" 4 "4" 5 "3" 6 "2" 7 "1" )
    This produces the following graph:
    Click image for larger version

Name:	trends.png
Views:	1
Size:	80.4 KB
ID:	1705134

    Comment

    Working...
    X