Am 11.09.19 um 19:48 schrieb Sven Schreiber:
Am 11.09.2019 um 19:33 schrieb Artur Tarassow:
> Am 11.09.19 um 19:29 schrieb Sven Schreiber:
>> Am 11.09.2019 um 18:35 schrieb Artur Tarassow:
>>> # WRONG VALUES!
>>> series cmavg_p2 = movavg(S, p, 1, 99) # y0 is ignored
>>> series cmavg_p4 = movavg(S, 2*p, 1, y0) # y0 is ignored
>>
>> So is it not centered, or are the values wrong in an "unknown" way?
>
> It's just replicating the input series S but no (centered) moving
> averages are computed.
Well, but your S is a linearly increasing sequence, the centered moving
average _will_ be the value in the middle.
Oh dear, you are totally right. I guess
I should call it a day ;-) Here
an example that the centered mov-avg works well:
<hansl>
clear
set verbose off
nulldata 10
setobs 1 1 --time-series
series S = 0
S = S(-1) + 1.5 + normal()
series cmavg_p2 = movavg(S, 2, 1)
print S cmavg_p2 -o
</hansl>
To me the question is how
actually a centered MA is calculated for an even number of terms -
shouldn't it be the center plus the same "tails" left and right such
that overall it will be an odd number p?
This was exactly the question I originally had in mind.
Best,
Artur