├── LICENSE ├── README.md ├── coefplot.ado ├── coefplot.pkg ├── coefplot.sthlp └── stata.toc /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Ben Jann 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # coefplot 2 | Stata module for plotting regression coefficients and other results 3 | 4 | `coefplot` plots results from estimation commands or Stata matrices. Results 5 | from multiple models or matrices can be combined in a single graph. The default 6 | behavior of `coefplot` is to draw markers for coefficients and horizontal 7 | spikes for confidence intervals. However, `coefplot` can also produce various 8 | other types of graphs. 9 | 10 | To install the `coefplot` package from the SSC Archive, type 11 | 12 | . ssc install coefplot, replace 13 | 14 | in Stata. Stata version 11 or newer is required. 15 | 16 | --- 17 | 18 | Installation from GitHub: 19 | 20 | . net install coefplot, replace from(https://raw.githubusercontent.com/benjann/coefplot/master/) 21 | 22 | --- 23 | 24 | Main changes: 25 | 26 | 28may2025 (1.8.7) 27 | - coefplot could be slow in large datasets because unused observations were 28 | eliminated only after collecting the results; to improve performance, coefplot 29 | now removes all observations before doing anything else (making use of frames 30 | Stata 16 or newer) 31 | - unless -baselevels- or -omitted- was specified, coefplot dropped all 32 | coefficients containing a "b." or "o." flag; such coefficients are now 33 | only dropped if their value is zero 34 | 35 | 22feb2023 (1.8.6) 36 | - option rename() could break if all coefficients of a model were subject to 37 | renaming; this is fixed 38 | - parsing of 'matchlist' in options such as transform() now binds expressions 39 | in parentheses together 40 | 41 | 23nov2021 (1.8.5) 42 | - -set dp comma- could break -coefplot-; this is fixed (hopefully) 43 | 44 | 17dec2020 (1.8.4) 45 | - automatic offsets are no longer added to the plot positions of the 46 | estimates if multiple series are plotted but the coefficients of the series 47 | are distinct (such that there is at most one estimate per coefficient) 48 | - an "invalid attempt to modify label" error was returned when applying option 49 | -generate()- without -replace- in a situation in which value label definitions 50 | from an earlier call to -coefplot, generate()- were still in memory, even 51 | though the corresponding variables have been dropped; -coefplot- is now less 52 | strict; it now assumes that it is ok to overwrite existing value labels if a 53 | variable with the same name could successfully be created 54 | 55 | 17apr2020 56 | - installation files added to GitHub distribution 57 | 58 | 07mar2019 (1.8.3) 59 | - play(), xoverhangs, and yoverhangs did not work in case of multiple plots; 60 | this is fixed 61 | 62 | 22feb2019 (1.8.2) 63 | - cirecast() can now be used as shorthand notation for ciopts(recast()) 64 | - citype() can now has additional methods: probit, atanh, and log 65 | - offset() can now contain expressions, e.g. offset(1/7) 66 | - model options from p#() were only applied in the first relevant subgraph and 67 | were omitted in subsequent subgraphs; this is fixed 68 | - computation of CIs failed if degrees of freedom were larger than 2e17 69 | (can happen with -mi estimate-); this is fixed 70 | 71 | 18sep2017 (1.8.1) 72 | - mlabel() now supports string expressions to generate complicated marker labels 73 | - the backslash is no longer required between models when merging multiple 74 | models into one series (as long as the same options are to be used for all 75 | models); that is, you can now type "(m1 m2 m3, opts)" instead of 76 | "(m1 \ m2 \ m3, opts)" 77 | - noeqlabels did not remove the gap between equations; this is fixed; if you 78 | want to keep the gap, type noeqlabels together with eqlabels(, gap(1)) 79 | - eform(), rescale() and transform() returned error if no match was found 80 | in a model that had only one coefficient; this is fixed 81 | 82 | 14feb2017 (1.8.0) 83 | - options p1(), p2(), etc. are now allowed to specify plot options 84 | - wildcard characters (*, ?) can now be used in model names 85 | - eform() and rescale() broke computation of t and p values; this is fixed 86 | 87 | 02feb2017 (1.7.8) 88 | - rename() and eqrename() now have a regex suboption 89 | 90 | 24jan2017 (1.7.7) 91 | - new sort() option 92 | - new orderby() option 93 | - paired-coordinate plots are now supported in ciopts(recast()); in addition to 94 | the official types, plot type -pcrarrow- is provided for reverse arrows 95 | - cismooth() now has suboptions color() and pstyle() 96 | - p-values are now available internal variable @pval; t (or z) statistics as @t 97 | - shorthand syntax se(#), ci((# #) ...), aux(# ...), and at(#) is now allowed 98 | when plotting results from a matrix 99 | - df(.) is now allowed (set the DFs to missing) 100 | - twoway option pcycle() is now supported (default is set to 15) 101 | - coeflabels() did not support the angle() suboption; this is fixed 102 | - eqlabels() now has suboption -labels- to use variable labels 103 | - eqrename() now also affects equation names set by asequation() 104 | - mlabels() could crash if there were no matches; this is fixed 105 | - addplot(, below) now no longer messes up the legend; options nodraw, draw, 106 | by(), name(), saving(), play() are no longer allowed within addplot() 107 | - changed behavior of rename()/eqrename(): rename(* = str) will now add str as 108 | a suffix, not as a prefix; this is useful, e.g., for plotting results from 109 | -proportion- or -mean, over()- 110 | - coefficients starting with "." caused error when trying to retrieve the 111 | labels; this is fixed 112 | 113 | 29jan2015 (1.7.5) 114 | - coefplot accidentally left behind extra observations in the dataset if the 115 | existing number of observations was lower than the number of observations 116 | required to hold the results plotted by coefplot; this is fixed 117 | 118 | 08dec2014 (1.7.4) 119 | - fysize() and fxsize() did not work in case of multiple plots; this is 120 | fixed 121 | - there was a small chance that coefplot left behind a mata object if the 122 | user pressed break; this is fixed 123 | - option -nodrop- added 124 | - now uses "equation" as plot label instead of ".=equation" if model is . 125 | - twoway plot options such as msymbol() were not correctly passed through 126 | to the plots if specified at the subgraph level; this is fixed 127 | - collecting plot options across subgraphs has been improved (not relevant 128 | if norecycle is specified); the rules are: (1) plot options specified at 129 | a lower level take precedence over later plot options specified at an 130 | upper level. (2) within level, the rightmost option is used. 131 | - coefplot now picks up results from e(b_mi) and e(V_mi) by default if 132 | plotting results from -mi estimate- 133 | - transform() suboption added to at() 134 | - interaction() suboption added to coeflabels() 135 | - plot options key() and nokey added 136 | - replace option could fail due to conflicts with existing labels; this is 137 | fixed 138 | 139 | 05jun2014 (1.7.1) 140 | - grid() now allows suboptions 141 | 142 | 15may2014 (1.7.0) 143 | - internal variables are now accessed as @b, @ll, @ul, ... 144 | (syntax \`...' is discontinued) 145 | - variances, SEs and DFs now available as internal variables (@V, @se, @df) 146 | - mlabels() option added 147 | - transform() option added 148 | - aux() option added 149 | - weight() option added 150 | - asequation now allowed without argument 151 | - default prefix for generate() is now "__" 152 | - CIs are now stored in wide format (i.e. as separate variables) 153 | 154 | 26feb2014 (1.6.5) 155 | - if() option added 156 | 157 | 29jan2014 (version 1.6.1) 158 | - citype(logit|normal) added 159 | - ci() now uses syntax ci((ll ul) ...) 160 | ci("ll ul" ...) is still supported but undocumented 161 | - option swapnames added 162 | - options at(_coef) and at(_eq) added 163 | 164 | 23nov2013 (version 1.5.8) 165 | - improved recovery of plot positions from e(at) for margins 166 | - syntax at(matrix(...)) now possible 167 | - axis() option added 168 | - new suboptions in eqlabels(), groups(), headings(): 169 | gap(), wrap(), truncate(), nobreak 170 | - plotlabels() and bylabels() options added 171 | 172 | 28aug2013 (version 1.5.4) 173 | - cismooth() added; cishade removed 174 | - problem with too many ciopts() fixed 175 | 176 | 26aug2013 (version 1.5.2) 177 | - pstyles are now sensitive to plot types 178 | 179 | 25aug2013 (version 1.5.1) 180 | - coefplot released on SSC -------------------------------------------------------------------------------- /coefplot.pkg: -------------------------------------------------------------------------------- 1 | v 3 2 | d coefplot: module for plotting regression coefficients and other results 3 | d 4 | d Author: Ben Jann, University of Bern, ben.jann@unibe.ch 5 | d 6 | d Distribution-Date: 20250528 7 | f coefplot.ado 8 | f coefplot.sthlp 9 | -------------------------------------------------------------------------------- /coefplot.sthlp: -------------------------------------------------------------------------------- 1 | {smcl} 2 | {* *! version 1.5.3 28may2025 Ben Jann}{...} 3 | {vieweralsosee "[G-2] graph" "help graph"}{...} 4 | {vieweralsosee "[R] estimates" "help estimates"}{...} 5 | {vieweralsosee "[R] marginsplot" "help marginsplot"}{...} 6 | {vieweralsosee "[R] margins" "help margins"}{...} 7 | {viewerjumpto "Syntax" "coefplot##syntax"}{...} 8 | {viewerjumpto "Description" "coefplot##description"}{...} 9 | {viewerjumpto "Options" "coefplot##options"}{...} 10 | {viewerjumpto "Examples" "coefplot##examples"}{...} 11 | {viewerjumpto "Remarks" "coefplot##remarks"}{...} 12 | {viewerjumpto "Saved results" "coefplot##saved_results"}{...} 13 | {viewerjumpto "References" "coefplot##references"}{...} 14 | {viewerjumpto "Author" "coefplot##author"}{...} 15 | {viewerjumpto "History" "coefplot##history"}{...} 16 | {hi:help coefplot}{...} 17 | {right:{browse "http://repec.sowi.unibe.ch/stata/coefplot"}} 18 | {right:{browse "http://github.com/benjann/coefplot"}} 19 | {hline} 20 | 21 | {title:Title} 22 | 23 | {pstd} 24 | {hi:coefplot} {hline 2} Plotting regression coefficients and other 25 | results 26 | 27 | {marker syntax}{...} 28 | {title:Syntax} 29 | 30 | {p 8 15 2} 31 | {cmd:coefplot} {it:subgraph} [ || {it:subgraph} || ... ] 32 | [{cmd:,} {help coefplot##globalopts:{it:globalopts}} ] 33 | 34 | {pstd} 35 | where {it:subgraph} is defined as 36 | 37 | {p 8 16 2} 38 | {cmd:(}{it:plot}{cmd:)} [ {cmd:(}{it:plot}{cmd:)} ... ] 39 | [, {help coefplot##subgropts:{it:subgropts}} ] 40 | 41 | {pstd} 42 | and {it:plot} is either {cmd:_skip} (to skip a plot) or 43 | 44 | {p 8 16 2} 45 | {it:model} [ \ {it:model} \ ... ] 46 | [, {help coefplot##plotopts:{it:plotopts}} ] 47 | 48 | {pstd} 49 | and {it:model} is 50 | 51 | {p 8 16 2} 52 | {it:namelist} [{cmd:,} {help coefplot##modelopts:{it:modelopts}} ] 53 | 54 | {pstd} 55 | where {it:namelist} is a list of names of stored models 56 | (see help {helpb estimates}; type {cmd:.} or leave blank to refer to 57 | the active model). The {cmd:*} and {cmd:?} wildcards are allowed 58 | in {it:namelist}; see 59 | {help coefplot##wildcards:{it:Using wildcards in model names}}. Furthermore, 60 | {it:model} may also be 61 | 62 | {p 8 16 2} 63 | {helpb coefplot##matrix:{ul:m}atrix({it:mspec})} [{cmd:,} {help coefplot##modelopts:{it:modelopts}} ] 64 | 65 | {pstd} 66 | to plot results from a matrix (see 67 | {help coefplot##matrix:{it:Plotting results from matrices}} below). 68 | Parentheses around {it:plot} can be omitted if {it:plot} does not contain 69 | spaces. 70 | 71 | {synoptset 25 tabbed}{...} 72 | {marker modelopts}{synopthdr:modelopts} 73 | {synoptline} 74 | {syntab:Main} 75 | {synopt:{helpb coefplot##omitted:{ul:omit}ted}}include omitted 76 | coefficients 77 | {p_end} 78 | {synopt:{helpb coefplot##baselevels:{ul:base}levels}}include base levels 79 | {p_end} 80 | {synopt:{helpb coefplot##b:b({it:mspec})}}specify source to be plotted; default is to 81 | plot {cmd:e(b)} 82 | {p_end} 83 | {synopt:{helpb coefplot##at:at{sf:[}({it:spec}){sf:]}}}get plot positions from 84 | {cmd:e(at)}, or as specified by {it:spec} 85 | {p_end} 86 | {synopt:{helpb coefplot##keep:keep({it:coeflist})}}keep specified coefficients 87 | {p_end} 88 | {synopt:{helpb coefplot##drop:drop({it:coeflist})}}drop specified coefficients 89 | {p_end} 90 | 91 | {syntab:Confidence intervals} 92 | {synopt:{helpb coefplot##noci:noci}}omit confidence intervals 93 | {p_end} 94 | {synopt:{helpb coefplot##levels:{ul:l}evels({it:numlist})}}set level(s) for 95 | conficence intervals 96 | {p_end} 97 | {synopt:{helpb coefplot##ci:ci({it:spec})}}provide confidence intervals 98 | {p_end} 99 | {synopt:{helpb coefplot##v:v({it:name})}}provide variances; default is to use 100 | {cmd:e(V)} 101 | {p_end} 102 | {synopt:{helpb coefplot##se:se({it:mspec})}}provide standard errors 103 | {p_end} 104 | {synopt:{helpb coefplot##df:df({it:spec})}}provide degrees of freedom 105 | {p_end} 106 | {synopt:{helpb coefplot##citype:citype({it:method})}}method to compute 107 | confidence intervals; default is {cmd:citype(normal)} 108 | {p_end} 109 | 110 | {syntab:Transform results} 111 | {synopt:{helpb coefplot##eform:eform{sf:[}({it:coeflist}){sf:]}}}plot 112 | exponentiated point estimates and confidence intervals 113 | {p_end} 114 | {synopt:{helpb coefplot##rescale:rescale({it:spec})}}rescale point estimates 115 | and confidence intervals 116 | {p_end} 117 | {synopt:{helpb coefplot##transform:{ul:trans}form({it:matchlist})}}transform 118 | point estimates and confidence intervals 119 | {p_end} 120 | 121 | {syntab:Names and labels} 122 | {synopt:{helpb coefplot##rename:rename({it:spec})}}rename coefficients 123 | {p_end} 124 | {synopt:{helpb coefplot##eqrename:{ul:eqren}ame({it:spec})}}rename 125 | equations 126 | {p_end} 127 | {synopt:{helpb coefplot##asequation:{ul:aseq}uation{sf:[}({it:string}){sf:]}}}set equation 128 | to model name or {it:string} 129 | {p_end} 130 | {synopt:{helpb coefplot##swapnames:{ul:swap}names}}swap coefficient names and 131 | equation names 132 | {p_end} 133 | {synopt:{helpb coefplot##mlabels:mlabels({it:matchlist})}}add custom marker labels 134 | {p_end} 135 | 136 | {syntab:Auxiliary results} 137 | {synopt:{helpb coefplot##aux:aux({sf:{it:mspec} [{it:mspec} ...]})}}make 138 | additional results available as {cmd:@aux1}, {cmd:@aux2}, etc. 139 | {p_end} 140 | {synoptline} 141 | 142 | {synoptset 25 tabbed}{...} 143 | {marker plotopts}{synopthdr:plotopts} 144 | {synoptline} 145 | {syntab:Passthru} 146 | {synopt:{help coefplot##modelopts:{it:modelopts}}}plot-specific model options; 147 | see {help coefplot##place:{it:Placement of options}} 148 | {p_end} 149 | 150 | {syntab:Main} 151 | {synopt:{helpb coefplot##label:{ul:lab}el({it:string})}}label to be used for 152 | the plot in the legend 153 | {p_end} 154 | {synopt:{helpb coefplot##key:key{sf:[}(ci {sf:[}#{sf:]}){sf:]}}}key 155 | symbol to be used for the plot in the legend 156 | {p_end} 157 | {synopt:{helpb coefplot##nokey:nokey}}do not include the plot in the legend 158 | {p_end} 159 | {synopt:{helpb coefplot##pstyle:{ul:psty}le({it:pstyle})}}overall 160 | style of the plot 161 | {p_end} 162 | {synopt:{helpb coefplot##axis:{ul:ax}is({it:#})}}choice of axis for the plot, {cmd:1} {ul:<} {it:#} {ul:<} {cmd:9} 163 | {p_end} 164 | {synopt:{helpb coefplot##offset:offset({it:#})}}provide offset for plot 165 | positions 166 | {p_end} 167 | {synopt:{helpb coefplot##ifopt:if({it:exp})}}restrict the contents of the plot 168 | {p_end} 169 | {synopt:{helpb coefplot##weight:{ul:w}eight({it:exp})}}scale size of markers 170 | {p_end} 171 | 172 | {syntab:Markers} 173 | {synopt:{it:{help marker_options}}}change look of 174 | markers (color, size, etc.) 175 | {p_end} 176 | {synopt:{helpb coefplot##mlabel:{ul:ml}abel{sf:[}({it:spec}){sf:]}}}add marker 177 | labels 178 | {p_end} 179 | {synopt:{it:{help marker_label_options}}}change the look and position of marker 180 | labels 181 | {p_end} 182 | {synopt:{helpb coefplot##recast:recast({it:plottype})}}plot results using 183 | {it:plottype} 184 | {p_end} 185 | 186 | {syntab:Confidence spikes} 187 | {synopt:{helpb coefplot##cionly:cionly}}plot confidence spikes only 188 | {p_end} 189 | {synopt:{helpb coefplot##citop:citop}}draw confidence spikes in front 190 | of markers 191 | {p_end} 192 | {synopt:{helpb coefplot##cirecast:{ul:cire}cast({it:plottype})}}shorthand for {cmd:ciopts(recast())} 193 | {p_end} 194 | {synopt:{helpb coefplot##ciopts:{ul:ciop}ts({it:options})}}affect rendition 195 | of confidence spikes 196 | {p_end} 197 | {synopt:{helpb coefplot##cismooth:{ul:cis}mooth{sf:[}({it:options}){sf:]}}}add smoothed 198 | confidence intervals 199 | {p_end} 200 | {synoptline} 201 | 202 | {synoptset 25 tabbed}{...} 203 | {marker subgropts}{synopthdr:subgropts} 204 | {synoptline} 205 | {syntab:Passthru} 206 | {synopt:{help coefplot##modelopts:{it:modelopts}}}subgraph-specific model 207 | options; see {help coefplot##place:{it:Placement of options}} 208 | {p_end} 209 | {synopt:{help coefplot##plotopts:{it:plotopts}}}subgraph-specific plot 210 | options; see {help coefplot##place:{it:Placement of options}} 211 | {p_end} 212 | 213 | {syntab:Main} 214 | {synopt:{helpb coefplot##bylabel:{ul:bylab}el({it:string})}}label to be used 215 | for the subgraph 216 | {p_end} 217 | {synoptline} 218 | 219 | {synoptset 25 tabbed}{...} 220 | {marker globalopts}{synopthdr:globalopts} 221 | {synoptline} 222 | {syntab:Passthru} 223 | {synopt:{help coefplot##modelopts:{it:modelopts}}}global model options; see 224 | {help coefplot##place:{it:Placement of options}} 225 | {p_end} 226 | {synopt:{help coefplot##plotopts:{it:plotopts}}}global plot options; see 227 | {help coefplot##place:{it:Placement of options}} 228 | {p_end} 229 | {synopt:{help coefplot##subgropts:{it:subgropts}}}global subgraph options; 230 | see {help coefplot##place:{it:Placement of options}} 231 | {p_end} 232 | 233 | {syntab:Main} 234 | {synopt:{helpb coefplot##horizontal:{ul:hor}izontal}}coefficient values are 235 | on x axis; general default 236 | {p_end} 237 | {synopt:{helpb coefplot##vertical:{ul:vert}ical}}coefficient values are on y 238 | axis; default with {cmd:at()} 239 | {p_end} 240 | {synopt:{helpb coefplot##eqstrict:eqstrict}}be strict about equations 241 | {p_end} 242 | {synopt:{helpb coefplot##order:order({it:coeflist})}}order coefficients 243 | {p_end} 244 | {synopt:{helpb coefplot##orderby:orderby({it:spec})}}order coefficients by 245 | specific model 246 | {p_end} 247 | {synopt:{helpb coefplot##sort:sort{sf:[}({it:spec}){sf:]}}}sort coefficients 248 | {p_end} 249 | {synopt:{helpb coefplot##relocate:{ul:reloc}ate({it:spec})}}assign 250 | specific positions to coefficients 251 | {p_end} 252 | {synopt:{helpb coefplot##bycoefs:{ul:byc}oefs}}arrange subgraphs by 253 | coefficients 254 | {p_end} 255 | {synopt:{helpb coefplot##norecycle:{ul:norec}ycle}}increment plot styles across 256 | subgraphs 257 | {p_end} 258 | {synopt:{helpb coefplot##nooffsets:{ul:nooff}sets}}do not offset plot 259 | positions 260 | {p_end} 261 | {synopt:{helpb coefplot##format:format({it:format})}}set the display format for 262 | numeric labels 263 | {p_end} 264 | {synopt:{helpb coefplot##pnum:p{it:#}({it:plotopts})}}options for {it:#}th plot 265 | {p_end} 266 | 267 | {syntab:Labels and grid lines} 268 | {synopt:{helpb coefplot##nolabels:{ul:nolab}els}}use variable names instead of 269 | labels 270 | {p_end} 271 | {synopt:{helpb coefplot##coeflabels:{ul:coefl}abels({it:spec})}}specify 272 | custom labels for coefficients 273 | {p_end} 274 | {synopt:{helpb coefplot##noeqlabels:{ul:noeql}abels}}suppress equation labels 275 | {p_end} 276 | {synopt:{helpb coefplot##eqlabels:{ul:eql}abels({it:spec})}}specify labels 277 | for equations 278 | {p_end} 279 | {synopt:{helpb coefplot##headings:{ul:head}ings({it:spec})}}add headings between 280 | coefficients 281 | {p_end} 282 | {synopt:{helpb coefplot##groups:groups({it:spec})}}add labels for groups of 283 | coefficients 284 | {p_end} 285 | {synopt:{helpb coefplot##plotlabels:{ul:plotl}abels({it:spec})}}(re)set plot 286 | labels 287 | {p_end} 288 | {synopt:{helpb coefplot##bylabels:bylabels({it:spec})}}(re)set subgraph 289 | labels 290 | {p_end} 291 | {synopt:{helpb coefplot##grid:grid({it:options})}}affect rendition of grid lines 292 | {p_end} 293 | 294 | {syntab:Save results} 295 | {synopt:{helpb coefplot##generate:{ul:gen}erate{sf:[}({it:prefix}){sf:]}}}generate 296 | variables containing the graph data 297 | {p_end} 298 | {synopt:{helpb coefplot##replace:replace}}overwrite existing variables 299 | {p_end} 300 | 301 | {syntab:Add plots} 302 | {synopt:{helpb coefplot##addplot:addplot({it:plot})}}add other plots to the 303 | graph 304 | {p_end} 305 | {synopt:{helpb coefplot##nodrop:nodrop}}do not drop observations 306 | {p_end} 307 | 308 | {syntab:Y axis, X axis, Titles, Legend, Overall, By} 309 | {synopt:{it:{help twoway_options}}}twoway options, other than {cmd:by()} 310 | {p_end} 311 | {synopt:{cmdab:byop:ts(}{it:{help by_option:byopts}}{cmd:)}}how subgraphs 312 | are combined 313 | {p_end} 314 | {synoptline} 315 | 316 | 317 | {marker description}{...} 318 | {title:Description} 319 | 320 | {pstd} 321 | {cmd:coefplot} plots results from estimation commands or Stata matrices. 322 | Results from multiple models or matrices can be combined in a single 323 | graph. The default behavior of {cmd:coefplot} is to draw markers for 324 | coefficients and horizontal spikes for confidence intervals. However, 325 | {cmd:coefplot} can also produce various other types of graphs. 326 | 327 | 328 | {marker options}{...} 329 | {title:Options} 330 | {dlgtab:Model options} 331 | 332 | {marker omitted}{...} 333 | {phang} 334 | {cmd:omitted} includes omitted coefficients. This may be useful if a model 335 | contains coefficients that have been dropped due to collinearity. 336 | 337 | {marker baselevels}{...} 338 | {phang} 339 | {cmd:baselevels} includes base levels of factor variables. 340 | 341 | {marker b}{...} 342 | {phang} 343 | {cmd:b(}{it:mspec}{cmd:)} specifies the source from which the point 344 | estimates and coefficient names are to be collected. The default is to use 345 | (the first row of) {cmd:e(b)} (or {cmd:e(b_mi)} if plotting results from 346 | {helpb mi estimate}). {cmd:b()} is discarded in matrix mode (see 347 | {help coefplot##matrix:{it:Plotting results from matrices}} below). 348 | {it:mspec} may be: 349 | 350 | {p2colset 13 25 27 2}{...} 351 | {p2col:{it:name}}use first row of {cmd:e(}{it:name}{cmd:)} 352 | {p_end} 353 | {p2col:{it:name}{cmd:[}#{cmd:,.]}}use #th row of 354 | {cmd:e(}{it:name}{cmd:)}; may also type {it:name}{cmd:[}#{cmd:,]} 355 | or {it:name}{cmd:[}#{cmd:]} 356 | {p_end} 357 | {p2col:{it:name}{cmd:[.,}#{cmd:]}}use #th column of 358 | {cmd:e(}{it:name}{cmd:)}; may also type {it:name}{cmd:[,}#{cmd:]} 359 | {p_end} 360 | {p2colreset}{...} 361 | 362 | {marker at}{...} 363 | {phang} 364 | {cmd:at}[{cmd:(}{it:spec}{cmd:)}] causes plot positions to be determined 365 | by the values in {cmd:e(at)} (or matrix {cmd:at}) or as specified by 366 | {it:spec}. The default is to create a categorical axis with coefficients 367 | matched by their names. However, if {cmd:at} is specified, the axis is 368 | treated as continuous. Note that labeling options 369 | {cmd:coeflabels()}, {cmd:eqlabels()}, {cmd:headings()}, or {cmd:groups()} 370 | are not allowed if {cmd:at} is specified. Also not allowed with {cmd:at} 371 | are options {cmd:bycoefs}, {cmd:order()}, and {cmd:relocate()}. 372 | Furthermore, note that {cmd:at} has to be specified for all models or 373 | for none. {it:spec} is 374 | 375 | [{it:atspec}] [{cmd:,} {opt t:ransform(exp)}] 376 | 377 | {pmore} 378 | where {it:atspec} may be 379 | 380 | {p2colset 13 27 29 2}{...} 381 | {p2col:{it:mspec}}as above for {helpb coefplot##b:b()} 382 | {p_end} 383 | {p2col:#}use #th at-dimension ({helpb margins}) or #th row/column of main matrix 384 | {p_end} 385 | {p2col:{opt m:atrix(mspec)}}read from matrix instead of {cmd:e()} 386 | {p_end} 387 | {p2col:{opt _coef}}use coefficient names as plot positions 388 | {p_end} 389 | {p2col:{opt _eq}}use equation names as plot positions 390 | {p_end} 391 | {p2colreset}{...} 392 | 393 | {pmore} 394 | If {cmd:at} is specified without argument, the plot positions are taken from the first row 395 | of {cmd:e(at)} (or matrix {cmd:at}). A special case are results from 396 | {helpb margins} where recovering the plot positions is more 397 | complicated. The default in this case is to use the first 398 | at-dimension. Type, e.g., {cmd:at(2)} if multiple at-dimension were specified 399 | with {helpb margins} and you want to use the second dimension. Furthermore, 400 | in matrix mode (see 401 | {help coefplot##matrix:{it:Plotting results from matrices}} below), {cmd:at(2)} 402 | would read the plot positions from the 2nd row (or column) of the main matrix. 403 | 404 | {pmore} 405 | When plotting results from {cmd:e()} it is sometimes convenient to 406 | maintain an external matrix with the plot positions instead of 407 | adding plot positions to each {cmd:e()}-set. In this case you can use 408 | syntax {cmd:at(matrix(}{it:mspec}{cmd:))} to read the plot positions. Note 409 | that the vector of plot positions must have the same length as the 410 | coefficient vectors of the plotted models; elements are matched by position, 411 | not by name. 412 | 413 | {pmore} 414 | Furthermore, {cmd:at(_coef)} or {cmd:at(_eq)} will use the coefficient names or 415 | the equation names as plot positions, respectively. This is useful only if 416 | the coefficient names or the equation names are numeric. Note that you may 417 | use {helpb coefplot##rename:rename()} and 418 | {helpb coefplot##eqrename:eqrename()} to strip a non-numeric prefix or suffix 419 | from coefficient names or equation names. 420 | 421 | {pmore} 422 | Suboption {cmd:transform()} transforms the plot positions before creating 423 | the graph. Within the transformation expression, use {cmd:@} as a 424 | placeholder for the value to be transformed. For example, to take the 425 | antilogarithm of the plot positions type {cmd:transform(exp(@))}. 426 | 427 | {marker keep}{...} 428 | {phang} 429 | {cmd:keep(}{it:coeflist}{cmd:)} specifies the coefficients to be 430 | plotted. The default is to include all coefficients from the 431 | first (nonzero) equation of a model (and discard further equations). 432 | {it:coeflist} is a space-separated list of 433 | elements such as: 434 | 435 | {p2colset 13 25 27 2}{...} 436 | {p2col:{it:coef}}keep coefficient {it:coef} 437 | {p_end} 438 | {p2col:{it:eq}{cmd::}}keep all coefficients from equation {it:eq} 439 | {p_end} 440 | {p2col:{it:eq}{cmd::}{it:coef}}keep coefficient {it:coef} from equation {it:eq} 441 | {p_end} 442 | {p2colreset}{...} 443 | 444 | {pmore} 445 | where {it:eq} and {it:coef} may contain "{cmd:*}" (any string) and 446 | "{cmd:?}" (any nonzero character) wildcards. For example, type {cmd:keep(*:)} or 447 | {cmd:keep(*:*)} to plot all coefficients from all equations. 448 | 449 | {pmore} 450 | If {it:eq} is specified, it is applied to all subsequent 451 | names until a new {it:eq} is specified. For example, 452 | {cmd:keep(3:mpg price 4:weight)} will plot coefficients "{cmd:mpg}" and 453 | "{cmd:price}" from equation "{cmd:3}" and coefficient "{cmd:weight}" from 454 | equation "{cmd:4}". 455 | 456 | {marker drop}{...} 457 | {phang} 458 | {cmd:drop(}{it:coeflist}{cmd:)} drops the specified coefficients, where 459 | {it:coeflist} is as above for {helpb coefplot##keep:keep()}. 460 | 461 | {marker noci}{...} 462 | {phang} 463 | {cmd:noci} omits confidence intervals. 464 | 465 | {marker levels}{...} 466 | {phang} 467 | {cmd:levels(}{it:{help numlist}}{cmd:)} sets the level(s), as percentages, 468 | for confidence intervals. Specified values may be between 10.00 and 99.99 469 | and can have at most two digits after the decimal point. The default is 470 | {cmd:levels(95)} or as set by {helpb set level}. If multiple values are 471 | specified, multiple confidence intervals are plotted. For example, type 472 | {cmd:levels(99.9 99 95)} to plot the 99.9%, 99%, and 95% confidence 473 | intervals. The default is to use (logarithmically) increasing line widths 474 | for multiple confidence intervals. This behavior is disabled as soon as 475 | {cmd:lwidth()} or {cmd:recast()} is specified within 476 | {helpb coefplot##ciopts:ciopts()}. 477 | 478 | {marker ci}{...} 479 | {phang} 480 | {cmd:ci(}{it:spec}{cmd:)} specifies the source from which to collect 481 | confidence intervals. Default is to compute confidence intervals for the 482 | levels specified in {cmd:levels()} using variances/standard errors (and, 483 | possibly, degrees of freedom). The {cmd:ci()} option is useful to 484 | plot confidence intervals that have been provided by the estimation 485 | command (such as, e.g., {helpb bootstrap}). {it:spec} is 486 | 487 | {it:cispec} [{it:cispec} ...] 488 | 489 | {pmore} 490 | where {it:cispec} is {it:name} to get the lower and upper confidence limits 491 | from rows 1 and 2 of {cmd:e(}{it:name}{cmd:)} (or matrix {it:name}), 492 | respectively. Alternatively, {it:cispec} may be {cmd:(}{it:mspec} 493 | {it:mspec}{cmd:)} to identify the lower and upper confidence limits, with 494 | {it:mspec} as above for {helpb coefplot##b:b()}. For example, after 495 | {helpb bootstrap}, {cmd:ci(ci_bc)} would get bias-corrected confidence intervals 496 | from rows 1 and 2 of {cmd:e(ci_bc)}. The same could be achieved by 497 | {cmd:ci((ci_bc[1] ci_bc[2]))}. 498 | 499 | {pmore} 500 | {it:cispec} may also be # for a specific confidence level as in 501 | {helpb coefplot##levels:levels()}. Hence, you may type, e.g., 502 | {cmd:ci(95 myci)} to plot the usual 95% confidence intervals along with 503 | custom confidence intervals provided in {cmd:e(myci)}. Levels specified 504 | in {cmd:ci()} take precedence over levels specified in {cmd:levels()}), 505 | however, you may also type {cmd:""} within {cmd:ci()} to leave a 506 | position blank an use the specified level from {cmd:levels()}. 507 | 508 | {pmore} 509 | In matrix mode (see 510 | {help coefplot##matrix:{it:Plotting results from matrices}} below), 511 | {it:cispec} may also be {cmd:(}# #{cmd:)}. For example, {cmd:ci((2 3))} would 512 | read the lower confidence limit from the 2nd row (or column) and 513 | the upper confidence limit from the 3rd row (or column) of the main matrix. 514 | 515 | {marker v}{...} 516 | {phang} 517 | {cmd:v(}{it:name}{cmd:)} specifies that the variances for confidence interval 518 | computation are to be taken from the diagonal of {cmd:e(}{it:name}{cmd:)} 519 | (or matrix {it:name}). Default is {cmd:e(V)} (or {cmd:e(V_mi)} if plotting 520 | results from {helpb mi estimate}). 521 | 522 | {marker se}{...} 523 | {phang} 524 | {cmd:se(}{it:mspec}{cmd:)} provides standard errors to be used for 525 | computation of confidence intervals. Default is to compute confidence 526 | intervals based on the variances in {cmd:e(V)} 527 | (see {helpb coefplot##v:v()} above). {it:mspec} is as above for 528 | {helpb coefplot##b:b()}. 529 | In matrix mode (see 530 | {help coefplot##matrix:{it:Plotting results from matrices}} below), you may 531 | also specify {cmd:se(}#{cmd:)} to read the standard errors from the #th 532 | row (or column) of the main matrix. 533 | 534 | {marker df}{...} 535 | {phang} 536 | {cmd:df(}{it:spec}{cmd:)} specifies degrees of freedom (DF) to be taken into 537 | account for confidence interval computation. Default is to obtain DF 538 | from scalar {cmd:e(df_r)} if defined (as in, e.g., {helpb regress}) 539 | or, for results from {helpb mi estimate}, from matrix {cmd:e(df_mi)}. Otherwise, 540 | no DF are taken into account. Specify {cmd:df(}{it:spec}{cmd:)} to provide 541 | custom DF. {it:spec} may be: 542 | 543 | {p2colset 13 25 27 2}{...} 544 | {p2col:#}set DF for all coefficients to # 545 | {p_end} 546 | {p2col:{it:mspec}}as above for {helpb coefplot##b:b()} 547 | {p_end} 548 | {p2colreset}{...} 549 | 550 | {marker citype}{...} 551 | {phang} 552 | {cmd:citype(}{it:method}{cmd:)} specifies the method to be used to compute the limits of 553 | confidence intervals. {it:method} can be {cmd:normal}, {cmd:logit}, {cmd:probit}, 554 | {cmd:atanh}, or {cmd:log}. 555 | 556 | {pmore} 557 | {cmd:citype(normal)}, the default, computes confidence 558 | limits based on untransformed coefficients and standard errors. Let {it:b} be 559 | the point estimate, {it:se} the standard error, and {it:t} the (1-{it:a}/2) 560 | quantile of the standard normal distribution or the t-distribution (if degrees 561 | of freedom are available; see above), where {it:a} is 1 minus the 562 | confidence level (e.g. {it:a}=5% for a 95% confidence interval). Then the 563 | limits of the confidence interval are computed as 564 | 565 | {it:b} +/- {it:t} * {it:se} 566 | 567 | {pmore} 568 | {cmd:citype(logit)} uses the logit transformation to compute the limits 569 | of confidence intervals. This is useful if the estimates to be plotted are 570 | proportions and the confidence limits are supposed to lie between 0 and 571 | 1. The limits are computed as 572 | 573 | invlogit(logit({it:b}) +/- {it:t} * {it:se} / ({it:b} * (1 - {it:b}))) 574 | 575 | {pmore} 576 | {cmd:citype(probit)} is an alternative to {cmd:citype(logit)} and computes the 577 | limits as 578 | 579 | normal(invnormal({it:b}) +/- {it:t} * {it:se} / normalden(invnormal({it:b}))) 580 | 581 | {pmore} 582 | {cmd:citype(atanh)} uses the inverse hyperbolic tangent to compute the 583 | confidence intervals. This is useful for estimates that lie between -1 and 584 | 1, such as a correlation coefficient. The limits are computed as: 585 | 586 | tanh(atanh({it:b}) +/- {it:t} * {it:se} / (1 - {it:b}^2)) 587 | 588 | {pmore} 589 | {cmd:citype(log)} computes log-transformed confidence intervals. This is useful 590 | for estimates that may only be positive, such as a variance estimate. The limits 591 | are computed as: 592 | 593 | exp(ln({it:b}) +/- {it:t} * {it:se} / {it:b}) 594 | 595 | {marker eform}{...} 596 | {phang} 597 | {cmd:eform}[{cmd:(}{it:coeflist}{cmd:)}] causes point estimates and 598 | confidence intervals to be exponentiated. This is useful 599 | if you want to plot hazard ratios (HR), incidence-rate ratios (IRR), 600 | odds ratios (OR), or relative-risk ratios (RRR). If {cmd:eform} is 601 | specified without arguments, then all coefficients of the model are 602 | exponentiated. To exponentiate only selected coefficients, specify 603 | {it:coeflist} as above for {helpb coefplot##keep:keep()}. 604 | 605 | {marker rescale}{...} 606 | {phang} 607 | {cmd:rescale(}{it:spec}{cmd:)} rescales point estimates and confidence 608 | intervals. Type {cmd:rescale(}#{cmd:)} to rescale all coefficients 609 | by a constant factor. For example, {cmd:rescale(100)} will multiply all 610 | coefficients by 100. Alternatively, {it:spec} may be 611 | 612 | {it:coeflist} {cmd:=} # [{it:coeflist} {cmd:=} # ...] 613 | 614 | {pmore} 615 | with {it:coeflist} as above for {helpb coefplot##keep:keep()}. 616 | 617 | {marker transform}{...} 618 | {phang} 619 | {cmd:transform(}{it:matchlist}{cmd:)} transforms point estimates and confidence 620 | intervals. {it:machlist} is: 621 | 622 | {it:coeflist} {cmd:= "}{it:{help exp}}{cmd:"} [{it:coeflist} {cmd:= "}{it:{help exp}}{cmd:"} ...] 623 | 624 | {pmore} 625 | with {it:coeflist} as above for {helpb coefplot##keep:keep()}. Within the 626 | transformation expression, use {cmd:@} as a placeholder for 627 | the value to be transformed. For example, to take the square root of all 628 | coefficients type {cmd:transform(* = sqrt(@))}. In addition, internal 629 | variables may be used as explained in 630 | {help coefplot##tempvar:Accessing internal temporary variables}. The 631 | transformation expression must be enclosed in double quotes if it contains 632 | spaces. If specified, {cmd:eform()} and {cmd:rescale()} are applied before applying 633 | {cmd:transform()}. 634 | 635 | {marker rename}{...} 636 | {phang} 637 | {cmd:rename(}{it:spec}{cmd:)} renames coefficients. {it:spec} is: 638 | 639 | {it:coeflist} {cmd:=} {it:newname} [{it:coeflist} {cmd:=} {it:newname} ...] [{cmd:,} {cmdab:r:egex}] 640 | 641 | {pmore} 642 | with {it:coeflist} as above for {helpb coefplot##keep:keep()} except that 643 | wildcards are only allowed in equation names, and coefficient names may 644 | be specified as {it:prefix}{cmd:*} to replace a prefix or 645 | {cmd:*}{it:suffix} to replace a suffix. For example, 646 | {cmd:rename(*.foreign = .cartype)} will rename coefficients such as 647 | {cmd:0.foreign} and {cmd:1.foreign} to {cmd:0.cartype} and 648 | {cmd:1.cartype}. {it:newname} must be enclosed in double quotes if it 649 | contains spaces. For labeling coefficients, also see 650 | {helpb coefplot##coeflabels:coeflabels()}. 651 | 652 | {pmore} 653 | Apply option {cmd:regex} to cause coefficient specifications (but not 654 | equation specifications) to be interpreted as 655 | {browse "https://en.wikipedia.org/wiki/Regular_expression":regular expressions}. In this 656 | case, {it:newname} may contain {cmd:\1}, ..., {cmd:\9} to reference back to 657 | matched subexpressions (and {cmd:\0} for the entire match). For example, type 658 | {cmd:rename(^AA([0-9]+)BB$ = YY\1ZZ, regex)} to rename 659 | coefficients such as {cmd:AA123BB}, {cmd:AA0BB}, or {cmd:AA99BB} to 660 | {cmd:YY123ZZ}, {cmd:YY0ZZ}, or {cmd:YY99ZZ}. If the leading {cmd:^} or the 661 | tailing {cmd:$} is omitted, only the matched part of a coefficient name is 662 | subject to substitution; the rest of the name will remain unchanged. Include 663 | the regular expressions in quotes or compound double quotes if they contain 664 | funny characters (such as, e.g., quotes, equal signs, or commas). 665 | 666 | {marker eqrename}{...} 667 | {phang} 668 | {cmd:eqrename(}{it:spec}{cmd:)} renames equations. {it:spec} is: 669 | 670 | {it:eqlist} {cmd:=} {it:newname} [{it:eqlist} {cmd:=} {it:newname} ...] [{cmd:,} {cmdab:r:egex}] 671 | 672 | {pmore} 673 | where {it:eqlist} is a space separated list of equation names. Equation 674 | names may be {it:prefix}{cmd:*} to replace a prefix or 675 | {cmd:*}{it:suffix} to replace a suffix. For example, 676 | {cmd:eqrename(rep78* = reprec)} will rename equations such as 677 | {cmd:rep78_3} and {cmd:rep78_4} to {cmd:reprec_3} and 678 | {cmd:reprec_4}. {it:newname} must be enclosed in double quotes if it 679 | contains spaces. For labeling equations, also see 680 | {helpb coefplot##eqlabels:eqlabels()}. 681 | 682 | {pmore} 683 | Apply option {cmd:regex} to cause equation specifications to be interpreted as 684 | {browse "https://en.wikipedia.org/wiki/Regular_expression":regular expressions}. In this 685 | case, {it:newname} may contain {cmd:\1}, ..., {cmd:\9} to reference back to 686 | matched subexpressions (and {cmd:\0} for the entire match). For example, type 687 | {cmd:eqrename(^eq([0-9])0$ = Outcome_\1, regex)} to rename 688 | equations such as {cmd:eq20} or {cmd:eq90} to 689 | {cmd:Outcome_1} or {cmd:Outcome_9}. If the leading {cmd:^} or the 690 | tailing {cmd:$} is omitted, only the matched part of an equation name is 691 | subject to substitution; the rest of the name will remain unchanged. Include the regular expressions in 692 | quotes or compound double quotes if they contain funny characters (such as, e.g., quotes, 693 | equal signs, or commas). 694 | 695 | {marker asequation}{...} 696 | {phang} 697 | {cmd:asequation}[{cmd:(}{it:string}{cmd:)}] sets the equation name for all 698 | included coefficients from the model to {it:string}. This is useful if you 699 | want to assign an equation name to results that have been stored without 700 | information on equations. If {cmd:asequation} is specified without 701 | argument, the name of the model is used. If you apply the 702 | {cmd:asequation()} option you may also want to specify 703 | {helpb coefplot##eqstrict:eqstrict}. 704 | 705 | {marker swapnames}{...} 706 | {phang} 707 | {cmd:swapnames} swaps coefficient names and equation names after collecting 708 | the model's results. The names are swapped after applying model options 709 | such as {cmd:keep()}, {cmd:drop()}, or {cmd:rename()} but 710 | before applying global options such as {cmd:coeflabel()}, {cmd:order()}, 711 | or {cmd:eqlabels()}. 712 | 713 | {marker mlabels}{...} 714 | {phang} 715 | {cmd:mlabels(}{it:matchlist}{cmd:)} specifies marker labels for 716 | selected coefficients. {it:matchlist} is: 717 | 718 | {it:coeflist} {cmd:=} # "{it:label}" [{it:coeflist} {cmd:=} # "{it:label}" ...] 719 | 720 | {pmore} 721 | where {it:coeflist} is as above for {helpb coefplot##keep:keep()} and # is a 722 | number 0--12 for the location of the marker label (see 723 | {manhelpi clockposstyle G-4}). Not all of Stata's plot types 724 | support marker labels. For example, if you use 725 | {helpb coefplot##recast:recast(bar)} to change the plot type to 726 | {helpb twoway_bar:bar}, no marker labels will be displayed (this has 727 | changed with the April 6, 2022, update to Stata 17; plot type 728 | {helpb twoway_bar:bar} now displays marker labels). 729 | 730 | {marker aux}{...} 731 | {phang} 732 | {cmd:aux(}{it:mspec} [{it:mspec} ...]{cmd:)} collects additional results 733 | and makes them available as internal variables. {it:mspec} is as above for 734 | {helpb coefplot##b:b()}. The internal variables 735 | are named {cmd:@aux1}, {cmd:@aux2}, ..., and can be used within 736 | {helpb coefplot##ifopt:if()}, 737 | {helpb coefplot##weight:weight()}, 738 | {helpb coefplot##transform:transform()}, 739 | {helpb marker_label_options:mlabel()}, 740 | {helpb marker_label_options:mlabvposition()}, and 741 | {helpb coefplot##addplot:addplot()} (see 742 | {help coefplot##tempvar:Accessing internal temporary variables} 743 | below). In matrix mode (see 744 | {help coefplot##matrix:{it:Plotting results from matrices}} below), you may 745 | also specify {cmd:aux(}# [# ...]{cmd:)} to read the from corresponding 746 | rows (or column) of the main matrix. 747 | 748 | {dlgtab:Plot options} 749 | 750 | {marker label}{...} 751 | {phang} 752 | {cmd:label(}{it:string}{cmd:)} provides a label for the plot to be used 753 | in the legend. Use double quotes to create multiline labels. For example, 754 | {cmd:label("This is a" "long label")} would create a two-line label. For 755 | text effects (bold, italics, greek letters, etc.) use SMCL tags as 756 | described in {it:{help graph_text}}. 757 | 758 | {marker key}{...} 759 | {phang} 760 | {cmd:key}[{cmd:(ci} [{cmd:#}]{cmd:)}] determines the key symbol 761 | to be used for the plot in the legend. {cmd:key} without argument uses 762 | the plot's marker symbol; this is the default. {cmd:key(ci)} determines 763 | the key symbol from the (first) confidence interval. {cmd:key(ci #)} 764 | determines the key symbol from the #th confidence interval; this is only 765 | useful if multiple confidence intervals are included in the plot. 766 | 767 | {marker nokey}{...} 768 | {phang} 769 | {cmd:nokey} prevents including the plot in the legend. 770 | 771 | {marker pstyle}{...} 772 | {phang}{cmd:pstyle(}{it:pstyle}{cmd:)} sets the overall style of the 773 | plot; see help {it:{help pstyle}}. {cmd:pstyle()} affects both, 774 | coefficient markers and confidence spikes. To use a different plot style 775 | for confidence spikes, add {cmd:pstyle()} within 776 | {helpb coefplot##ciopts:ciopts()}. 777 | 778 | {marker axis}{...} 779 | {phang}{cmd:axis(}{it:#}{cmd:)} specifies the scale axis to be used for the 780 | plot, where {cmd:1} {ul:<} {it:#} {ul:<} {cmd:9}. The default is to place 781 | all plots on the same scale axis. 782 | 783 | {marker offset}{...} 784 | {phang} 785 | {cmd:offset(}{it:#}{cmd:)} specifies a custom offset for the plot 786 | positions. The default is to create automatic offsets to prevent 787 | overlap of confidence spikes as soon as there are 788 | multiple plots. The spacing between coefficients is one unit, so 789 | {it:#} should usually be within -0.5 and 0.5. {it:#} may also be a scalar 790 | expression such as, say, {cmd:1/6}. 791 | 792 | {marker ifopt}{...} 793 | {phang} 794 | {cmd:if(}{it:exp}{cmd:)} restricts the contents of the plot to coefficients 795 | satisfying {it:exp}. The option is useful when you want to select 796 | coefficients, e.g., based on their values, plot positions, or confidence 797 | limits. Within {it:exp} refer to internal temporary variables as explained 798 | in {help coefplot##tempvar:Accessing internal temporary variables} below. 799 | For example, to include positive coefficients only, you could type 800 | {cmd:if(@b>=0)}. Note that {cmd:if()} does not affect the rendition of the 801 | categorical axis (unless {helpb coefplot##at:at} is specified). That is, a 802 | complete categorical axis is created including labels for all collected 803 | coefficients, even for the ones that have been removed from the plot by 804 | {cmd:if()}. 805 | 806 | {marker weight}{...} 807 | {phang} 808 | {cmd:weight(}{it:exp}{cmd:)} scales the size of the markers according to 809 | the size of the specified weights (see 810 | {help scatter##remarks14:Weighted markers} in help {helpb scatter}). Within 811 | {it:exp} refer to internal temporary variables as explained in 812 | {help coefplot##tempvar:Accessing internal temporary variables} below. For 813 | example, to scale markers according to the inverse of standard errors, you 814 | could type {cmd:weight(1/@se)}. {cmd:weight()} has no effect if marker 815 | labels are specified. 816 | 817 | {phang} 818 | {it:marker_options} change the look of the coefficient markers (color, 819 | size, etc.); see help {it:{help marker_options}}. 820 | 821 | {marker mlabel}{...} 822 | {phang} 823 | {cmd:mlabel}[{cmd:(}{it:spec}{cmd:)}] adds marker labels to the 824 | plot. For adding custom labels to specific markers also see model option 825 | {helpb coefplot##mlabels:mlabels()} above. Furthermore, note that 826 | not all of Stata's plot types support marker labels. For example, if you use 827 | {helpb coefplot##recast:recast(bar)} to change the plot type to 828 | {helpb twoway_bar:bar}, no marker labels will be displayed (this has 829 | changed with the April 6, 2022, update to Stata 17; plot type 830 | {helpb twoway_bar:bar} now displays marker labels). 831 | 832 | {pmore} 833 | The {cmd:mlabel} option can be used in three different ways: 834 | 835 | {pmore2} 836 | (1) {opt mlabel} without argument adds the values of the point estimates as 837 | marker labels. Use global option 838 | {helpb coefplot##format:format()} to set the display format. 839 | 840 | {pmore2} 841 | (2) {opth mlabel(varname)} uses the values of the specified variable 842 | as marker labels. {it:varname} may be an internal variable (see 843 | {help coefplot##tempvar:Accessing internal temporary variables} below). For example, 844 | {cmd:mlabel(@b)} is equivalent to {cmd:mlabel} without argument. 845 | 846 | {pmore2} 847 | (3) {opt mlabel(strexp)} sets the marker labels to the evaluation of the 848 | specified string expression. Internal variables can be used within {it:strexp} 849 | (see {help coefplot##tempvar:Accessing internal temporary variables} 850 | below). For example, you can type 851 | 852 | {pmore3} 853 | mlabel("p = " + string(@pval,"%9.3f")) 854 | 855 | {pmore2} 856 | to display labels such as "p = 0.001" or "p = 0.127". Furthermore, 857 | 858 | {pmore3} 859 | mlabel(cond(@pval<.001, "***", cond(@pval<.01, "**", cond(@pval<.05, "*", "")))) 860 | 861 | {pmore2} 862 | would display significance stars. 863 | 864 | {phang} 865 | {it:marker_label_options} change the look and 866 | position of marker labels; see help {it:{help marker_label_options}}. 867 | 868 | {marker recast}{...} 869 | {phang} 870 | {cmd:recast(}{it:plottype}{cmd:)} plots the coefficients using 871 | {it:plottype}; supported plot types are 872 | {helpb scatter}, 873 | {helpb line}, 874 | {helpb twoway_connected:connected}, 875 | {helpb twoway_area:area}, 876 | {helpb twoway_bar:bar}, 877 | {helpb twoway_spike:spike}, 878 | {helpb twoway_dropline:dropline}, and 879 | {helpb twoway_dot:dot}. The default {it:plottype} is {helpb scatter}. The 880 | chosen plot type affects the available plot options. For example, if 881 | the plot type is {helpb twoway_bar:bar} then {it:{help barlook_options}} 882 | will be available. See the plot type's help file for details. 883 | 884 | {marker cionly}{...} 885 | {phang} 886 | {cmd:cionly} causes markers for point estimates to be suppressed. 887 | 888 | {marker citop}{...} 889 | {phang} 890 | {cmd:citop} specifies that confidence intervals be drawn in front of 891 | the markers for point estimates; the default is to draw confidence intervals 892 | behind the markers. 893 | 894 | {marker cirecast}{...} 895 | {phang} 896 | {cmd:cirecast(}{it:plottype}{cmd:)} is shorthand notation for 897 | {helpb coefplot##ciopts:ciopts(recast())}. If both are provided, the plot types 898 | specified in {cmd:ciopts(recast())} take precedence over the plot types 899 | specified in {cmd:cirecast()}. 900 | 901 | {marker ciopts}{...} 902 | {phang} 903 | {cmd:ciopts(}{it:options}{cmd:)} affect the rendition of confidence 904 | intervals. {it:options} are: 905 | 906 | {p2colset 13 31 33 2}{...} 907 | {p2col:{it:{help line_options}}}change look of spikes 908 | {p_end} 909 | {p2col:{cmd:recast(}{it:plottype}{cmd:)}}plot the confidence intervals using 910 | {it:plottype} 911 | {p_end} 912 | {p2colreset}{...} 913 | 914 | {pmore} 915 | Supported plot types are 916 | {helpb twoway_rarea:rarea}, 917 | {helpb twoway_rbar:rbar}, 918 | {helpb twoway_rspike:rspike}, 919 | {helpb twoway_rcap:rcap}, 920 | {helpb twoway_rcapsym:rcapsym}, 921 | {helpb twoway_rscatter:rscatter}, 922 | {helpb twoway_rline:rline}, 923 | {helpb twoway_rconnected:rconnected}, 924 | {helpb twoway_pcspike:pcspike}, 925 | {helpb twoway_pcspike:pccapsym}, 926 | {helpb twoway_pcarrow:pcarrow} (or {cmd:pcrarrow} for the reverse), 927 | {helpb twoway_pcbarrow:pcbarrow}, and 928 | {helpb twoway_pcscatter:pcscatter}. The default {it:plottype} is 929 | {helpb twoway_rspike:rspike}. The chosen plot type affects the available 930 | options within {cmd:ciopts()}. For example, if the plot type is 931 | {helpb twoway_rbar:rbar} then {it:{help barlook_options}} will be 932 | available. See the plot type's help file for details. 933 | 934 | {pmore} 935 | If multiple confidence intervals are requested, then 936 | {it:{help stylelists}} may be specified in the options within 937 | {cmd:ciopts()}. For example, {cmd:recast(rspike rcap ..)} would use 938 | {helpb twoway_rspike:rspike} for the first confidence interval and 939 | {helpb twoway_rcap:rcap} for the remaining confidence intervals; 940 | {cmd:lwidth(thin medium thick)} would use thin lines for the first 941 | confidence interval, medium width lines for the second, and thick lines 942 | for the third. 943 | 944 | {marker cismooth}{...} 945 | {phang} 946 | {cmd:cismooth}[{cmd:(}{it:options}{cmd:)}] adds smoothed confidence 947 | intervals. {it:options} are: 948 | 949 | {p2colset 13 33 35 2}{...} 950 | {p2col:{cmd:n(}{it:n}{cmd:)}}number of (equally spaced) confidence levels; 951 | default is {cmd:n(50)}; levels are placed in steps of 100/{it:n} from 100/2{it:n} to 952 | 100-100/2{it:n} (e.g., 1, 3, 5, ..., 99 for {it:n}=50) 953 | {p_end} 954 | {p2col:{cmdab:lw:idth(}{it:min max}{cmd:)}}set range of 955 | (relative) line widths; the default is {cmd:range(2 15)} 956 | ({it:max} is exact only for {it:n}=50) 957 | {p_end} 958 | {p2col:{cmdab:i:ntensity(}{it:min max}{cmd:)}}set range of 959 | color intensities, as percentages; the default is {cmd:intensity(}{it:min} {cmd:100)} 960 | where {it:min} is determined as 4/(ceil({it:n}/2)+3)*100 (about 14 for n=50) 961 | {p_end} 962 | {p2col:{cmdab:c:olor(}{help colorstyle:{it:color}}{cmd:)}}set the color (without 963 | intensity multiplier); the default color is determined by the graph scheme 964 | {p_end} 965 | {p2col:{cmdab:psty:le(}{help pstyle:{it:pstyle}}{cmd:)}}set the overall style; 966 | this mainly affects the color 967 | {p_end} 968 | {p2colreset}{...} 969 | 970 | {pmore} 971 | The confidence intervals produced by {cmd:cismooth} are placed behind 972 | confidence intervals requested in {helpb coefplot##levels:levels()} and 973 | {helpb coefplot##ci:ci()}. {helpb coefplot##ciopts:ciopts()} do not 974 | apply to them. 975 | 976 | {dlgtab:Subgraph options} 977 | 978 | {marker bylabel}{...} 979 | {phang} 980 | {cmd:bylabel(}{it:string}{cmd:)} provides a label for the subgraph. Use 981 | double quotes to create multiline labels. For example, 982 | {cmd:bylabel("This is a" "long label")} would create a two-line label. For 983 | text effects (bold, italics, greek letters, etc.) use SMCL tags as 984 | described in {it:{help graph_text}}. 985 | 986 | {pmore} 987 | Subgraphs are implemented in terms of {helpb graph}'s {cmd:by()} option; see 988 | {helpb coefplot##byopts:byopts()} below for options on how to combine and 989 | render the subgraphs. 990 | 991 | {dlgtab:Global options} 992 | 993 | {marker horizontal}{...} 994 | {phang} 995 | {cmd:horizontal} places coefficient values on the x axis. This is the 996 | default unless {helpb coefplot##at:at} is specified. 997 | 998 | {marker vertical}{...} 999 | {phang} 1000 | {cmd:vertical} places coefficient values on the y axis. This is the 1001 | default if {helpb coefplot##at:at} is specified. 1002 | 1003 | {marker eqstrict}{...} 1004 | {phang} 1005 | {cmd:eqstrict} causes equation names to be taken into account (i.e. match coefficients by 1006 | equation names and plot equation labels) even if there is only one equation per model. 1007 | 1008 | {marker order}{...} 1009 | {phang} 1010 | {cmd:order(}{it:coeflist}{cmd:)} specifies the order of coefficients 1011 | (not allowed with {helpb coefplot##at:at}). The default is to use 1012 | the order as found in the input models (and place {cmd:_cons} last, within 1013 | equations). {it:coeflist} is a 1014 | space-separated list of elements such as: 1015 | 1016 | {p2colset 13 25 27 2}{...} 1017 | {p2col:{cmd:.}}insert a gap 1018 | {p_end} 1019 | {p2col:{it:eq}{cmd::.}}insert a gap within equation {it:eq} 1020 | {p_end} 1021 | {p2col:{it:coef}}coefficient {it:coef} 1022 | {p_end} 1023 | {p2col:{it:eq}{cmd::}}all coefficients from equation {it:eq}, in their current order 1024 | {p_end} 1025 | {p2col:{it:eq}{cmd::}{it:coef}}coefficient {it:coef} from equation {it:eq} 1026 | {p_end} 1027 | {p2colreset}{...} 1028 | 1029 | {pmore} 1030 | where {it:coef} may contain "{cmd:*}" (any string) and "{cmd:?}" 1031 | (any nonzero character) wildcards. 1032 | 1033 | {pmore} 1034 | If no equations are specified, then the requested order of coefficients 1035 | is repeated within each equation (keeping the existing order of 1036 | equations). Otherwise, the requested order is applied across equations. 1037 | Note that in the later case the first element in {cmd:order()} must be an 1038 | equation name. {it:eq} is applied to all subsequent elements until a 1039 | new {it:eq} is specified. For example, 1040 | {cmd:order(5:weight mpg * 4:turn *)} would yield the following order: 1041 | "{cmd:weight}" from equation "{cmd:5}", "{cmd:mpg}" from equation "{cmd:5}", 1042 | remaining coefficients from equation "{cmd:5}", 1043 | "{cmd:turn}" from equation "{cmd:4}", remaining coefficients from equation 1044 | "{cmd:4}", remaining equations if any. 1045 | 1046 | {marker orderby}{...} 1047 | {phang} 1048 | {cmd:orderby(}[{it:subgraph}{cmd::}][{it:plot}]{cmd:)} orders the 1049 | coefficients by a specific model. By default, the coefficients are ordered 1050 | according to how they are provided to {cmd:coefplot}, with earlier plots 1051 | and subgraphs taking precedence over later ones (and placing {cmd:_cons} 1052 | last). This means that coefficients that only appear in later models will 1053 | be placed after the coefficients that appear in earlier models. Specify the 1054 | {cmd:orderby()} option if you want to change the default behavior and 1055 | arrange the coefficients according to their order in a specific model 1056 | (and, within each equation, place the other coefficients after these coefficients, but 1057 | before {cmd:_cons}). Arguments {it:subgraph} and {it:plot} select the relevant 1058 | model. For example, {cmd:orderby(2:3)} will order coefficients according to 1059 | the model that is displayed in the third plot of the second subgraph. If one 1060 | of the arguments is omitted, it defaults to one. Hence, {cmd:orderby(3)} will 1061 | order the coefficients according to the model displayed in the third plot 1062 | of the first subgraph; {cmd:orderby(2:)} will use the model displayed in the first 1063 | plot of the second subgraph. {cmd:orderby()} will do nothing if a specified subgraph or 1064 | plot does not exist. Furthermore, note that the {it:subgraph} argument 1065 | is not allowed if the {helpb coefplot##norecycle:norecycle} option has been 1066 | specified; plots are numbered uniquely across subgraphs in this case. 1067 | 1068 | {marker sort}{...} 1069 | {phang} 1070 | {cmd:sort}[{cmd:(}{it:spec}{cmd:)}] sorts the coefficients by size. {it:spec} is 1071 | 1072 | [{it:subgraph}{cmd::}][{it:plot}] [, {cmdab:d:escending} {cmd:by(}{it:stat}{cmd:)} ] 1073 | 1074 | {pmore} 1075 | where {it:subgraph} and {it:plot}, being equal to {cmd:.} or a positive 1076 | integer, identify the subgraph and plot to be used 1077 | to establish the sort order. For example, to sort based on all values in 1078 | the second subgraph (possibly including multiple plots), type 1079 | {cmd:sort(2:)} or {cmd:sort(2:.)}; to sort based on all values in the third 1080 | plot (possibly spanning multiple subgraphs), type {cmd:sort(3)} or 1081 | {cmd:sort(.:3)}; to sort based on the values of the third plot in the 1082 | second subgraph, type {cmd:sort(2:3)}. Specifying {cmd:sort} without 1083 | argument is equivalent to {cmd:sort(.:.)}, that is, to sort based on the 1084 | values in all available subgraphs and plots. If you specify a subgraph or 1085 | plot that does not exist, {cmd:sort()} will do nothing. Furthermore, if the 1086 | {helpb coefplot##norecycle:norecycle} option is specified, the {it:subgraph} 1087 | argument can be omitted as the plots will be uniquely numbered across 1088 | subgraphs. 1089 | 1090 | {pmore} 1091 | By default, the coefficients are sorted in ascending order of the values of 1092 | the point estimates. Specify suboption {cmd:descending} to use a 1093 | descending sort order. Furthermore, use {cmd:by(}{it:stat}{cmd:)} to change 1094 | the relevant statistic, where {it:stat} may be: 1095 | 1096 | {p2colset 13 25 27 2}{...} 1097 | {p2col:{cmd:b}}sort by point estimate (the default){p_end} 1098 | {p2col:{cmd:v} (or {cmd:se})}sort by variance (or standard error){p_end} 1099 | {p2col:{cmd:t}}sort by t (or z) statistic{p_end} 1100 | {p2col:{cmd:tabs}}sort by absolute t (or z) statistic{p_end} 1101 | {p2col:{cmd:p}}sort by p-value{p_end} 1102 | {p2col:{cmd:df}}sort by degrees of freedom{p_end} 1103 | {p2col:{cmd:ll} [#]}sort by (#th) lower confidence limit; # defaults to 1{p_end} 1104 | {p2col:{cmd:ul} [#]}sort by (#th) upper confidence limit; # defaults to 1{p_end} 1105 | {p2col:{cmd:aux} [#]}sort by (#th) auxiliary variable (see the 1106 | {helpb coefplot##aux:aux()} option); # defaults to 1{p_end} 1107 | {p2colreset}{...} 1108 | 1109 | {pmore} 1110 | In case of multiple equations, coefficients will be sorted separately 1111 | within each equation, keeping the original order of equations. Use the 1112 | {helpb coefplot##order:order()} option the change the order of the equations. 1113 | 1114 | {marker relocate}{...} 1115 | {phang} 1116 | {cmd:relocate(}{it:spec}{cmd:)} assigns specific positions to the 1117 | coefficients on the category axis. {it:spec} is: 1118 | 1119 | [{it:eq}{cmd::}]{it:coef} {cmd:=} # [[{it:eq}{cmd::}]{it:coef} {cmd:=} # ...] 1120 | 1121 | {pmore} 1122 | where {it:eq} and {it:coef} may contain "{cmd:*}" (any string) and 1123 | "{cmd:?}" (any nonzero character) wildcards. If {helpb coefplot##bycoefs:bycoefs} is 1124 | specified, use numbers (1, 2, ...) instead of {it:eq} and {it:coef} 1125 | to address the elements on the categorical axis. 1126 | 1127 | {pmore}The default for {cmd:coefplot} is to place coefficients 1128 | at integer values 1, 2, 3, ... (from top to bottom in horizontal mode, 1129 | from left to right in vertical mode). The {cmd:relocate()} option gives 1130 | you the possibility to specify alternative values. If, for example, you 1131 | want to place coefficient {cmd:mpg} at value 2.5 on the category axis, you 1132 | could type {cmd:relocate(mpg = 2.5)}. If you only want to change the 1133 | order of coefficients and are fine with integer positions, then use the 1134 | {helpb coefplot##order:order()} option. Note that the specified positions 1135 | are assigned before inserting gaps between equations, headings, and 1136 | groups (see {helpb coefplot##eqlabels:eqlabels()}, 1137 | {helpb coefplot##headings:headings()}, and 1138 | {helpb coefplot##groups:groups()}). Hence, the final plot positions might 1139 | deviate from the specified positions if there are equation labels, headings, 1140 | or group labels. 1141 | 1142 | {marker bycoefs}{...} 1143 | {phang} 1144 | {cmd:bycoefs} flips subgraphs and coefficients (not allowed with 1145 | {helpb coefplot##at:at}). If {cmd:bycoefs} is specified, a 1146 | separate subgraph is produced for each coefficient. In this 1147 | case, use integer numbers (1, 2, ...) instead of coefficient names 1148 | to address the elements on the categorical axis within options 1149 | {helpb coefplot##relocate:relocate()}, 1150 | {helpb coefplot##headings:headings()}, and 1151 | {helpb coefplot##groups:groups()}. 1152 | 1153 | {marker norecycle}{...} 1154 | {phang} 1155 | {cmd:norecycle} increments plot styles across subgraphs. The default is 1156 | to start over with each new subgraph. 1157 | 1158 | {marker nooffsets}{...} 1159 | {phang} 1160 | {cmd:nooffsets} suppresses automatic offsets for plot positions. 1161 | 1162 | {marker format}{...} 1163 | {phang} 1164 | {cmd:format(}{it:format}{cmd:)} sets the display format for 1165 | coefficients. This affects the rendition of the axis and marker 1166 | labels. {it:format} may be a numeric format or a date format 1167 | (see help {helpb format}). 1168 | 1169 | {marker pnum}{...} 1170 | {phang} 1171 | {cmd:p{it:#}(}{help coefplot##plotopts:{it:plotopts}}{cmd:)} specifies 1172 | options for the {it:#}th plot. For example, type {cmd:p2(nokey)} to exclude 1173 | plot 2 from the legend (see {helpb coefplot##nokey:nokey}). Use the {cmd:p#()} 1174 | options as an alternative to specifying options directly within a plot; in 1175 | case of conflict, options specified within a plot take precedence 1176 | over options specified via {cmd:p#()}. 1177 | 1178 | {marker nolabels}{...} 1179 | {phang} 1180 | {cmd:nolabels} causes coefficient names to be used as labels instead of 1181 | variable labels or value labels. 1182 | 1183 | {marker coeflabels}{...} 1184 | {phang} 1185 | {cmd:coeflabels(}{it:spec}{cmd:)} specifies custom labels for 1186 | coefficients (not allowed with {helpb coefplot##at:at}). {it:spec} is 1187 | 1188 | {p 12 14 2} 1189 | [{it:coeflist} {cmd:=} {cmd:"}{it:label}{cmd:"} [{it:coeflist} {cmd:=} {cmd:"}{it:label}{cmd:"} ...]] 1190 | [{cmd:,} {cmdab:t:runcate(}#{cmd:)} {cmdab:w:rap(}#{cmd:)} {cmdab:nob:reak} 1191 | {cmdab:i:nteraction(}{it:string}{cmd:)} 1192 | {it:{help axis_label_options:suboptions}}] 1193 | 1194 | {pmore} 1195 | with {it:coeflist} as above for {helpb coefplot##keep:keep()}. Enclose 1196 | {it:label} in double quotes 1197 | if it contains spaces, e.g. {bind:{cmd:coeflabels(foreign = "Car Type")}}. 1198 | Enclose {it:label} in compound double quotes to create a multiline 1199 | label, e.g. {bind:{cmd:coeflabels(foreign = `""This is a" "long label""')}}; 1200 | alternatively, apply the {cmd:wrap()} option. For text effects 1201 | (bold, italics, greek letters, etc.) use SMCL tags as described in 1202 | {it:{help graph_text}}. 1203 | 1204 | {pmore} 1205 | Option {cmd:truncate(}#{cmd:)} truncates coefficient labels to 1206 | a maximum length of # characters. Option {cmd:wrap(}#{cmd:)} divides 1207 | coefficient labels into multiple lines, where each line has a maximum 1208 | length of # characters. {cmd:truncate()} and {cmd:wrap()} operate on 1209 | words. That is, they try to fill to the maximum length without breaking 1210 | in the middle of a word. However, if a word is longer than # characters, 1211 | it will be split or truncated. Specify {cmd:nobreak} to prevent 1212 | {cmd:truncate()} and {cmd:wrap()} from splitting or truncating words 1213 | that are longer than # characters. If {cmd:truncate()} and {cmd:wrap()} 1214 | are both specified, {cmd:truncate()} is applied first. 1215 | {cmdab:interaction()} specifies the string to be used as 1216 | delimiter in labels for interaction terms; the default is 1217 | {cmd:interaction(" # ")}. {it:suboptions} are axis label suboptions as 1218 | described in {it:{help axis_label_options}}. 1219 | 1220 | {pmore} 1221 | Note: Labels containing multiple lines are left unchanged by {cmd:truncate()} 1222 | and {cmd:wrap()}. Therefore, if you don't like how {cmd:wrap()} breaks a 1223 | specific label, you can provide a custom variant of it in {cmd:coeflabels()} 1224 | while still using {cmd:wrap()} for the other labels. {cmd:truncate()} 1225 | and {cmd:wrap()} may fail to process a label if it contains compound 1226 | double quotes; the label will be left unchanged in this case. 1227 | 1228 | {marker noeqlabels}{...} 1229 | {phang} 1230 | {cmd:noeqlabels} suppresses equation labels. 1231 | 1232 | {marker eqlabels}{...} 1233 | {phang} 1234 | {cmd:eqlabels(}{it:spec}{cmd:)} specifies custom labels for equations, one after 1235 | the other (not allowed with {helpb coefplot##at:at}). {it:spec} is: 1236 | 1237 | {p 12 14 2} 1238 | [{cmd:"}{it:label}{cmd:"} [{cmd:"}{it:label}{cmd:"} ...]] [{cmd:,} 1239 | {cmdab:lab:els}[{cmd:(}{it:string}{cmd:)}] 1240 | [{cmd:{ul:no}}]{cmdab:g:ap}[{cmd:(}#{cmd:)}] {cmdab:ashead:ings} 1241 | {cmdab:off:set(}#{cmd:)} {cmdab:t:runcate(}#{cmd:)} {cmdab:w:rap(}#{cmd:)} 1242 | {cmdab:nob:reak} {it:{help axis_label_options:suboptions}} ] 1243 | 1244 | {pmore} 1245 | Enclose labels in double quotes if they contain spaces, 1246 | e.g. {bind:{cmd:eqlabels("EQ one" "EQ two")}}. Enclose labels in compound 1247 | double quotes to create multiline labels, 1248 | e.g. {bind:{cmd:eqlabels(`""This is a" "long label""')}}. Alternatively, 1249 | apply the {cmd:wrap()} option. For text effects 1250 | (bold, italics, greek letters, etc.) use SMCL tags as described in 1251 | {it:{help graph_text}}. 1252 | 1253 | {pmore} 1254 | Option {cmd:label} causes the equation names to be treated as 1255 | variable names; {cmd:coefplot} will then use the corresponding variable labels 1256 | (and, depending on context, value labels) to label the equations. Specify 1257 | {cmd:label(}{it:string}{cmd:)} to set the string to be used as 1258 | delimiter in labels for interaction terms; typing {cmd:label} without argument 1259 | is equivalent to {cmd:label(" # ")}. {cmd:gap()} specifies the size of the 1260 | gap between equations. The 1261 | default is {cmd:gap(1)}. {cmd:nogap} suppresses the gap between 1262 | equations. {cmdab:asheadings} treats equation labels as headings; 1263 | see {helpb coefplot##headings:headings()}. {cmd:offset()}, only 1264 | allowed with {cmd:asheadings}, offsets the labels. {cmd:truncate()}, 1265 | {cmd:wrap()}, {cmd:nobreak}, and {it:suboptions} are as above for 1266 | {helpb coefplot##coeflabels:coeflabels()}. 1267 | 1268 | {marker headings}{...} 1269 | {phang} 1270 | {cmd:headings(}{it:spec}{cmd:)} adds headings between 1271 | coefficients (not allowed with {helpb coefplot##at:at}). {it:spec} is: 1272 | 1273 | {p 12 14 2} 1274 | {it:coeflist} {cmd:=} {cmd:"}{it:label}{cmd:"} [{it:coeflist} {cmd:=} {cmd:"}{it:label}{cmd:"} ...] 1275 | [{cmd:,} [{cmd:{ul:no}}]{cmdab:g:ap}[{cmd:(}#{cmd:)}] 1276 | {cmdab:off:set(}#{cmd:)} {cmdab:t:runcate(}#{cmd:)} 1277 | {cmdab:w:rap(}#{cmd:)} {cmdab:nob:reak} 1278 | {it:{help axis_label_options:suboptions}} ] 1279 | 1280 | {pmore} 1281 | with {it:coeflist} as above for {helpb coefplot##keep:keep()}. If 1282 | {helpb coefplot##bycoefs:bycoefs} is specified, use numbers 1, 2, 1283 | ... instead of {it:coeflist} to address the elements on the categorical 1284 | axis. Enclose {it:label} in double quotes if it contains 1285 | spaces. For example, {bind:{cmd:headings(0.foreign = "Car Type")}} will 1286 | print the heading "{cmd:Car Type}" before coefficient "{cmd:0.foreign}". 1287 | Enclose {it:label} in compound double quotes to create a multiline 1288 | label, e.g. {bind:{cmd:headings(foreign = `""This is a" "long heading""')}}. 1289 | Alternatively, apply the {cmd:wrap()} option. For text effects (bold, 1290 | italics, greek letters, etc.) use SMCL tags as 1291 | described in {it:{help graph_text}}. 1292 | 1293 | {pmore} 1294 | {cmd:gap()} and {cmdab:offset()} are as above for 1295 | {helpb coefplot##eqlabels:eqlabels()}. {cmd:truncate()}, {cmd:wrap()}, 1296 | {cmd:nobreak}, and {it:suboptions} are as above for 1297 | {helpb coefplot##coeflabels:coeflabels()}. 1298 | 1299 | {marker groups}{...} 1300 | {phang} 1301 | {cmd:groups(}{it:spec}{cmd:)} adds labels for groups of 1302 | coefficients (not allowed with {helpb coefplot##at:at}). The specified 1303 | label will be printed beside (or, in vertical mode, below) the identified 1304 | group of coefficients. {it:spec} is: 1305 | 1306 | {p 12 14 2} 1307 | {it:coeflist} {cmd:=} {cmd:"}{it:label}{cmd:"} [{it:coeflist} {cmd:=} {cmd:"}{it:label}{cmd:"} ...] 1308 | [{cmd:,} [{cmd:{ul:no}}]{cmdab:g:ap}[{cmd:(}#{cmd:)}] 1309 | {cmdab:t:runcate(}#{cmd:)} {cmdab:w:rap(}#{cmd:)} 1310 | {cmdab:nob:reak} {it:{help axis_label_options:suboptions}} ] 1311 | 1312 | {pmore} 1313 | with {it:coeflist} as above for {helpb coefplot##keep:keep()}. If 1314 | {helpb coefplot##bycoefs:bycoefs} is specified, use numbers 1, 2, 1315 | ... instead of {it:coeflist} to address the elements on the categorical 1316 | axis. Enclose {it:label} in double quotes if 1317 | it contains spaces. Enclose {it:label} in compound double quotes to create 1318 | a multiline label. Alternatively, apply the {cmd:wrap()} option. For text 1319 | effects (bold, italics, greek letters, etc.) use SMCL tags as described in 1320 | {it:{help graph_text}}. 1321 | 1322 | {pmore} 1323 | {cmd:gap()} is as above for 1324 | {helpb coefplot##eqlabels:eqlabels()}. {cmd:truncate()}, {cmd:wrap()}, 1325 | {cmd:nobreak}, and {it:suboptions} are as above for 1326 | {helpb coefplot##coeflabels:coeflabels()}. 1327 | 1328 | {marker plotlabels}{...} 1329 | {phang} 1330 | {cmd:plotlabels(}{it:spec}{cmd:)} specifies labels for the plots to be 1331 | used in the legend. Labels specified via {cmd:plotlabels()} 1332 | take precedence over labels specified in the 1333 | {helpb coefplot##label:label()} plot option. {it:spec} is: 1334 | 1335 | {p 12 14 2} 1336 | [{cmd:"}{it:label}{cmd:"} [{cmd:"}{it:label}{cmd:"} ...]] [{cmd:,} {cmdab:t:runcate(}#{cmd:)} 1337 | {cmdab:w:rap(}#{cmd:)} {cmdab:nob:reak} ] 1338 | 1339 | {pmore} 1340 | Enclose labels in double quotes if they contain spaces. Enclose labels in 1341 | compound double quotes to create multiline labels. Alternatively, 1342 | apply the {cmd:wrap()} option. For text effects 1343 | (bold, italics, greek letters, etc.) use SMCL tags as described in 1344 | {it:{help graph_text}}. Options {cmd:truncate()}, {cmd:wrap()}, and {cmd:nobreak} are as 1345 | above for {helpb coefplot##coeflabels:coeflabels()}. 1346 | 1347 | {marker bylabels}{...} 1348 | {phang} 1349 | {cmd:bylabels(}{it:spec}{cmd:)} specifies labels for the subgraphs. Labels 1350 | specified via {cmd:bylabels()} 1351 | take precedence over labels specified in the 1352 | {helpb coefplot##bylabel:bylabel()} subgraph option. {it:spec} is: 1353 | 1354 | {p 12 14 2} 1355 | [{cmd:"}{it:label}{cmd:"} [{cmd:"}{it:label}{cmd:"} ...]] [{cmd:,} {cmdab:t:runcate(}#{cmd:)} 1356 | {cmdab:w:rap(}#{cmd:)} {cmdab:nob:reak} ] 1357 | 1358 | {pmore} 1359 | Enclose labels in double quotes if they contain spaces. Enclose labels in 1360 | compound double quotes to create multiline labels. Alternatively, 1361 | apply the {cmd:wrap()} option. For text effects 1362 | (bold, italics, greek letters, etc.) use SMCL tags as described in 1363 | {it:{help graph_text}}. Options {cmd:truncate()}, {cmd:wrap()}, and {cmd:nobreak} are as 1364 | above for {helpb coefplot##coeflabels:coeflabels()}. 1365 | 1366 | {marker grid}{...} 1367 | {phang} 1368 | {cmd:grid(}{it:options}{cmd:)} affects the rendition of grid lines on the 1369 | category axis (not allowed with {helpb coefplot##at:at}). {it:options} are: 1370 | 1371 | {p 12 14 2} 1372 | { {cmdab:b:etween} | {cmdab:w:ithin} | {cmdab:n:one} } {it:{help axis_label_options:suboptions}} 1373 | 1374 | {pmore} 1375 | {cmdab:b:etween} places grid lines between coefficient labels; 1376 | {cmdab:w:ithin} places grid lines at the center of coefficient labels; 1377 | {cmdab:n:one} suppress grid lines. {it:suboptions} are axis label suboptions 1378 | as described in {it:{help axis_label_options}}. In horizontal mode, the 1379 | default is {cmd:within} for single plots and {cmd:between} for multiple 1380 | plots. In vertical mode, the default is {cmd:none}. Alternatively, use 1381 | {helpb axis_label_options:ytick()} and {helpb axis_label_options:xtick()} 1382 | to set grid lines. 1383 | 1384 | {marker generate}{...} 1385 | {phang} 1386 | {cmd:generate}[{cmd:(}{it:prefix}{cmd:)}] generates variables containing 1387 | the graph data. The variable names will be prefixed by "{cmd:__}" 1388 | or as specified by {it:prefix}. {cmd:generate()} implies 1389 | {helpb coefplot##nodrop:nodrop} and can make {cmd:coefplot} slow in large 1390 | datasets. 1391 | 1392 | {marker replace}{...} 1393 | {phang} 1394 | {cmd:replace} allows {cmd:coefplot} to overwrite existing variables. 1395 | 1396 | {marker addplot}{...} 1397 | {phang} 1398 | {cmd:addplot(}{it:plot}{cmd:)} adds other plots to the graph. See help 1399 | {it:{help addplot_option}}. By default {cmd:coefplot} does not keep the 1400 | original data so that {cmd:addplot()} has access only to data from 1401 | {help coefplot##tempvar:internal temporary variables}. Specify 1402 | {helpb coefplot##nodrop:nodrop} to keep the original data. 1403 | 1404 | {marker nodrop}{...} 1405 | {phang} 1406 | {cmd:nodrop} causes {cmd:coefplot} to keep the original data when generating 1407 | the graph. The default is to eliminate all existing observations temporarily 1408 | to increase speed. {cmd:nodrop} may be useful in connection with the 1409 | {helpb coefplot##addplot:addplot()} option (unless the graph contains 1410 | multiple subgraphs). 1411 | 1412 | {phang} 1413 | {it:twoway_options} are general twoway options, other than 1414 | {cmd:by()}, as documented in help {it:{help twoway_options}}. 1415 | 1416 | {marker byopts}{...} 1417 | {phang} 1418 | {cmd:byopts(}{it:byopts}{cmd:)} determines how subgraphs 1419 | are combined. {it:byopts} are as described in help {it:{help by_option}}. 1420 | 1421 | 1422 | {marker examples}{...} 1423 | {title:Examples} 1424 | 1425 | . {stata sysuse auto} 1426 | . {stata regress price mpg headroom trunk length turn} 1427 | . {stata coefplot, drop(_cons) xline(0)} 1428 | 1429 | . {stata regress price mpg headroom trunk length turn if foreign==0} 1430 | . {stata estimates store domestic} 1431 | . {stata regress price mpg headroom trunk length turn if foreign==1} 1432 | . {stata estimates store foreign} 1433 | . {stata coefplot domestic foreign, drop(_cons) xline(0)} 1434 | 1435 | . {stata coefplot domestic || foreign, drop(_cons) xline(0)} 1436 | 1437 | . {stata coefplot domestic || foreign, yline(0) bycoefs vertical byopts(yrescale)} 1438 | 1439 | {pstd} 1440 | For further examples see the {browse "http://repec.sowi.unibe.ch/stata/coefplot":website}, 1441 | the {browse "http://www.stata-journal.com/article.html?article=gr0059":Stata Journal article}, or the 1442 | {browse "http://ideas.repec.org/p/bss/wpaper/1.html":working paper}. 1443 | 1444 | 1445 | {marker remarks}{...} 1446 | {title:Remarks} 1447 | 1448 | {pstd} 1449 | Remarks are presented under the following headings: 1450 | 1451 | {help coefplot##wildcards:Using wildcards in model names} 1452 | {help coefplot##place:Placement of options} 1453 | {help coefplot##matrix:Plotting results from matrices} 1454 | {help coefplot##tempvar:Accessing internal temporary variables} 1455 | 1456 | 1457 | {marker wildcards}{...} 1458 | {title:Using wildcards in model names} 1459 | 1460 | {pstd} 1461 | Instead of providing distinct model names to {cmd:coefplot}, you can also 1462 | specify a name pattern containing {cmd:*} (any string) 1463 | and {cmd:?} (any nonzero character) wildcards. {cmd:coefplot} 1464 | will then plot the results from all matching 1465 | models. If a name pattern is specified as part of a plot delimited by 1466 | parentheses, the results from the matching models will be combined into the 1467 | same plot. For example, if models {cmd:est11}, {cmd:est12}, {cmd:est13}, 1468 | {cmd:est21}, {cmd:est22}, and {cmd:est23} are in 1469 | memory, typing 1470 | 1471 | {com}{...} 1472 | . coefplot (est1*, {txt:{it:opts1}}) (est2*, {txt:{it:opts2}}) 1473 | {txt}{...} 1474 | 1475 | {pstd} 1476 | is equivalent to 1477 | 1478 | {com}{...} 1479 | . coefplot (est11 est12 est13, {txt:{it:opts1}}) (est21 est22 est23, {txt:{it:opts2}}) 1480 | {txt}{...} 1481 | 1482 | {pstd} 1483 | Likewise, typing 1484 | 1485 | {com}{...} 1486 | . coefplot (est*1, {txt:{it:opts1}} \ est*2, {txt:{it:opts2}} \, {txt:{it:opts3}}) 1487 | {txt}{...} 1488 | 1489 | {pstd} 1490 | is equivalent to 1491 | 1492 | {com}{...} 1493 | . coefplot (est11 est21, {txt:{it:opts1}} \ est12 est22, {txt:{it:opts2}} \, {txt:{it:opts3}}) 1494 | {txt}{...} 1495 | 1496 | {pstd} 1497 | If a name pattern is specified without parentheses, 1498 | the matching models are treated as separate plots. For example, typing 1499 | 1500 | {com}{...} 1501 | . coefplot est1* || est2* 1502 | {txt}{...} 1503 | 1504 | {pstd} 1505 | is equivalent to 1506 | 1507 | {com}{...} 1508 | . coefplot est11 est12 est13 || est21 est22 est23 1509 | {txt}{...} 1510 | 1511 | {pstd} 1512 | or 1513 | 1514 | {com}{...} 1515 | . coefplot (est11) (est12) (est13) || (est21) (est22) (est23) 1516 | {txt}{...} 1517 | 1518 | {pstd} 1519 | Use global options {helpb coefplot##pnum:p1()}, {helpb coefplot##pnum:p2()}, 1520 | etc. to provide specific options to the different plots in this case. For 1521 | example, typing 1522 | 1523 | {com}{...} 1524 | . coefplot est1*, p1({txt:{it:opts1}}) p2({txt:{it:opts2}}) p3({txt:{it:opts3}}) 1525 | {txt}{...} 1526 | 1527 | {pstd} 1528 | is equivalent to 1529 | 1530 | {com}{...} 1531 | . coefplot (est11, {txt:{it:opts1}}) (est12, {txt:{it:opts2}}) (est13, {txt:{it:opts3}}) 1532 | {txt}{...} 1533 | 1534 | 1535 | {marker place}{...} 1536 | {title:Placement of options} 1537 | 1538 | {pstd} 1539 | {cmd:coefplot} has four levels of options: 1540 | 1541 | {phang}(1) {help coefplot##modelopts:{it:modelopts}} are options that apply to a single 1542 | model (or matrix). They specify the information to be displayed. 1543 | 1544 | {phang}(2) {help coefplot##plotopts:{it:plotopts}} are options that apply to a single 1545 | plot, possibly containing results from multiple models. They affect 1546 | the rendition of markers and confidence intervals and provide a label 1547 | for the plot. 1548 | 1549 | {phang}(3) {help coefplot##subgropts:{it:subgropts}} are options that 1550 | apply to a single subgraph, possibly containing multiple plots. 1551 | 1552 | {phang}(4) {help coefplot##globalopts:{it:globalopts}} are options that apply 1553 | to the overall graph. 1554 | 1555 | {pstd} 1556 | The levels are nested in the sense that upper level options include all 1557 | lower level options. That is, 1558 | {help coefplot##globalopts:{it:globalopts}} includes 1559 | {help coefplot##subgropts:{it:subgropts}}, 1560 | {help coefplot##plotopts:{it:plotopts}}, and 1561 | {help coefplot##modelopts:{it:modelopts}}; 1562 | {help coefplot##subgropts:{it:subgropts}} includes 1563 | {help coefplot##plotopts:{it:plotopts}}, and 1564 | {help coefplot##modelopts:{it:modelopts}}; 1565 | {help coefplot##plotopts:{it:plotopts}} includes 1566 | {help coefplot##modelopts:{it:modelopts}}. However, upper level options 1567 | may not be specified at a lower level. 1568 | 1569 | {pstd} 1570 | If lower level options are specified at an upper level, they serve as 1571 | defaults for all included lower levels elements. For example, if you want 1572 | to draw 99% and 95% confidence intervals for all included models, 1573 | specify {cmd:levels(99 95)} as global option: 1574 | 1575 | {com}{...} 1576 | . coefplot model1 model2 model3, levels(99 95) 1577 | {txt}{...} 1578 | 1579 | {pstd} 1580 | Options specified with an individual element override the defaults set 1581 | by upper level options. For example, if you want to draw 99% and 95% 1582 | confidence intervals for model 1 and model 2 and 90% confidence intervals 1583 | for model 3, you could type: 1584 | 1585 | {com}{...} 1586 | . coefplot model1 model2 (model3, level(90)), levels(99 95) 1587 | {txt}{...} 1588 | 1589 | {pstd} 1590 | There are some fine distinctions about the placement of options and how they 1591 | are interpreted. For example, if you type 1592 | 1593 | {com}{...} 1594 | . coefplot m1, {txt:{it:opts1}} || m2, {txt:{it:opts2}} {txt:{it:opts3}} 1595 | {txt}{...} 1596 | 1597 | {pstd} 1598 | then {it:opts2} and {it:opts3} are interpreted as global options. If you 1599 | want to apply {it:opts2} only to {cmd:m2} then type 1600 | 1601 | {com}{...} 1602 | . coefplot m1, {txt:{it:opts1}} || m2, {txt:{it:opts2}} ||, {txt:{it:opts3}} 1603 | {txt}{...} 1604 | 1605 | {pstd} 1606 | Similarly, if you type 1607 | 1608 | {com}{...} 1609 | . coefplot (m1, {txt:{it:opts1}} \ m2, {txt:{it:opts2}}) 1610 | {txt}{...} 1611 | 1612 | {pstd} 1613 | then {it:opts2} will be applied to both models. To apply {it:opts2} only to 1614 | {cmd:m2} type 1615 | 1616 | {com}{...} 1617 | . coefplot (m1, {txt:{it:opts1}} \ m2, {txt:{it:opts2}} \) 1618 | {txt}{...} 1619 | 1620 | {pstd} 1621 | or, if you also want to include {it:opts3} to be applied to both models, 1622 | type 1623 | 1624 | {com}{...} 1625 | . coefplot (m1, {txt:{it:opts1}} \ m2, {txt:{it:opts2}} \, {txt:{it:opts3}}) 1626 | {txt}{...} 1627 | 1628 | {pstd} 1629 | or 1630 | 1631 | {com}{...} 1632 | . coefplot (m1, {txt:{it:opts1}} \ m2, {txt:{it:opts2}} \), {txt:{it:opts3}} 1633 | {txt}{...} 1634 | 1635 | {pstd} 1636 | In case of multiple subgraphs there is some ambiguity about where to 1637 | specify the plot options (unless global option 1638 | {helpb coefplot##norecycle:norecycle} is specified). You can provide plot 1639 | options within any of the subgraphs as plot options are collected across 1640 | subgraphs. However, in case of conflict, the plot options from the rightmost 1641 | subgraph usually take precedence over earlier plot options. In addition, 1642 | you can also use global options {helpb coefplot##pnum:p1()}, 1643 | {helpb coefplot##pnum:p2()}, etc. to provide 1644 | options for specific plots. In case of conflict, options specified within a plot take 1645 | precedence over options provided via {helpb coefplot##pnum:p1()}, 1646 | {helpb coefplot##pnum:p2()}, etc. 1647 | 1648 | {marker matrix}{...} 1649 | {title:Plotting results from matrices} 1650 | 1651 | {pstd} 1652 | Use syntax {helpb coefplot##matrix:{ul:m}atrix({it:mspec})} instead of the 1653 | name of a stored model to plot results from a matrix. {it:mspec} may be: 1654 | 1655 | {p2colset 9 21 23 2}{...} 1656 | {p2col:{it:name}}use first row of matrix {it:name} 1657 | {p_end} 1658 | {p2col:{it:name}{cmd:[}#{cmd:,.]}}use #th row of 1659 | matrix {it:name}; may also type {it:name}{cmd:[}#{cmd:,]} or 1660 | {it:name}{cmd:[}#{cmd:]} 1661 | {p_end} 1662 | {p2col:{it:name}{cmd:[.,}#{cmd:]}}use #th column of 1663 | matrix {it:name}; may also type {it:name}{cmd:[,}#{cmd:]} 1664 | {p_end} 1665 | {p2colreset}{...} 1666 | 1667 | {pstd} 1668 | If the {cmd:matrix()} syntax is used, then option {helpb coefplot##b:b()} is discarded 1669 | and names given in {helpb coefplot##at:at()}, {helpb coefplot##ci:ci()}, 1670 | {helpb coefplot##v:v()}, {helpb coefplot##se:se()}, 1671 | {helpb coefplot##df:df()}, and {helpb coefplot##aux:aux()} refer to regular 1672 | matrices instead of {cmd:e()}-matrices. The matrix name may be omitted in these 1673 | options if results are to be read from the same matrix; only the 1674 | relevant row or column numbers have to be provided in this case (whether the 1675 | numbers are interpreted as row or column numbers 1676 | depends in how {cmd:matrix()} was specified). 1677 | 1678 | {pstd} 1679 | For example, to plot medians and their confidence intervals as computed 1680 | by {helpb centile} you could type: 1681 | 1682 | {com}{...} 1683 | sysuse auto, clear 1684 | matrix C = J(3,3,.) 1685 | matrix rownames C = median ll95 ul95 1686 | matrix colnames C = mpg trunk turn 1687 | local i 0 1688 | foreach v of var mpg trunk turn { 1689 | local ++ i 1690 | centile `v' 1691 | matrix C[1,`i'] = r(c_1) \ r(lb_1) \ r(ub_1) 1692 | } 1693 | matrix list C 1694 | coefplot matrix(C), ci((2 3)) 1695 | {txt}{...} 1696 | 1697 | {pstd} 1698 | This is equivalent to: 1699 | 1700 | {com}{...} 1701 | coefplot matrix(C[1]), ci((C[2] C[3])) 1702 | {txt}{...} 1703 | 1704 | {pstd} 1705 | Note that a single {cmd:coefplot} command can contain both regular syntax 1706 | and {cmd:matrix()} syntax. For example, to add means to the graph above 1707 | you could type: 1708 | 1709 | {com}{...} 1710 | mean mpg trunk turn 1711 | estimates store mean 1712 | coefplot (matrix(C), ci((2 3))) (mean) 1713 | {txt}{...} 1714 | 1715 | 1716 | {marker tempvar}{...} 1717 | {title:Accessing internal temporary variables} 1718 | 1719 | {pstd} 1720 | {cmd:coefplot} maintains a number of internal variables that can be 1721 | used within 1722 | {helpb coefplot##ifopt:if()}, 1723 | {helpb coefplot##weight:weight()}, 1724 | {helpb coefplot##transform:transform()}, 1725 | {helpb marker_label_options:mlabel()}, 1726 | {helpb marker_label_options:mlabvposition()}, and 1727 | {helpb coefplot##addplot:addplot()}. These 1728 | variables are: 1729 | 1730 | {p2colset 9 21 23 2}{...} 1731 | {p2col:{cmd:@b}}point estimates 1732 | {p_end} 1733 | {p2col:{cmd:@ll}#}lower limits of confidence interval # (may use {cmd:@ll} for {cmd:@ll1}) 1734 | {p_end} 1735 | {p2col:{cmd:@ul}#}upper limits of confidence interval # (may use {cmd:@ul} for {cmd:@ul1}) 1736 | {p_end} 1737 | {p2col:{cmd:@V}}variances 1738 | {p_end} 1739 | {p2col:{cmd:@se}}standard errors 1740 | {p_end} 1741 | {p2col:{cmd:@t}}t or z statistics, computed as @b/@se 1742 | {p_end} 1743 | {p2col:{cmd:@df}}degrees of freedom 1744 | {p_end} 1745 | {p2col:{cmd:@pval}}p-values, computed as (1-normal(|@t|))*2 or ttail(@df,|@t|)*2, depending 1746 | on whether df are available 1747 | {p_end} 1748 | {p2col:{cmd:@at}}plot positions 1749 | {p_end} 1750 | {p2col:{cmd:@plot}}plot ID (labeled) 1751 | {p_end} 1752 | {p2col:{cmd:@by}}subgraph ID (labeled) 1753 | {p_end} 1754 | {p2col:{cmd:@mlbl}}Marker labels set by {helpb coefplot##mlabels:mlabels()} (string variable) 1755 | {p_end} 1756 | {p2col:{cmd:@mlpos}}Marker label positions set by {helpb coefplot##mlabels:mlabels()} 1757 | {p_end} 1758 | {p2col:{cmd:@aux}#}auxiliary variables collected by {helpb coefplot##aux:aux()} (may use {cmd:@aux} for {cmd:@aux1}) 1759 | {p_end} 1760 | {p2colreset}{...} 1761 | 1762 | {pstd} 1763 | The internal variables can be used like other variables in the 1764 | dataset. For example, option {cmd:mlabel(@plot)} would add plot labels as marker 1765 | labels or option {cmd:addplot(line @at @b)} would draw a connecting line 1766 | through all point estimates in the graph. 1767 | 1768 | 1769 | {marker saved_results}{...} 1770 | {title:Saved results} 1771 | 1772 | {pstd} 1773 | {cmd:coefplot} returns the following macros and scalars in {cmd:r()}: 1774 | 1775 | {synoptset 20 tabbed}{...} 1776 | {p2col 5 20 24 2: Scalars}{p_end} 1777 | {synopt:{cmd:r(n_ci)}}number of confidence intervals{p_end} 1778 | {synopt:{cmd:r(n_plot)}}number of plots{p_end} 1779 | {synopt:{cmd:r(n_subgr)}}number of subgraphs{p_end} 1780 | 1781 | {synoptset 20 tabbed}{...} 1782 | {p2col 5 20 24 2: Macros}{p_end} 1783 | {synopt:{cmd:r(graph)}}copy of graph command{p_end} 1784 | {synopt:{cmd:r(labels)}}coefficient labels{p_end} 1785 | {synopt:{cmd:r(eqlabels)}}equation labels{p_end} 1786 | {synopt:{cmd:r(groups)}}group labels{p_end} 1787 | {synopt:{cmd:r(headings)}}headings{p_end} 1788 | {synopt:{cmd:r(legend)}}contents of legend option{p_end} 1789 | 1790 | 1791 | {marker author}{...} 1792 | {title:Author} 1793 | 1794 | {pstd} 1795 | Ben Jann, University of Bern, ben.jann@unibe.ch 1796 | 1797 | {pstd} 1798 | Thanks for citing this software in one of the following ways: 1799 | 1800 | {pmore} 1801 | Jann, B. (2014). Plotting regression coefficients and other 1802 | estimates. The Stata Journal 14(4): 708-737. 1803 | 1804 | {pmore} 1805 | Jann, B. (2013). Plotting regression coefficients and other estimates 1806 | in Stata. University of Bern Social Sciences Working Papers 1807 | Nr. 1. Available from 1808 | {browse "http://ideas.repec.org/p/bss/wpaper/1.html"}. 1809 | 1810 | {pmore} 1811 | Jann, B. (2013). coefplot: Stata module to plot regression coefficients 1812 | and other results. Available from 1813 | {browse "http://ideas.repec.org/c/boc/bocode/s457686.html"}. 1814 | 1815 | 1816 | -------------------------------------------------------------------------------- /stata.toc: -------------------------------------------------------------------------------- 1 | v 3 2 | p coefplot module for plotting regression coefficients and other results 3 | --------------------------------------------------------------------------------