Hello,

I am forecasting 12 steps ahead with an AR model with rolling window using the following code:

"clear rhatar rhatar2 rhatar3 rhatar4 rhatar5 rhatar6 rhatar7 rhatar8 rhatar9 rhatar10 rhatar11 rhatar12

do regend=2018:2,2019:2

boxjenk(ar=||1,2||,define=ar2) Dsalsn regend-60 regend

uforecast(static,equation=ar2) rhatar regend+1 regend+1

uforecast(static,equation=ar2) rhatar1 regend+2 regend+12

compute rhatar2(regend+2)=rhatar1(regend+2)

compute rhatar3(regend+3)=rhatar1(regend+3)

compute rhatar4(regend+4)=rhatar1(regend+4)

compute rhatar5(regend+5)=rhatar1(regend+5)

compute rhatar6(regend+6)=rhatar1(regend+6)

compute rhatar7(regend+7)=rhatar1(regend+7)

compute rhatar8(regend+8)=rhatar1(regend+8)

compute rhatar9(regend+9)=rhatar1(regend+9)

compute rhatar10(regend+10)=rhatar1(regend+10)

compute rhatar11(regend+11)=rhatar1(regend+11)

compute rhatar12(regend+12)=rhatar1(regend+12)

end do"

It works perfectly fine. I want to know if there is a way to write it in a parsimonious way?

Second, what would be a way to write such code for a neural network with 2 lags of the same variable itself. I am asking this because I am unable to define model as above (with the AR) for the neural network so that I can use the uforecast function.

Thank you in advance

Dr. Ateeb Syed