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.
Generating a time series variable as a function of the other variables
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13306
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Generating a time series variable as a function of the other variables
Code: Select all
series dis=0
for !i=1 to 17
for !t=1 to 13
dis = dis+@abs(var{!i} - var{!i}(-!t))
next
next
Not 100% certain what you want from your description, but that code does what I think you want.
Follow us on Twitter @IHSEViews
Who is online
Users browsing this forum: No registered users and 21 guests