On Mon, 24 Nov 2014, Sven Schreiber wrote:
Am 24.11.2014 um 17:36 schrieb Allin Cottrell:
> On Sun, 23 Nov 2014, Sven Schreiber wrote:
>
>> it seems to me that movavg() (and perhaps other "intertemporal"
>> functions as well?) could/should also handle missing values in the
>> middle of time series, and not only like they currently seem to be doing
>> at the start or end.
>
> OK, that's now done for movavg() in CVS. I'll keep an eye out for
> other functions that might want the same modification.
> From a quick run-through of the functions that are listed under
"filtering", it seems that the following could be affected:
- bkfilt()
- bwfilt()
- hpfilt()
- polyfit()
I'll take a look at those. Not sure offhand, but they (or some of
them) may resemble the exponential MA function, which necessarily
dies (goes all NA thereafter) the first time an NA is encountered.
Unless we implement re-initializing the filter after it crosses a
patch of missing values, but that would be complicated.
And while I was testing these, calling the 'filter()'
function with just
the one required argument (according to the doc) gives me the error
message that I need 4 arguments. So it seems the optional arguments
aren't really optional?
Well, the args are optional, just not all at once. If you omit them
_all_ you get a null filter (i.e. you get back a copy of the
original series), therefore we set the minimum number of args to 2
(OK, the error message does not reflect that.) We could enable the
null filter case for completeness, I suppose.
Allin