Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: What is the best way to graph CI bands that partially overlap?


From   Joseph Coveney <[email protected]>
To   Statalist <[email protected]>
Subject   st: What is the best way to graph CI bands that partially overlap?
Date   Mon, 10 Jul 2006 17:20:53 +0900

Plotting the confidence interval as a tinted band around the prediction line
seems to be a good way to present the model fit, and that is what -lfitci-
does.  A problem arises when plotting two categories' or groups' model fits
on the same graph.  Wherever the CI bands overlap, the CI band of the last
fit plotted will obscure the earlier one's.

Using -twoway rline- is an alternative, but it gives rise to a graph with
six lines for two treatment groups (two prediction lines and two sets each
of upper and lower confidence limit lines).  Even with softening of the CL
lines (reduced intensity, line thickness, etc.), the graph looks crowded and
requires more audience effort.

One approach I've seen recently is to separately plot the overlapping
regions in a mixed color.  Say, the CI band of the first plot is blue and
that of the second is red, then the overlapping region is plotted in purple.
I cannot recall where I saw the example of this approach, but it seems
doable in Stata, using indicator variables for flagging when the lower CL of
one fit is less than the upper CL of the other, and then overlaying
a -twoway rarea ucl1 lcl2 x if flag-, or something similar.  It seems
cumbersome, though, and flagging could get complicated if the predictions
cross, such as with an interaction.

I suppose that another alternative for categorical predictors would be to
use a connected-symbols or bars for the predictions with an overlaid
range-spike-with-cap for the CI.  This, too, would seem to make for an
overly busy graph if there are more than just a couple of categories in the
predictor, and doesn't seem ideal if the categories are samplings of an
underlying predictor that is inherently continuous (time, drug
concentration).

Is there a consensus, or even a plurality, of opinion how best to depict
model fits including CIs when there is some overlapping of the CIs?

Joseph Coveney


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index