Creating a Moving Average Function
- To: mathgroup at smc.vnet.net
- Subject: [mg51615] Creating a Moving Average Function
- From: Gregory Lypny <gregory.lypny at videotron.ca>
- Date: Wed, 27 Oct 2004 01:54:37 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hello Everyone,
I'd like to create some custom moving average functions that retain the
same length as the original series by padding the lost observations
with zeros. I can get the moving average part of the function to work
but not the padding part.
This part without padding works:
MA[theSeries_, theWindowSize_] = MovingAverage[theSeries,
theWindowSize];
But adding the padding causes it to fail:
MA[theSeries_, theWindowSize_] = PadLeft[MovingAverage[theSeries,
theWindowSize], 1000];
Any suggestions would be most appreciated.
Greg
- Follow-Ups:
- Re: Creating a Moving Average Function
- From: Sseziwa Mukasa <mukasa@jeol.com>
- Re: Creating a Moving Average Function
- From: DrBob <drbob@bigfoot.com>
- Re: Creating a Moving Average Function