Code: Select all
X = 3, NA, 2
@movav(x,3) = (3 + NA + 2)/3 = NA
@mav(x,3) = (3 + 2)/2 = 2.5
Hi Gareth,
Hope you're well.
I understand that in the above, x = the series I want to manipulate, and 3 is the fixed rolling window.
But how could I use the @MAV(x,3) function above to generate a series with an expanding rolling window? i.e. I'd like no restrictions, so the 3 shouldn't be there, rather it should be infinitity/unlimited.
Currently I can do fixed rolling moving average using the following
series rtmovavgasx200=@mav(rtasx200,5) while this might still be satisfactory (I still need to confirm with my superior), I'd like to know how to do the expanding rolling window just in case. Any help appreciated. :D