Hi,
I have the following code:
!window = 1300
group g_ma
for !i=1 to group01_rates.count
%name=group01_rates.@seriesname(!i)
series {%name}_ma = @movav({%name}, !window+1)
g_ma.add {%name}_ma
next
As you can see I am just computing simple moving averages of the series in my group. The range has 4832 observations. When I have a window size of 720 it works, also works for 1000. It seems to randomly fail for some numbers, it fails for 1200 and 1300 for example but works for 1100. The error message is Illegal length specification for @MOVAV, @MOVSUM, or @LAG in "SERIES {%NAME}_MAV = @MOVAV(<seriesname>, 1300+1). I don't understand why it is failing when the number of observations is greater than my lag. Am i missing something terribly obvious?? Thanks!
Illegal length specification for @MOV
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
Re: Illegal length specification for @MOV
it works when I use @mav instead of @movav, but i don't know why it works :(
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Illegal length specification for @MOV
Try this:
Code: Select all
!length = !window+1
series {%name}_ma = @movav({%name}, !length)
Re: Illegal length specification for @MOV
Hi Gareth - thanks for the reply.. I tried that but it still doesn't work. I get the same error msg (Illegal length specification for @MOVAV, @MOVSUM, or @LAG in "series {%name}_mav = @MOVAV(<seriesname>, 1301)". It seems like it can't go above some value somewhere between 1150 and 2000! But I don't know why when the range has 4832 observations.
Re: Illegal length specification for @MOV
..attached is the program which is failing on changing the window size above a certain value (seems to work up to 1500!)
- Attachments
-
- test program for gareth.prg
- (623 Bytes) Downloaded 474 times
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Illegal length specification for @MOV
Yeah, you're hitting a limit on how many terms you can have inside @mov.
To be honest, it is exceedingly rare to have more than, say, 5 terms inside @mov. 2000 is a tad high.
To be honest, it is exceedingly rare to have more than, say, 5 terms inside @mov. 2000 is a tad high.
Re: Illegal length specification for @MOV
Is there another way of finding the moving average where there is no upper limit?
This is actually part of some other code where I am running a PCA over a rolling window - I need to be able to adjust the rolling window up to about 10 years, and only need this movav step so that I can add back the mean to the recalculated data (PCA estimated data).
This is actually part of some other code where I am running a PCA over a rolling window - I need to be able to adjust the rolling window up to about 10 years, and only need this movav step so that I can add back the mean to the recalculated data (PCA estimated data).
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Illegal length specification for @MOV
Use @mav :D
Re: Illegal length specification for @MOV
hehe i knew you were going to say that :) I'm just fiddling now to get rid of the first few sets of rows as @mav does not propagate NAs ..
Anyway - thanks Gareth for answering all my queries :)
Anyway - thanks Gareth for answering all my queries :)
Re: Illegal length specification for @MOV
by the way, is there any chance of having the limit on the movav function removed? :D or at least matched to the limit on the mav function? Thanks! :)
Who is online
Users browsing this forum: No registered users and 2 guests
