Page 1 of 1

Illegal length specification for @MOV

Posted: Tue Aug 11, 2015 8:00 am
by cc100
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!

Re: Illegal length specification for @MOV

Posted: Tue Aug 11, 2015 8:04 am
by cc100
it works when I use @mav instead of @movav, but i don't know why it works :(

Re: Illegal length specification for @MOV

Posted: Tue Aug 11, 2015 9:14 am
by EViews Gareth
Try this:

Code: Select all

!length = !window+1 series {%name}_ma = @movav({%name}, !length)

Re: Illegal length specification for @MOV

Posted: Wed Aug 12, 2015 12:04 am
by cc100
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

Posted: Wed Aug 12, 2015 1:03 am
by cc100
..attached is the program which is failing on changing the window size above a certain value (seems to work up to 1500!)

Re: Illegal length specification for @MOV

Posted: Wed Aug 12, 2015 8:02 am
by EViews Gareth
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.

Re: Illegal length specification for @MOV

Posted: Wed Aug 12, 2015 8:18 am
by cc100
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).

Re: Illegal length specification for @MOV

Posted: Wed Aug 12, 2015 8:27 am
by EViews Gareth
Use @mav :D

Re: Illegal length specification for @MOV

Posted: Wed Aug 12, 2015 8:37 am
by cc100
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 :)

Re: Illegal length specification for @MOV

Posted: Wed Aug 12, 2015 9:01 am
by cc100
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! :)