RE: Moving average type process
- To: mathgroup at smc.vnet.net
- Subject: [mg18279] RE: [mg18221] Moving average type process
- From: "ELLIS, Luci" <EllisL at rba.gov.au>
- Date: Fri, 25 Jun 1999 15:05:24 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Virgil, Check out the standard package Statistics`DataSmoothing` It has a function for equal-weighted moving averages: MovingAverage[data,r] There is also LinearFilter[data,weights] Hope this helps, Luci I don't speak for the RBA -----Original Message----- From: Virgil Stokes [mailto:virgil.stokes at neuro.ki.se] To: mathgroup at smc.vnet.net Subject: [mg18279] [mg18221] Moving average type process *** This E-Mail has been checked by MAILsweeper *** I wish to perform the following "moving average" type process on a list to generate a new list: Inputs: wtlist = {w1,w2,w3} -- weight list inlist = {a,b,c,d,e,f} -- any other list (>= 3 elements) Output: outlist = {w1*a+w2*b+w3*c, w1*b+w2*c+w3*d, w1*c+w2*d+w3*e, w1*d+w2*e+w3*f} Note, outlist will always contain 2 less (Length[wtlist]/2) elements than in the input list (inlist). If w1=w2=w3=x, then the following works fine: outlist = x*Drop[Plus@@NestList[RotateRight,inlist,2],2] This is a weighted (from wtlist) sum over another list of arbitrary length (inlist). I would like to get a "fast" function for doing this when the weights are not equal. -- Virgil