Generating a time series variable as a function of the other variables
Posted: Fri Sep 01, 2017 12:08 pm
Hello,
I am new to programming and I would need help with an equation.
My goal is to generate a new series (variable) for my time-series dataset. My dataset consists of 17 variables and 200 weeks.
The new series (diss) should represent the absolute difference between all my variables in week t and the variables in week t-1 to t-13 (in the last 13 weeks).
Thus, I have written the following code.
series dis = resid
for !i = 1 to 17
for !t = 1 to 13
distance = @sum(abs(Var{!i} - Var{!i}(-!t)))
next
next
However, this code only gives me a scalar. I am not sure how to tell eviews that I need a value for each week (starting in week 14). I would highly appreciate any help.
Thank you so much in advance.
I am new to programming and I would need help with an equation.
My goal is to generate a new series (variable) for my time-series dataset. My dataset consists of 17 variables and 200 weeks.
The new series (diss) should represent the absolute difference between all my variables in week t and the variables in week t-1 to t-13 (in the last 13 weeks).
Thus, I have written the following code.
series dis = resid
for !i = 1 to 17
for !t = 1 to 13
distance = @sum(abs(Var{!i} - Var{!i}(-!t)))
next
next
However, this code only gives me a scalar. I am not sure how to tell eviews that I need a value for each week (starting in week 14). I would highly appreciate any help.
Thank you so much in advance.