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

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

From |
annoporci <annoporci@gmail.com> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
st: plot confidence intervals with time series |

Date |
Sat, 22 Dec 2012 17:13:28 +0800 |

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/

- Prev by Date:
**st: RE: selecting subsets of data based on date with which to calculate geonear (SSC)** - Next by Date:
**Re: st: plot confidence intervals with time series** - Previous by thread:
**st: selecting subsets of data based on date with which to calculate geonear (SSC)** - Next by thread:
**Re: st: plot confidence intervals with time series** - Index(es):