Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calculate and/or graph the confidence interval for a time-series forecast in Stata 18

    Hello Stata community,

    I have a question for a project for my studies about how to plot the confidence interval for a time series forecast.


    What I have been able to do so far: I have formatted the data as a time series, I have determined that it follows an ARMA(2,1), and I have been able to make forecasts. That part is fine. I can graph my forecasts just fine.
    What I'd like to add: I would like to graph my forecast with the upper and lower bounds of the confidence interval. Is there a command to add those? Either a command that graphs them directly, or a command that calculates them as a new variable, since I can then graph those myself. (I think I have been able to calculate them manually but I'm not sure I did it correctly. I'm assuming there is a pre-installed command, since this is pretty basic for cross-validation.) I have seen online that some people have been able to calculate the lower and upper bounds with the command "predict yhat, stdf" but the stdf option seems to be disabled for my version of Stata (18).

    Would you know how to calculate and/or graph the confidence interval for a time series forecast?

    Thanks in advance!

    SB

  • #2
    You use the simulate option. It will estimate the sd of the forecast. You then create the lower/upper bounds by substracting/adding forecast +- 1.96*sd (or whatever t you like). See the pdf, p. 254 for an example.

    Comment


    • #3
      OK I will try that. Thank you!

      Comment


      • #4
        Hello again,

        I tried that but I think you can only simulate with certain models (such as a VAR) and the ARMA is not one of them. Indeed, I found a command that does EXACTLY what I want, namely the "fcast graph" command, but it does not work for an ARMA. I only managed to do it for a VAR. It generated the upper bounds and lower bounds of the confidence interval, which was exactly what I was looking for, and graphed them exactly as I wanted (see attached image). Would anyone know an equivalent command that works for an ARMA?

        I will add that I looked on page 254 of the Stata 18 manual but it didn't refer to simulations. It referred to confidence interval for a prediction, rather than for a forecast.

        Thanks,

        SB

        Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	24.9 KB
ID:	1736536

        Last edited by Sam Baker; 08 Dec 2023, 21:31.

        Comment


        • #5
          maybe helpful.
          HTML Code:
          https://www.statalist.org/forums/forum/general-stata-discussion/general/1445928-forecast-interval-for-arima-forecast

          Comment

          Working...
          X