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 |
Jorge Eduardo Pérez Pérez <jorge_perez@brown.edu> |

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

Subject |
Re: st: Intervals for predicted mean value vs predicted individual value |

Date |
Mon, 24 Feb 2014 16:05:43 -0500 |

You just need to add a new observation to perform an out of sample prediction, then use -predict- as you have been doing. clear input temp fuelcons 28 12.4 28 11.7 32.5 12.4 39 10.8 45.9 9.4 57.8 9.5 58.1 8 62.5 7.5 end * Perform regression reg fuelcons temp * Add one observation set obs `=_N+1' * Set value of temp for out of sample prediction replace temp=40 in l/l * Calculate prediction and standard erros of mean and forecast predict pfuelcons predict pmfuelcons, stdp predict pyfuelcons, stdf * Calculate cis * Set Degrees of freedom and confidence level glo df=e(df_r) glo conf=0.05 * Calculate ci in new variables. gen ciml=pfuelcons - invttail(${df},${conf}/2)*pmfuelcons gen cimh=pfuelcons + invttail(${df},${conf}/2)*pmfuelcons gen cipl=pfuelcons - invttail(${df},${conf}/2)*pyfuelcons gen ciph=pfuelcons + invttail(${df},${conf}/2)*pyfuelcons * Display li pfuelcons ci* in l/l I don't know if this can be done in a single command. -------------------------------------------- Jorge Eduardo Pérez Pérez Graduate Student Department of Economics Brown University On Mon, Feb 24, 2014 at 1:32 AM, Adam Guerrero <adamgue@gmail.com> wrote: > Dear Statalist, > > I am trying to reproduce an example in Bowerman et al.'s "Forecasting, > Time Series, and Regression." > > I have inputted the following data into Stata > > . input temp fuelcons > . 28 12.4 > . 28 11.7 > . 32.5 12.4 > . 39 10.8 > . 45.9 9.4 > . 57.8 9.5 > . 58.1 8 > . 62.5 7.5 > . end > > After regressing fuelcons on temp, I can obtain predicted values of > fuelcons using > > . regress fuelcons temp > > . predict pfuelcons > > I can also get the standard errors of the predicted mean using > > . predict pmfuelcons, stdp > > Finally, I can get the standard errors of the predicted individuals > fuelcons values using > > . predict pyfuelcons, stdf > > I know that I can use this information to obtain a confidence interval > for the conditional mean and a confidence interval for a particular > value of fuelcons given a value for temp in the data. > > My question is whether there is a command that will allow me to > estimate a 95% confidence interval for the mean value of fuelcons > given a particular value of temp that is not included in the data, but > is in the range of temp (e.g., given a temp of 40). > > I would also like to get a 95% confidence interval for an individual > value of fuelcons given a particular value of temp that is not > included in the original data, but is in the range of temp (e.g., > given a temp of 40). > > The confidence interval for the mean value of fuelcons when temp > equals 40, and the prediction interval for an individual value of > fuelcons when temp equals 40 are computed automatically in MINITAB as > > Fit SE Fit 95% CI 95% PI > 10.721 .241 (10.130, 11.312) (9.015, 12.427) > > Is it possible to do this in Stata with a single command? > > I am a bit worried that I am overlooking something simple in, so I > apologize in advance if that's the case, and thank you for assisting > with such a long question. > > Cheers, > Adam Guerrero > * > * 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/ * * 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**:**st: Intervals for predicted mean value vs predicted individual value***From:*Adam Guerrero <adamgue@gmail.com>

- Prev by Date:
**st: Stripping ASCII characters** - Next by Date:
**RE: st: RE: RE: Sorting rows in Mata** - Previous by thread:
**st: Intervals for predicted mean value vs predicted individual value** - Next by thread:
**st: A new professional application using Stata** - Index(es):