Hi,
I'm trying to figure out how to code summation notation into Eviews 7. See attachment for what exactly I'm trying to do. Basically, this notation creates a time series, where the value for each time period t equals a weighted sum over the next 40 periods. R is a time series.
I've written a loop, but thought there must be a more efficient way to do it.
Thanks for your help,
Matt
summation notation
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
summation notation
- Attachments
-
- Doc2.doc
- (23.5 KiB) Downloaded 493 times
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: summation notation
I'm not certain how efficient your loops are, but what makes this tricky using the efficient series genr routines is that the weights are only a function of the date offset. I can't think of an easy way to do it without loops, but there are probably more and less efficient ways of doing this.
Re: summation notation
Here is my loop:
genr z = 0
for !x = 0 to 39
genr zz = r(!x)*(b^!x)*(1 - b)/(1 - b^40)
genr z = z + zz
next
What do you think? Could it be done any better?
genr z = 0
for !x = 0 to 39
genr zz = r(!x)*(b^!x)*(1 - b)/(1 - b^40)
genr z = z + zz
next
What do you think? Could it be done any better?
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: summation notation
That one is pretty good. I'm assuming that (b^!x)*(1 - b)/(1 - b^40) are the weights.
If memory isn't an issue, you might try something like
The idea here is to auto-generate all of the weighted series using leads (like you do), but then to use the @rsum to do the actual summation. Might not make much of a difference since it's basically the same algorithm, but it may eliminate some of the overhead. It would be interesting to see how this compares.
If memory isn't an issue, you might try something like
Code: Select all
group all
for !x=0 to 39
all.add r(!x)*(b^!x)*(1 - b)/(1 - b^40)
next
series z=@rsum(all)
delete allRe: summation notation
The results are identical for the two loops.
Thanks again for your help.
Matt
Thanks again for your help.
Matt
Who is online
Users browsing this forum: No registered users and 2 guests
