Announcement

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

  • How to create confidence intervals based on simulations for ARIMA forecast

    Hi, I am trying to make a forecast in Stata15 using an ARIMA model. My data is as follows and goes from 2003m1 to 2019m12:

    date x_lithium
    1/1/2003 3.2596932
    2/1/2003 3.7835287
    3/1/2003 7.8802617
    4/1/2003 5.3377245
    5/1/2003 5.1322163
    6/1/2003 5.1343488
    7/1/2003 6.6340138
    8/1/2003 6.8402285
    9/1/2003 4.0908843
    10/1/2003 6.7880796
    11/1/2003 4.6890101
    12/1/2003 5.2351787
    1/1/2004 4.572536
    2/1/2004 5.5246196
    3/1/2004 6.2288512
    4/1/2004 5.5700383
    5/1/2004 6.0764194
    6/1/2004 5.4765314
    7/1/2004 7.8750602
    8/1/2004 7.1462818
    9/1/2004 6.1501641
    10/1/2004 5.5155473
    11/1/2004 7.9347098
    12/1/2004 7.10945
    ... ...

    I have managed to make the prediction using an ARIMA model (I think everything is correct).


    Code:
    generate t=tm(2003m1)+_n-1
    format t %tm
    tsset t
    tsappend, add(60)
    twoway (tsline x_lithium)
    ac x_lithium
    pac x_lithium
    arima x_lithium, arima(2,0,1)
    estat ic
    predict cp
    predict cp_dynhat, dyn(2030)
    tsline x_lithium cp_dynhat
    My result:
    Click image for larger version

Name:	forecast.PNG
Views:	1
Size:	38.5 KB
ID:	1663190



    But I don't know how to calculate the confidence intervals based on simulations for my prediction and display them on the graph.

    Thank you in advance!
    Last edited by Alejandra Rodriguez-Morales; 05 May 2022, 12:37.
Working...
X