[R-SIG-Finance] Causal version of HP filter and Kernel Smoothing in R?

Paul Gilbert pgilbert902 at gmail.com
Sat Feb 25 01:04:41 CET 2012

Some pedantic points regarding correct terminology:

On 12-02-24 06:00 PM, Brian G. Peterson wrote:
> As usual, it helps to use the correct terminology.
> The term usually employed is not 'causal' but 'one sided' or 'two sided'
> filters.

Economists usually employ the terms 'one sided' and 'two sided'. In 
engineering, physics, and mathematics, I think the terms 'filter' and 
'smoother' are still used. (But yes, 'causal' usually has to do with 
something else.)

> In classic state space models, the two sided filter is often
> called a 'smoother', and the one-sided version is called a 'filter'.
> See any introduction to Kalman filters for examples, since the Kalman
> may easily by one sided or two sided.

Even in the classic case this is not specific to state-space models. The 
term filter meant it could be used to filter incoming signals without 
knowledge of the future, while a smoother needs future information. So, 
a filter could be used to do realtime control, while a smoother could not.
> High pass filters are also quite trivial, as equation 4 in your
> reference demonstrates.
> I may be incorrect, having spent only a few moments on it, but I see
> nothing in this paper to indicate that the kernel smoothing in equation
> 6 is not equally trivial.
> Marc Wildi has written extensively on the topic of real time (one-sided)
> filters, and his R code is public.
Engineers use the term 'realtime data' to mean what I think most people 
would understand as 'look at the data as it is arriving', which implies 
using a (one-sided) filter.  Economists use the term 'realtime data' to 
mean 'look at the data as it arrived'. That is, the vintages of the data 
that were available at different points in time. Thus a realtime 
analysis for an economist is a consideration of the revisions in the 
data. I think Marc Wildi uses the term as an economist, not as an engineer.

(I warned you this is pedantic.)

> On Fri, 2012-02-24 at 16:47 -0600, Michael wrote:
>> Thanks Brian.
>> http://xfi.exeter.ac.uk/workingpapers/0804.pdf
>> My understanding is that those kernel smoothers and HP filters are all
>> non-causal...
>> i.e. they peek into future from time-series point-of-view...
>> Therefore, I am looking for the Causal version.
>> Thank you!
>> On Fri, Feb 24, 2012 at 4:41 PM, Brian G. Peterson
>> <brian at braverock.com>  wrote:
>>          On Fri, 2012-02-24 at 15:39 -0600, Michael wrote:
>>          >  Hi all,
>>          >
>>          >  I am reading a paper talking about extracting low frequency
>>          trend in FX
>>          >  markets and then devising trading strategies based on those
>>          low frequency
>>          >  trends.
>>          >
>>          >  I was wondering if there are Causal version of HP filter and
>>          kernel
>>          >  Smoothing functions in R, as mentioned in that paper?
>>          >
>>          >  I did quite some search but couldn't find any ... Could you
>>          please help me?
>>          It would be easier for people to decide whether to help you if
>>          you
>>          actually provided the reference to the paper you are looking
>>          to
>>          replicate.
>>          There are many kernel smoothing methods in various R packages,
>>          which
>>          your 'quite some search' I am sure uncovered, *and* kernel
>>          smoothing
>>          mechanisms are typically rather trivial to code.  So without
>>          the
>>          reference it is hard to even begin to evaluate which of them
>>          might do
>>          what you are looking for.  Also, it would be polite for you to
>>          indicate
>>          in what way the kernel smoothing mechanisms provided by
>>          specific
>>          packages do not match the methodology you desire.
>>          --
>>          Brian G. Peterson
>>          http://braverock.com/brian/
>>          Ph: 773-459-4973
>>          IM: bgpbraverock

More information about the R-SIG-Finance mailing list