### rolling regression and forecast

Posted:

**Thu May 16, 2019 12:24 am**I need to write a rolling regression and forecast for a series including data of 204 months

The idea is that I divide the whole sample into 2 halves (102 months for each half). I make regression for the first half and use that estimator to forecast the first value of the second half. Then, I update the model every month with the value of previous month.

My programming code is as follows:

================

for !i =102 to 203

smpl 1 !i

equation eq1_!i.ls return_1 c aluminum(-1)

eq1_!i.forecast returnf_1(!i+1)

next

================

I don't know why the result does not match with logics.

Can you please help me!

The idea is that I divide the whole sample into 2 halves (102 months for each half). I make regression for the first half and use that estimator to forecast the first value of the second half. Then, I update the model every month with the value of previous month.

My programming code is as follows:

================

for !i =102 to 203

smpl 1 !i

equation eq1_!i.ls return_1 c aluminum(-1)

eq1_!i.forecast returnf_1(!i+1)

next

================

I don't know why the result does not match with logics.

Can you please help me!