Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: CI and PI on the same graph

From   Alan Neustadtl <>
To   Statalist <>
Subject   Re: st: CI and PI on the same graph
Date   Wed, 9 Oct 2013 18:17:47 -0400


Here is an example that I think is what you want:

sysuse auto, clear
regress mpg weight
#delimit ;
  graph twoway (lfitci mpg weight, stdf)
  (lfitci mpg weight, stdp acolor(maroon))
  (scatter mpg weight);
#delimit cr

Note that the order of the graphs matters since Stata in essence
layers the graphs and there fore 2nd and 3rd graphs can occlude the
first graph.  So, I graphed the widest interval first, followed by the
next widest interval (which shows on top), followed by the plot of the
individual points.

I also changed the color of the second area plot so it would stand out
from the first plot.

Hopefully this helps you.


On Wed, Oct 9, 2013 at 5:34 PM, Burak <> wrote:
> Hello,
> Is there a way to show the confidence bands associated with the prediction
> of conditional mean (conf. interval) and the prediction of the individual
> observation (prediction interval) on the same graph? Both stdf and stdf
> associated with lfitci are unique options.
> Regards
> Burak
> *
> *   For searches and help try:
> *
> *
> *
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index