Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

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

From |
annoporci <annoporci@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: plot confidence intervals with time series |

Date |
Sat, 22 Dec 2012 23:11:19 +0800 |

Seems twoway lfitci is not too smart about format of the X-variable, soyou need to tell it:graph twoway (lfitci $x1 $t, xlab(,format(%td))) (scatter $x1 $t)

Thanks Kit, that does the trick!

Patrick. my original question below: Dear statalist,

many thanks. clear cap log close set more off webuse rates.dta global x1 dow format date %td tsset date global t date /* Construct a 95 percent confidence interval, attempt 1 */ graph twoway (lfitci $x1 $t) /// (scatter $x1 $t) /// , title("95% Confidence Interval (dates wrong!)") graph export ci95_x1.ps,replace /* Construct a 95 percent confidence interval, attempt 2 */ reg $x1 $t, robust predict yhat, xb predict shat, stdp scalar define alpha = 0.9 /*significance level*/ gen crit = invttail(e(df_r),alpha/2) gen upper = yhat + crit*shat gen lower = yhat - crit*shat graph twoway (scatter $x1 $t) /// (line yhat $t) /// (line lower $t) /// (line upper date) /// , title("Confidence Interval, significance level = `=alpha'") graph export ci_x1.ps,replace * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

**References**:**Re: st: plot confidence intervals with time series***From:*Christopher Baum <kit.baum@bc.edu>

- Prev by Date:
**Re: st: plot confidence intervals with time series** - Next by Date:
**st: rolling moments** - Previous by thread:
**Re: st: plot confidence intervals with time series** - Next by thread:
**Re: Re: st: plot confidence intervals with time series** - Index(es):