-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcoefplot.sthlp
More file actions
1815 lines (1543 loc) · 72.2 KB
/
Copy pathcoefplot.sthlp
File metadata and controls
1815 lines (1543 loc) · 72.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{smcl}
{* *! version 1.5.3 28may2025 Ben Jann}{...}
{vieweralsosee "[G-2] graph" "help graph"}{...}
{vieweralsosee "[R] estimates" "help estimates"}{...}
{vieweralsosee "[R] marginsplot" "help marginsplot"}{...}
{vieweralsosee "[R] margins" "help margins"}{...}
{viewerjumpto "Syntax" "coefplot##syntax"}{...}
{viewerjumpto "Description" "coefplot##description"}{...}
{viewerjumpto "Options" "coefplot##options"}{...}
{viewerjumpto "Examples" "coefplot##examples"}{...}
{viewerjumpto "Remarks" "coefplot##remarks"}{...}
{viewerjumpto "Saved results" "coefplot##saved_results"}{...}
{viewerjumpto "References" "coefplot##references"}{...}
{viewerjumpto "Author" "coefplot##author"}{...}
{viewerjumpto "History" "coefplot##history"}{...}
{hi:help coefplot}{...}
{right:{browse "http://repec.sowi.unibe.ch/stata/coefplot"}}
{right:{browse "http://github.com/benjann/coefplot"}}
{hline}
{title:Title}
{pstd}
{hi:coefplot} {hline 2} Plotting regression coefficients and other
results
{marker syntax}{...}
{title:Syntax}
{p 8 15 2}
{cmd:coefplot} {it:subgraph} [ || {it:subgraph} || ... ]
[{cmd:,} {help coefplot##globalopts:{it:globalopts}} ]
{pstd}
where {it:subgraph} is defined as
{p 8 16 2}
{cmd:(}{it:plot}{cmd:)} [ {cmd:(}{it:plot}{cmd:)} ... ]
[, {help coefplot##subgropts:{it:subgropts}} ]
{pstd}
and {it:plot} is either {cmd:_skip} (to skip a plot) or
{p 8 16 2}
{it:model} [ \ {it:model} \ ... ]
[, {help coefplot##plotopts:{it:plotopts}} ]
{pstd}
and {it:model} is
{p 8 16 2}
{it:namelist} [{cmd:,} {help coefplot##modelopts:{it:modelopts}} ]
{pstd}
where {it:namelist} is a list of names of stored models
(see help {helpb estimates}; type {cmd:.} or leave blank to refer to
the active model). The {cmd:*} and {cmd:?} wildcards are allowed
in {it:namelist}; see
{help coefplot##wildcards:{it:Using wildcards in model names}}. Furthermore,
{it:model} may also be
{p 8 16 2}
{helpb coefplot##matrix:{ul:m}atrix({it:mspec})} [{cmd:,} {help coefplot##modelopts:{it:modelopts}} ]
{pstd}
to plot results from a matrix (see
{help coefplot##matrix:{it:Plotting results from matrices}} below).
Parentheses around {it:plot} can be omitted if {it:plot} does not contain
spaces.
{synoptset 25 tabbed}{...}
{marker modelopts}{synopthdr:modelopts}
{synoptline}
{syntab:Main}
{synopt:{helpb coefplot##omitted:{ul:omit}ted}}include omitted
coefficients
{p_end}
{synopt:{helpb coefplot##baselevels:{ul:base}levels}}include base levels
{p_end}
{synopt:{helpb coefplot##b:b({it:mspec})}}specify source to be plotted; default is to
plot {cmd:e(b)}
{p_end}
{synopt:{helpb coefplot##at:at{sf:[}({it:spec}){sf:]}}}get plot positions from
{cmd:e(at)}, or as specified by {it:spec}
{p_end}
{synopt:{helpb coefplot##keep:keep({it:coeflist})}}keep specified coefficients
{p_end}
{synopt:{helpb coefplot##drop:drop({it:coeflist})}}drop specified coefficients
{p_end}
{syntab:Confidence intervals}
{synopt:{helpb coefplot##noci:noci}}omit confidence intervals
{p_end}
{synopt:{helpb coefplot##levels:{ul:l}evels({it:numlist})}}set level(s) for
conficence intervals
{p_end}
{synopt:{helpb coefplot##ci:ci({it:spec})}}provide confidence intervals
{p_end}
{synopt:{helpb coefplot##v:v({it:name})}}provide variances; default is to use
{cmd:e(V)}
{p_end}
{synopt:{helpb coefplot##se:se({it:mspec})}}provide standard errors
{p_end}
{synopt:{helpb coefplot##df:df({it:spec})}}provide degrees of freedom
{p_end}
{synopt:{helpb coefplot##citype:citype({it:method})}}method to compute
confidence intervals; default is {cmd:citype(normal)}
{p_end}
{syntab:Transform results}
{synopt:{helpb coefplot##eform:eform{sf:[}({it:coeflist}){sf:]}}}plot
exponentiated point estimates and confidence intervals
{p_end}
{synopt:{helpb coefplot##rescale:rescale({it:spec})}}rescale point estimates
and confidence intervals
{p_end}
{synopt:{helpb coefplot##transform:{ul:trans}form({it:matchlist})}}transform
point estimates and confidence intervals
{p_end}
{syntab:Names and labels}
{synopt:{helpb coefplot##rename:rename({it:spec})}}rename coefficients
{p_end}
{synopt:{helpb coefplot##eqrename:{ul:eqren}ame({it:spec})}}rename
equations
{p_end}
{synopt:{helpb coefplot##asequation:{ul:aseq}uation{sf:[}({it:string}){sf:]}}}set equation
to model name or {it:string}
{p_end}
{synopt:{helpb coefplot##swapnames:{ul:swap}names}}swap coefficient names and
equation names
{p_end}
{synopt:{helpb coefplot##mlabels:mlabels({it:matchlist})}}add custom marker labels
{p_end}
{syntab:Auxiliary results}
{synopt:{helpb coefplot##aux:aux({sf:{it:mspec} [{it:mspec} ...]})}}make
additional results available as {cmd:@aux1}, {cmd:@aux2}, etc.
{p_end}
{synoptline}
{synoptset 25 tabbed}{...}
{marker plotopts}{synopthdr:plotopts}
{synoptline}
{syntab:Passthru}
{synopt:{help coefplot##modelopts:{it:modelopts}}}plot-specific model options;
see {help coefplot##place:{it:Placement of options}}
{p_end}
{syntab:Main}
{synopt:{helpb coefplot##label:{ul:lab}el({it:string})}}label to be used for
the plot in the legend
{p_end}
{synopt:{helpb coefplot##key:key{sf:[}(ci {sf:[}#{sf:]}){sf:]}}}key
symbol to be used for the plot in the legend
{p_end}
{synopt:{helpb coefplot##nokey:nokey}}do not include the plot in the legend
{p_end}
{synopt:{helpb coefplot##pstyle:{ul:psty}le({it:pstyle})}}overall
style of the plot
{p_end}
{synopt:{helpb coefplot##axis:{ul:ax}is({it:#})}}choice of axis for the plot, {cmd:1} {ul:<} {it:#} {ul:<} {cmd:9}
{p_end}
{synopt:{helpb coefplot##offset:offset({it:#})}}provide offset for plot
positions
{p_end}
{synopt:{helpb coefplot##ifopt:if({it:exp})}}restrict the contents of the plot
{p_end}
{synopt:{helpb coefplot##weight:{ul:w}eight({it:exp})}}scale size of markers
{p_end}
{syntab:Markers}
{synopt:{it:{help marker_options}}}change look of
markers (color, size, etc.)
{p_end}
{synopt:{helpb coefplot##mlabel:{ul:ml}abel{sf:[}({it:spec}){sf:]}}}add marker
labels
{p_end}
{synopt:{it:{help marker_label_options}}}change the look and position of marker
labels
{p_end}
{synopt:{helpb coefplot##recast:recast({it:plottype})}}plot results using
{it:plottype}
{p_end}
{syntab:Confidence spikes}
{synopt:{helpb coefplot##cionly:cionly}}plot confidence spikes only
{p_end}
{synopt:{helpb coefplot##citop:citop}}draw confidence spikes in front
of markers
{p_end}
{synopt:{helpb coefplot##cirecast:{ul:cire}cast({it:plottype})}}shorthand for {cmd:ciopts(recast())}
{p_end}
{synopt:{helpb coefplot##ciopts:{ul:ciop}ts({it:options})}}affect rendition
of confidence spikes
{p_end}
{synopt:{helpb coefplot##cismooth:{ul:cis}mooth{sf:[}({it:options}){sf:]}}}add smoothed
confidence intervals
{p_end}
{synoptline}
{synoptset 25 tabbed}{...}
{marker subgropts}{synopthdr:subgropts}
{synoptline}
{syntab:Passthru}
{synopt:{help coefplot##modelopts:{it:modelopts}}}subgraph-specific model
options; see {help coefplot##place:{it:Placement of options}}
{p_end}
{synopt:{help coefplot##plotopts:{it:plotopts}}}subgraph-specific plot
options; see {help coefplot##place:{it:Placement of options}}
{p_end}
{syntab:Main}
{synopt:{helpb coefplot##bylabel:{ul:bylab}el({it:string})}}label to be used
for the subgraph
{p_end}
{synoptline}
{synoptset 25 tabbed}{...}
{marker globalopts}{synopthdr:globalopts}
{synoptline}
{syntab:Passthru}
{synopt:{help coefplot##modelopts:{it:modelopts}}}global model options; see
{help coefplot##place:{it:Placement of options}}
{p_end}
{synopt:{help coefplot##plotopts:{it:plotopts}}}global plot options; see
{help coefplot##place:{it:Placement of options}}
{p_end}
{synopt:{help coefplot##subgropts:{it:subgropts}}}global subgraph options;
see {help coefplot##place:{it:Placement of options}}
{p_end}
{syntab:Main}
{synopt:{helpb coefplot##horizontal:{ul:hor}izontal}}coefficient values are
on x axis; general default
{p_end}
{synopt:{helpb coefplot##vertical:{ul:vert}ical}}coefficient values are on y
axis; default with {cmd:at()}
{p_end}
{synopt:{helpb coefplot##eqstrict:eqstrict}}be strict about equations
{p_end}
{synopt:{helpb coefplot##order:order({it:coeflist})}}order coefficients
{p_end}
{synopt:{helpb coefplot##orderby:orderby({it:spec})}}order coefficients by
specific model
{p_end}
{synopt:{helpb coefplot##sort:sort{sf:[}({it:spec}){sf:]}}}sort coefficients
{p_end}
{synopt:{helpb coefplot##relocate:{ul:reloc}ate({it:spec})}}assign
specific positions to coefficients
{p_end}
{synopt:{helpb coefplot##bycoefs:{ul:byc}oefs}}arrange subgraphs by
coefficients
{p_end}
{synopt:{helpb coefplot##norecycle:{ul:norec}ycle}}increment plot styles across
subgraphs
{p_end}
{synopt:{helpb coefplot##nooffsets:{ul:nooff}sets}}do not offset plot
positions
{p_end}
{synopt:{helpb coefplot##format:format({it:format})}}set the display format for
numeric labels
{p_end}
{synopt:{helpb coefplot##pnum:p{it:#}({it:plotopts})}}options for {it:#}th plot
{p_end}
{syntab:Labels and grid lines}
{synopt:{helpb coefplot##nolabels:{ul:nolab}els}}use variable names instead of
labels
{p_end}
{synopt:{helpb coefplot##coeflabels:{ul:coefl}abels({it:spec})}}specify
custom labels for coefficients
{p_end}
{synopt:{helpb coefplot##noeqlabels:{ul:noeql}abels}}suppress equation labels
{p_end}
{synopt:{helpb coefplot##eqlabels:{ul:eql}abels({it:spec})}}specify labels
for equations
{p_end}
{synopt:{helpb coefplot##headings:{ul:head}ings({it:spec})}}add headings between
coefficients
{p_end}
{synopt:{helpb coefplot##groups:groups({it:spec})}}add labels for groups of
coefficients
{p_end}
{synopt:{helpb coefplot##plotlabels:{ul:plotl}abels({it:spec})}}(re)set plot
labels
{p_end}
{synopt:{helpb coefplot##bylabels:bylabels({it:spec})}}(re)set subgraph
labels
{p_end}
{synopt:{helpb coefplot##grid:grid({it:options})}}affect rendition of grid lines
{p_end}
{syntab:Save results}
{synopt:{helpb coefplot##generate:{ul:gen}erate{sf:[}({it:prefix}){sf:]}}}generate
variables containing the graph data
{p_end}
{synopt:{helpb coefplot##replace:replace}}overwrite existing variables
{p_end}
{syntab:Add plots}
{synopt:{helpb coefplot##addplot:addplot({it:plot})}}add other plots to the
graph
{p_end}
{synopt:{helpb coefplot##nodrop:nodrop}}do not drop observations
{p_end}
{syntab:Y axis, X axis, Titles, Legend, Overall, By}
{synopt:{it:{help twoway_options}}}twoway options, other than {cmd:by()}
{p_end}
{synopt:{cmdab:byop:ts(}{it:{help by_option:byopts}}{cmd:)}}how subgraphs
are combined
{p_end}
{synoptline}
{marker description}{...}
{title:Description}
{pstd}
{cmd:coefplot} plots results from estimation commands or Stata matrices.
Results from multiple models or matrices can be combined in a single
graph. The default behavior of {cmd:coefplot} is to draw markers for
coefficients and horizontal spikes for confidence intervals. However,
{cmd:coefplot} can also produce various other types of graphs.
{marker options}{...}
{title:Options}
{dlgtab:Model options}
{marker omitted}{...}
{phang}
{cmd:omitted} includes omitted coefficients. This may be useful if a model
contains coefficients that have been dropped due to collinearity.
{marker baselevels}{...}
{phang}
{cmd:baselevels} includes base levels of factor variables.
{marker b}{...}
{phang}
{cmd:b(}{it:mspec}{cmd:)} specifies the source from which the point
estimates and coefficient names are to be collected. The default is to use
(the first row of) {cmd:e(b)} (or {cmd:e(b_mi)} if plotting results from
{helpb mi estimate}). {cmd:b()} is discarded in matrix mode (see
{help coefplot##matrix:{it:Plotting results from matrices}} below).
{it:mspec} may be:
{p2colset 13 25 27 2}{...}
{p2col:{it:name}}use first row of {cmd:e(}{it:name}{cmd:)}
{p_end}
{p2col:{it:name}{cmd:[}#{cmd:,.]}}use #th row of
{cmd:e(}{it:name}{cmd:)}; may also type {it:name}{cmd:[}#{cmd:,]}
or {it:name}{cmd:[}#{cmd:]}
{p_end}
{p2col:{it:name}{cmd:[.,}#{cmd:]}}use #th column of
{cmd:e(}{it:name}{cmd:)}; may also type {it:name}{cmd:[,}#{cmd:]}
{p_end}
{p2colreset}{...}
{marker at}{...}
{phang}
{cmd:at}[{cmd:(}{it:spec}{cmd:)}] causes plot positions to be determined
by the values in {cmd:e(at)} (or matrix {cmd:at}) or as specified by
{it:spec}. The default is to create a categorical axis with coefficients
matched by their names. However, if {cmd:at} is specified, the axis is
treated as continuous. Note that labeling options
{cmd:coeflabels()}, {cmd:eqlabels()}, {cmd:headings()}, or {cmd:groups()}
are not allowed if {cmd:at} is specified. Also not allowed with {cmd:at}
are options {cmd:bycoefs}, {cmd:order()}, and {cmd:relocate()}.
Furthermore, note that {cmd:at} has to be specified for all models or
for none. {it:spec} is
[{it:atspec}] [{cmd:,} {opt t:ransform(exp)}]
{pmore}
where {it:atspec} may be
{p2colset 13 27 29 2}{...}
{p2col:{it:mspec}}as above for {helpb coefplot##b:b()}
{p_end}
{p2col:#}use #th at-dimension ({helpb margins}) or #th row/column of main matrix
{p_end}
{p2col:{opt m:atrix(mspec)}}read from matrix instead of {cmd:e()}
{p_end}
{p2col:{opt _coef}}use coefficient names as plot positions
{p_end}
{p2col:{opt _eq}}use equation names as plot positions
{p_end}
{p2colreset}{...}
{pmore}
If {cmd:at} is specified without argument, the plot positions are taken from the first row
of {cmd:e(at)} (or matrix {cmd:at}). A special case are results from
{helpb margins} where recovering the plot positions is more
complicated. The default in this case is to use the first
at-dimension. Type, e.g., {cmd:at(2)} if multiple at-dimension were specified
with {helpb margins} and you want to use the second dimension. Furthermore,
in matrix mode (see
{help coefplot##matrix:{it:Plotting results from matrices}} below), {cmd:at(2)}
would read the plot positions from the 2nd row (or column) of the main matrix.
{pmore}
When plotting results from {cmd:e()} it is sometimes convenient to
maintain an external matrix with the plot positions instead of
adding plot positions to each {cmd:e()}-set. In this case you can use
syntax {cmd:at(matrix(}{it:mspec}{cmd:))} to read the plot positions. Note
that the vector of plot positions must have the same length as the
coefficient vectors of the plotted models; elements are matched by position,
not by name.
{pmore}
Furthermore, {cmd:at(_coef)} or {cmd:at(_eq)} will use the coefficient names or
the equation names as plot positions, respectively. This is useful only if
the coefficient names or the equation names are numeric. Note that you may
use {helpb coefplot##rename:rename()} and
{helpb coefplot##eqrename:eqrename()} to strip a non-numeric prefix or suffix
from coefficient names or equation names.
{pmore}
Suboption {cmd:transform()} transforms the plot positions before creating
the graph. Within the transformation expression, use {cmd:@} as a
placeholder for the value to be transformed. For example, to take the
antilogarithm of the plot positions type {cmd:transform(exp(@))}.
{marker keep}{...}
{phang}
{cmd:keep(}{it:coeflist}{cmd:)} specifies the coefficients to be
plotted. The default is to include all coefficients from the
first (nonzero) equation of a model (and discard further equations).
{it:coeflist} is a space-separated list of
elements such as:
{p2colset 13 25 27 2}{...}
{p2col:{it:coef}}keep coefficient {it:coef}
{p_end}
{p2col:{it:eq}{cmd::}}keep all coefficients from equation {it:eq}
{p_end}
{p2col:{it:eq}{cmd::}{it:coef}}keep coefficient {it:coef} from equation {it:eq}
{p_end}
{p2colreset}{...}
{pmore}
where {it:eq} and {it:coef} may contain "{cmd:*}" (any string) and
"{cmd:?}" (any nonzero character) wildcards. For example, type {cmd:keep(*:)} or
{cmd:keep(*:*)} to plot all coefficients from all equations.
{pmore}
If {it:eq} is specified, it is applied to all subsequent
names until a new {it:eq} is specified. For example,
{cmd:keep(3:mpg price 4:weight)} will plot coefficients "{cmd:mpg}" and
"{cmd:price}" from equation "{cmd:3}" and coefficient "{cmd:weight}" from
equation "{cmd:4}".
{marker drop}{...}
{phang}
{cmd:drop(}{it:coeflist}{cmd:)} drops the specified coefficients, where
{it:coeflist} is as above for {helpb coefplot##keep:keep()}.
{marker noci}{...}
{phang}
{cmd:noci} omits confidence intervals.
{marker levels}{...}
{phang}
{cmd:levels(}{it:{help numlist}}{cmd:)} sets the level(s), as percentages,
for confidence intervals. Specified values may be between 10.00 and 99.99
and can have at most two digits after the decimal point. The default is
{cmd:levels(95)} or as set by {helpb set level}. If multiple values are
specified, multiple confidence intervals are plotted. For example, type
{cmd:levels(99.9 99 95)} to plot the 99.9%, 99%, and 95% confidence
intervals. The default is to use (logarithmically) increasing line widths
for multiple confidence intervals. This behavior is disabled as soon as
{cmd:lwidth()} or {cmd:recast()} is specified within
{helpb coefplot##ciopts:ciopts()}.
{marker ci}{...}
{phang}
{cmd:ci(}{it:spec}{cmd:)} specifies the source from which to collect
confidence intervals. Default is to compute confidence intervals for the
levels specified in {cmd:levels()} using variances/standard errors (and,
possibly, degrees of freedom). The {cmd:ci()} option is useful to
plot confidence intervals that have been provided by the estimation
command (such as, e.g., {helpb bootstrap}). {it:spec} is
{it:cispec} [{it:cispec} ...]
{pmore}
where {it:cispec} is {it:name} to get the lower and upper confidence limits
from rows 1 and 2 of {cmd:e(}{it:name}{cmd:)} (or matrix {it:name}),
respectively. Alternatively, {it:cispec} may be {cmd:(}{it:mspec}
{it:mspec}{cmd:)} to identify the lower and upper confidence limits, with
{it:mspec} as above for {helpb coefplot##b:b()}. For example, after
{helpb bootstrap}, {cmd:ci(ci_bc)} would get bias-corrected confidence intervals
from rows 1 and 2 of {cmd:e(ci_bc)}. The same could be achieved by
{cmd:ci((ci_bc[1] ci_bc[2]))}.
{pmore}
{it:cispec} may also be # for a specific confidence level as in
{helpb coefplot##levels:levels()}. Hence, you may type, e.g.,
{cmd:ci(95 myci)} to plot the usual 95% confidence intervals along with
custom confidence intervals provided in {cmd:e(myci)}. Levels specified
in {cmd:ci()} take precedence over levels specified in {cmd:levels()}),
however, you may also type {cmd:""} within {cmd:ci()} to leave a
position blank an use the specified level from {cmd:levels()}.
{pmore}
In matrix mode (see
{help coefplot##matrix:{it:Plotting results from matrices}} below),
{it:cispec} may also be {cmd:(}# #{cmd:)}. For example, {cmd:ci((2 3))} would
read the lower confidence limit from the 2nd row (or column) and
the upper confidence limit from the 3rd row (or column) of the main matrix.
{marker v}{...}
{phang}
{cmd:v(}{it:name}{cmd:)} specifies that the variances for confidence interval
computation are to be taken from the diagonal of {cmd:e(}{it:name}{cmd:)}
(or matrix {it:name}). Default is {cmd:e(V)} (or {cmd:e(V_mi)} if plotting
results from {helpb mi estimate}).
{marker se}{...}
{phang}
{cmd:se(}{it:mspec}{cmd:)} provides standard errors to be used for
computation of confidence intervals. Default is to compute confidence
intervals based on the variances in {cmd:e(V)}
(see {helpb coefplot##v:v()} above). {it:mspec} is as above for
{helpb coefplot##b:b()}.
In matrix mode (see
{help coefplot##matrix:{it:Plotting results from matrices}} below), you may
also specify {cmd:se(}#{cmd:)} to read the standard errors from the #th
row (or column) of the main matrix.
{marker df}{...}
{phang}
{cmd:df(}{it:spec}{cmd:)} specifies degrees of freedom (DF) to be taken into
account for confidence interval computation. Default is to obtain DF
from scalar {cmd:e(df_r)} if defined (as in, e.g., {helpb regress})
or, for results from {helpb mi estimate}, from matrix {cmd:e(df_mi)}. Otherwise,
no DF are taken into account. Specify {cmd:df(}{it:spec}{cmd:)} to provide
custom DF. {it:spec} may be:
{p2colset 13 25 27 2}{...}
{p2col:#}set DF for all coefficients to #
{p_end}
{p2col:{it:mspec}}as above for {helpb coefplot##b:b()}
{p_end}
{p2colreset}{...}
{marker citype}{...}
{phang}
{cmd:citype(}{it:method}{cmd:)} specifies the method to be used to compute the limits of
confidence intervals. {it:method} can be {cmd:normal}, {cmd:logit}, {cmd:probit},
{cmd:atanh}, or {cmd:log}.
{pmore}
{cmd:citype(normal)}, the default, computes confidence
limits based on untransformed coefficients and standard errors. Let {it:b} be
the point estimate, {it:se} the standard error, and {it:t} the (1-{it:a}/2)
quantile of the standard normal distribution or the t-distribution (if degrees
of freedom are available; see above), where {it:a} is 1 minus the
confidence level (e.g. {it:a}=5% for a 95% confidence interval). Then the
limits of the confidence interval are computed as
{it:b} +/- {it:t} * {it:se}
{pmore}
{cmd:citype(logit)} uses the logit transformation to compute the limits
of confidence intervals. This is useful if the estimates to be plotted are
proportions and the confidence limits are supposed to lie between 0 and
1. The limits are computed as
invlogit(logit({it:b}) +/- {it:t} * {it:se} / ({it:b} * (1 - {it:b})))
{pmore}
{cmd:citype(probit)} is an alternative to {cmd:citype(logit)} and computes the
limits as
normal(invnormal({it:b}) +/- {it:t} * {it:se} / normalden(invnormal({it:b})))
{pmore}
{cmd:citype(atanh)} uses the inverse hyperbolic tangent to compute the
confidence intervals. This is useful for estimates that lie between -1 and
1, such as a correlation coefficient. The limits are computed as:
tanh(atanh({it:b}) +/- {it:t} * {it:se} / (1 - {it:b}^2))
{pmore}
{cmd:citype(log)} computes log-transformed confidence intervals. This is useful
for estimates that may only be positive, such as a variance estimate. The limits
are computed as:
exp(ln({it:b}) +/- {it:t} * {it:se} / {it:b})
{marker eform}{...}
{phang}
{cmd:eform}[{cmd:(}{it:coeflist}{cmd:)}] causes point estimates and
confidence intervals to be exponentiated. This is useful
if you want to plot hazard ratios (HR), incidence-rate ratios (IRR),
odds ratios (OR), or relative-risk ratios (RRR). If {cmd:eform} is
specified without arguments, then all coefficients of the model are
exponentiated. To exponentiate only selected coefficients, specify
{it:coeflist} as above for {helpb coefplot##keep:keep()}.
{marker rescale}{...}
{phang}
{cmd:rescale(}{it:spec}{cmd:)} rescales point estimates and confidence
intervals. Type {cmd:rescale(}#{cmd:)} to rescale all coefficients
by a constant factor. For example, {cmd:rescale(100)} will multiply all
coefficients by 100. Alternatively, {it:spec} may be
{it:coeflist} {cmd:=} # [{it:coeflist} {cmd:=} # ...]
{pmore}
with {it:coeflist} as above for {helpb coefplot##keep:keep()}.
{marker transform}{...}
{phang}
{cmd:transform(}{it:matchlist}{cmd:)} transforms point estimates and confidence
intervals. {it:machlist} is:
{it:coeflist} {cmd:= "}{it:{help exp}}{cmd:"} [{it:coeflist} {cmd:= "}{it:{help exp}}{cmd:"} ...]
{pmore}
with {it:coeflist} as above for {helpb coefplot##keep:keep()}. Within the
transformation expression, use {cmd:@} as a placeholder for
the value to be transformed. For example, to take the square root of all
coefficients type {cmd:transform(* = sqrt(@))}. In addition, internal
variables may be used as explained in
{help coefplot##tempvar:Accessing internal temporary variables}. The
transformation expression must be enclosed in double quotes if it contains
spaces. If specified, {cmd:eform()} and {cmd:rescale()} are applied before applying
{cmd:transform()}.
{marker rename}{...}
{phang}
{cmd:rename(}{it:spec}{cmd:)} renames coefficients. {it:spec} is:
{it:coeflist} {cmd:=} {it:newname} [{it:coeflist} {cmd:=} {it:newname} ...] [{cmd:,} {cmdab:r:egex}]
{pmore}
with {it:coeflist} as above for {helpb coefplot##keep:keep()} except that
wildcards are only allowed in equation names, and coefficient names may
be specified as {it:prefix}{cmd:*} to replace a prefix or
{cmd:*}{it:suffix} to replace a suffix. For example,
{cmd:rename(*.foreign = .cartype)} will rename coefficients such as
{cmd:0.foreign} and {cmd:1.foreign} to {cmd:0.cartype} and
{cmd:1.cartype}. {it:newname} must be enclosed in double quotes if it
contains spaces. For labeling coefficients, also see
{helpb coefplot##coeflabels:coeflabels()}.
{pmore}
Apply option {cmd:regex} to cause coefficient specifications (but not
equation specifications) to be interpreted as
{browse "https://en.wikipedia.org/wiki/Regular_expression":regular expressions}. In this
case, {it:newname} may contain {cmd:\1}, ..., {cmd:\9} to reference back to
matched subexpressions (and {cmd:\0} for the entire match). For example, type
{cmd:rename(^AA([0-9]+)BB$ = YY\1ZZ, regex)} to rename
coefficients such as {cmd:AA123BB}, {cmd:AA0BB}, or {cmd:AA99BB} to
{cmd:YY123ZZ}, {cmd:YY0ZZ}, or {cmd:YY99ZZ}. If the leading {cmd:^} or the
tailing {cmd:$} is omitted, only the matched part of a coefficient name is
subject to substitution; the rest of the name will remain unchanged. Include
the regular expressions in quotes or compound double quotes if they contain
funny characters (such as, e.g., quotes, equal signs, or commas).
{marker eqrename}{...}
{phang}
{cmd:eqrename(}{it:spec}{cmd:)} renames equations. {it:spec} is:
{it:eqlist} {cmd:=} {it:newname} [{it:eqlist} {cmd:=} {it:newname} ...] [{cmd:,} {cmdab:r:egex}]
{pmore}
where {it:eqlist} is a space separated list of equation names. Equation
names may be {it:prefix}{cmd:*} to replace a prefix or
{cmd:*}{it:suffix} to replace a suffix. For example,
{cmd:eqrename(rep78* = reprec)} will rename equations such as
{cmd:rep78_3} and {cmd:rep78_4} to {cmd:reprec_3} and
{cmd:reprec_4}. {it:newname} must be enclosed in double quotes if it
contains spaces. For labeling equations, also see
{helpb coefplot##eqlabels:eqlabels()}.
{pmore}
Apply option {cmd:regex} to cause equation specifications to be interpreted as
{browse "https://en.wikipedia.org/wiki/Regular_expression":regular expressions}. In this
case, {it:newname} may contain {cmd:\1}, ..., {cmd:\9} to reference back to
matched subexpressions (and {cmd:\0} for the entire match). For example, type
{cmd:eqrename(^eq([0-9])0$ = Outcome_\1, regex)} to rename
equations such as {cmd:eq20} or {cmd:eq90} to
{cmd:Outcome_1} or {cmd:Outcome_9}. If the leading {cmd:^} or the
tailing {cmd:$} is omitted, only the matched part of an equation name is
subject to substitution; the rest of the name will remain unchanged. Include the regular expressions in
quotes or compound double quotes if they contain funny characters (such as, e.g., quotes,
equal signs, or commas).
{marker asequation}{...}
{phang}
{cmd:asequation}[{cmd:(}{it:string}{cmd:)}] sets the equation name for all
included coefficients from the model to {it:string}. This is useful if you
want to assign an equation name to results that have been stored without
information on equations. If {cmd:asequation} is specified without
argument, the name of the model is used. If you apply the
{cmd:asequation()} option you may also want to specify
{helpb coefplot##eqstrict:eqstrict}.
{marker swapnames}{...}
{phang}
{cmd:swapnames} swaps coefficient names and equation names after collecting
the model's results. The names are swapped after applying model options
such as {cmd:keep()}, {cmd:drop()}, or {cmd:rename()} but
before applying global options such as {cmd:coeflabel()}, {cmd:order()},
or {cmd:eqlabels()}.
{marker mlabels}{...}
{phang}
{cmd:mlabels(}{it:matchlist}{cmd:)} specifies marker labels for
selected coefficients. {it:matchlist} is:
{it:coeflist} {cmd:=} # "{it:label}" [{it:coeflist} {cmd:=} # "{it:label}" ...]
{pmore}
where {it:coeflist} is as above for {helpb coefplot##keep:keep()} and # is a
number 0--12 for the location of the marker label (see
{manhelpi clockposstyle G-4}). Not all of Stata's plot types
support marker labels. For example, if you use
{helpb coefplot##recast:recast(bar)} to change the plot type to
{helpb twoway_bar:bar}, no marker labels will be displayed (this has
changed with the April 6, 2022, update to Stata 17; plot type
{helpb twoway_bar:bar} now displays marker labels).
{marker aux}{...}
{phang}
{cmd:aux(}{it:mspec} [{it:mspec} ...]{cmd:)} collects additional results
and makes them available as internal variables. {it:mspec} is as above for
{helpb coefplot##b:b()}. The internal variables
are named {cmd:@aux1}, {cmd:@aux2}, ..., and can be used within
{helpb coefplot##ifopt:if()},
{helpb coefplot##weight:weight()},
{helpb coefplot##transform:transform()},
{helpb marker_label_options:mlabel()},
{helpb marker_label_options:mlabvposition()}, and
{helpb coefplot##addplot:addplot()} (see
{help coefplot##tempvar:Accessing internal temporary variables}
below). In matrix mode (see
{help coefplot##matrix:{it:Plotting results from matrices}} below), you may
also specify {cmd:aux(}# [# ...]{cmd:)} to read the from corresponding
rows (or column) of the main matrix.
{dlgtab:Plot options}
{marker label}{...}
{phang}
{cmd:label(}{it:string}{cmd:)} provides a label for the plot to be used
in the legend. Use double quotes to create multiline labels. For example,
{cmd:label("This is a" "long label")} would create a two-line label. For
text effects (bold, italics, greek letters, etc.) use SMCL tags as
described in {it:{help graph_text}}.
{marker key}{...}
{phang}
{cmd:key}[{cmd:(ci} [{cmd:#}]{cmd:)}] determines the key symbol
to be used for the plot in the legend. {cmd:key} without argument uses
the plot's marker symbol; this is the default. {cmd:key(ci)} determines
the key symbol from the (first) confidence interval. {cmd:key(ci #)}
determines the key symbol from the #th confidence interval; this is only
useful if multiple confidence intervals are included in the plot.
{marker nokey}{...}
{phang}
{cmd:nokey} prevents including the plot in the legend.
{marker pstyle}{...}
{phang}{cmd:pstyle(}{it:pstyle}{cmd:)} sets the overall style of the
plot; see help {it:{help pstyle}}. {cmd:pstyle()} affects both,
coefficient markers and confidence spikes. To use a different plot style
for confidence spikes, add {cmd:pstyle()} within
{helpb coefplot##ciopts:ciopts()}.
{marker axis}{...}
{phang}{cmd:axis(}{it:#}{cmd:)} specifies the scale axis to be used for the
plot, where {cmd:1} {ul:<} {it:#} {ul:<} {cmd:9}. The default is to place
all plots on the same scale axis.
{marker offset}{...}
{phang}
{cmd:offset(}{it:#}{cmd:)} specifies a custom offset for the plot
positions. The default is to create automatic offsets to prevent
overlap of confidence spikes as soon as there are
multiple plots. The spacing between coefficients is one unit, so
{it:#} should usually be within -0.5 and 0.5. {it:#} may also be a scalar
expression such as, say, {cmd:1/6}.
{marker ifopt}{...}
{phang}
{cmd:if(}{it:exp}{cmd:)} restricts the contents of the plot to coefficients
satisfying {it:exp}. The option is useful when you want to select
coefficients, e.g., based on their values, plot positions, or confidence
limits. Within {it:exp} refer to internal temporary variables as explained
in {help coefplot##tempvar:Accessing internal temporary variables} below.
For example, to include positive coefficients only, you could type
{cmd:if(@b>=0)}. Note that {cmd:if()} does not affect the rendition of the
categorical axis (unless {helpb coefplot##at:at} is specified). That is, a
complete categorical axis is created including labels for all collected
coefficients, even for the ones that have been removed from the plot by
{cmd:if()}.
{marker weight}{...}
{phang}
{cmd:weight(}{it:exp}{cmd:)} scales the size of the markers according to
the size of the specified weights (see
{help scatter##remarks14:Weighted markers} in help {helpb scatter}). Within
{it:exp} refer to internal temporary variables as explained in
{help coefplot##tempvar:Accessing internal temporary variables} below. For
example, to scale markers according to the inverse of standard errors, you
could type {cmd:weight(1/@se)}. {cmd:weight()} has no effect if marker
labels are specified.
{phang}
{it:marker_options} change the look of the coefficient markers (color,
size, etc.); see help {it:{help marker_options}}.
{marker mlabel}{...}
{phang}
{cmd:mlabel}[{cmd:(}{it:spec}{cmd:)}] adds marker labels to the
plot. For adding custom labels to specific markers also see model option
{helpb coefplot##mlabels:mlabels()} above. Furthermore, note that
not all of Stata's plot types support marker labels. For example, if you use
{helpb coefplot##recast:recast(bar)} to change the plot type to
{helpb twoway_bar:bar}, no marker labels will be displayed (this has
changed with the April 6, 2022, update to Stata 17; plot type
{helpb twoway_bar:bar} now displays marker labels).
{pmore}
The {cmd:mlabel} option can be used in three different ways:
{pmore2}
(1) {opt mlabel} without argument adds the values of the point estimates as
marker labels. Use global option
{helpb coefplot##format:format()} to set the display format.
{pmore2}
(2) {opth mlabel(varname)} uses the values of the specified variable
as marker labels. {it:varname} may be an internal variable (see
{help coefplot##tempvar:Accessing internal temporary variables} below). For example,
{cmd:mlabel(@b)} is equivalent to {cmd:mlabel} without argument.
{pmore2}
(3) {opt mlabel(strexp)} sets the marker labels to the evaluation of the
specified string expression. Internal variables can be used within {it:strexp}
(see {help coefplot##tempvar:Accessing internal temporary variables}
below). For example, you can type
{pmore3}
mlabel("p = " + string(@pval,"%9.3f"))
{pmore2}
to display labels such as "p = 0.001" or "p = 0.127". Furthermore,
{pmore3}
mlabel(cond(@pval<.001, "***", cond(@pval<.01, "**", cond(@pval<.05, "*", ""))))
{pmore2}
would display significance stars.
{phang}
{it:marker_label_options} change the look and
position of marker labels; see help {it:{help marker_label_options}}.
{marker recast}{...}
{phang}
{cmd:recast(}{it:plottype}{cmd:)} plots the coefficients using
{it:plottype}; supported plot types are
{helpb scatter},
{helpb line},
{helpb twoway_connected:connected},
{helpb twoway_area:area},
{helpb twoway_bar:bar},
{helpb twoway_spike:spike},
{helpb twoway_dropline:dropline}, and
{helpb twoway_dot:dot}. The default {it:plottype} is {helpb scatter}. The
chosen plot type affects the available plot options. For example, if
the plot type is {helpb twoway_bar:bar} then {it:{help barlook_options}}
will be available. See the plot type's help file for details.
{marker cionly}{...}
{phang}
{cmd:cionly} causes markers for point estimates to be suppressed.
{marker citop}{...}
{phang}
{cmd:citop} specifies that confidence intervals be drawn in front of
the markers for point estimates; the default is to draw confidence intervals
behind the markers.
{marker cirecast}{...}
{phang}
{cmd:cirecast(}{it:plottype}{cmd:)} is shorthand notation for
{helpb coefplot##ciopts:ciopts(recast())}. If both are provided, the plot types
specified in {cmd:ciopts(recast())} take precedence over the plot types
specified in {cmd:cirecast()}.
{marker ciopts}{...}
{phang}
{cmd:ciopts(}{it:options}{cmd:)} affect the rendition of confidence
intervals. {it:options} are:
{p2colset 13 31 33 2}{...}
{p2col:{it:{help line_options}}}change look of spikes
{p_end}
{p2col:{cmd:recast(}{it:plottype}{cmd:)}}plot the confidence intervals using
{it:plottype}
{p_end}
{p2colreset}{...}
{pmore}
Supported plot types are
{helpb twoway_rarea:rarea},
{helpb twoway_rbar:rbar},
{helpb twoway_rspike:rspike},
{helpb twoway_rcap:rcap},
{helpb twoway_rcapsym:rcapsym},
{helpb twoway_rscatter:rscatter},
{helpb twoway_rline:rline},
{helpb twoway_rconnected:rconnected},
{helpb twoway_pcspike:pcspike},
{helpb twoway_pcspike:pccapsym},
{helpb twoway_pcarrow:pcarrow} (or {cmd:pcrarrow} for the reverse),
{helpb twoway_pcbarrow:pcbarrow}, and
{helpb twoway_pcscatter:pcscatter}. The default {it:plottype} is
{helpb twoway_rspike:rspike}. The chosen plot type affects the available
options within {cmd:ciopts()}. For example, if the plot type is
{helpb twoway_rbar:rbar} then {it:{help barlook_options}} will be
available. See the plot type's help file for details.
{pmore}
If multiple confidence intervals are requested, then
{it:{help stylelists}} may be specified in the options within
{cmd:ciopts()}. For example, {cmd:recast(rspike rcap ..)} would use
{helpb twoway_rspike:rspike} for the first confidence interval and
{helpb twoway_rcap:rcap} for the remaining confidence intervals;
{cmd:lwidth(thin medium thick)} would use thin lines for the first
confidence interval, medium width lines for the second, and thick lines
for the third.
{marker cismooth}{...}
{phang}
{cmd:cismooth}[{cmd:(}{it:options}{cmd:)}] adds smoothed confidence
intervals. {it:options} are:
{p2colset 13 33 35 2}{...}
{p2col:{cmd:n(}{it:n}{cmd:)}}number of (equally spaced) confidence levels;
default is {cmd:n(50)}; levels are placed in steps of 100/{it:n} from 100/2{it:n} to
100-100/2{it:n} (e.g., 1, 3, 5, ..., 99 for {it:n}=50)
{p_end}
{p2col:{cmdab:lw:idth(}{it:min max}{cmd:)}}set range of
(relative) line widths; the default is {cmd:range(2 15)}
({it:max} is exact only for {it:n}=50)
{p_end}
{p2col:{cmdab:i:ntensity(}{it:min max}{cmd:)}}set range of
color intensities, as percentages; the default is {cmd:intensity(}{it:min} {cmd:100)}
where {it:min} is determined as 4/(ceil({it:n}/2)+3)*100 (about 14 for n=50)
{p_end}
{p2col:{cmdab:c:olor(}{help colorstyle:{it:color}}{cmd:)}}set the color (without
intensity multiplier); the default color is determined by the graph scheme
{p_end}
{p2col:{cmdab:psty:le(}{help pstyle:{it:pstyle}}{cmd:)}}set the overall style;
this mainly affects the color
{p_end}
{p2colreset}{...}
{pmore}
The confidence intervals produced by {cmd:cismooth} are placed behind
confidence intervals requested in {helpb coefplot##levels:levels()} and
{helpb coefplot##ci:ci()}. {helpb coefplot##ciopts:ciopts()} do not
apply to them.
{dlgtab:Subgraph options}
{marker bylabel}{...}
{phang}
{cmd:bylabel(}{it:string}{cmd:)} provides a label for the subgraph. Use
double quotes to create multiline labels. For example,
{cmd:bylabel("This is a" "long label")} would create a two-line label. For
text effects (bold, italics, greek letters, etc.) use SMCL tags as
described in {it:{help graph_text}}.
{pmore}
Subgraphs are implemented in terms of {helpb graph}'s {cmd:by()} option; see
{helpb coefplot##byopts:byopts()} below for options on how to combine and
render the subgraphs.
{dlgtab:Global options}
{marker horizontal}{...}
{phang}
{cmd:horizontal} places coefficient values on the x axis. This is the
default unless {helpb coefplot##at:at} is specified.
{marker vertical}{...}
{phang}
{cmd:vertical} places coefficient values on the y axis. This is the