Announcement

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

  • Error: Option Dynamic Not Allowed in the Command Predict

    Hi,

    I am doing ex-ante out of sample forecasting for rail freight. Based on the results of the ADF Test and AIC, I am predicting the freight value for rail for years 2020-2030 based on past values from 2007-2019. However, whenever, I use dynamic in predict, I get the error that the option dynamic is not allowed in the command.

    I have run the following commands:
    gen t=_n
    tsset t

    gen RailFreightDiff = d.RailFreight
    dfuller RailFreightDiff, drift regress lags(1)
    varsoc RailFreightDiff

    set obs 24; I tried set obs '=_N=11' command but got the error, observation number out of range.

    gen RailLag1 = RailFreightDiff[_n-1]
    gen RailLag2 = RailFreightDiff[_n-2]
    reg RailFreightDiff RailLag1 RailLag2, r
    predict Rail, dynamic{24}


    The sample of the data set using dataex:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int year long railfreight float t long RailFreightDiff float(RailLag1 RailLag2)
    2007 5215858  1       .       .       .
    2008 5517042  2  301185       .       .
    2009 6001461  3  484419  301185       .
    2010 6258547  4  257086  484419  301185
    2011 6676755  5  418208  257086  484419
    2012 6492100  6 -184655  418208  257086
    2013 6656881  7  164782 -184655  418208
    2014 6812517  8  155636  164782 -184655
    2015 6542970  9 -269548  155636  164782
    2016 6205502 10 -337468 -269548  155636
    2017 6934109 11  728608 -337468 -269548
    2018 7389954 12  455845  728608 -337468
    2019 7081283 13 -308672  455845  728608
    end
Working...
X