An exploratory graphic investigating a binary endpoint
graphbinary varlist , [ sort(graph_options) legend(string) or rr size( relativesize) level(#) graph_combine_options ]
This command creates an exploratory graphic looking at relationships between a binary dependent variable against several explanatory variables. Explanatory variables that have more than 2 values will be dichotomised by its median. When the median is equal to the minimum value this variable will be excluded from the graphic.
The graphic consists of two panels, the percentage of people that are coded 1 for the dependent variable for each level of the explanatory variable. The second panel plots the relative risk and confidence intervals against the variable name.
There are very few built-in options for this graphic and relies on the use of graph_combine options.
Make sure you have the latest version of this command ssc install graphbinary, replace
sort(graph_options) specifies the order in which the explanatory variables are specified on the y-axis. There are only a handful of choices sorting by variable name name, by relative risk magnitude effect, by the relative risk's upper/lower confidence limit upper / lower or by the percentage of people with outcome 1 and high/yes or low/no for the explanatory variable yes or low.
legend(string) specifies the legend for the graphic in panel 1.
or specify that the odds ratio rather than risk ratio be plotted in panel 2.
rr specifies that the risk ratio be plotted in panel 2.
size(relative size percentage) specifies the percent of width available for panel 2. 50% means that panel 2 covers half the space in the final graphic, the default is 40%.
level(#) specifies the confidence level, in percent, for confidence intervals; see help level.
The examples are all the analysis of the low birth weight data that can be obtained by the webuse command.
** webuse lbw (MUST load data first) **
graphbinary low age lwt race smoke ht ui graphbinary low age lwt smoke ht ui, or graphbinary low age lwt smoke ht ui, sort(effect) graphbinary low age lwt smoke ht ui, sort(lower) title(Risk Factors) graphbinary low age lwt smoke ht ui, sort(upper) legend(lab(1 "Unexposed") lab( > 2 "Exposed")) graphbinary low age lwt smoke ht ui, sort(name) title(Risk Factors) subtitle(sorted by variable name) graphbinary low age lwt smoke ht ui, sort(yes)
The last graph is a little more complicated by changing the size of panel 2.
graphbinary low age lwt smoke ht ui, sort(no) size(16) subtitle(sorted by unexposed risk) legend(lab(1 "Unexposed") lab(2 "Exposed")) l(99)
Adrian Mander, MRC HNR Unit, Cambridge, UK. Email email@example.com