I here briefly specify the concept of a '
target signal' and I introduce so-called '
ideal' (symmetric) filters. Illustrations are based on the sample MSE R-code
MDFA_Legacy_MSE.r posted earlier, see
MSE-tutorial.
Target Signal
Consider slide 8 in
Advances in Signal Extraction and Forecasting:
The target is $y_t$: a (possibly bi-infinite) weighted average of $x_{0,t-k}$. The weights $\gamma_k$ of the target filter are provided by the user, see below for details and examples. In general, there is only a finite sample $x_{0,1},x_{0,2},...,x_{0,T}$ of observations available (in a multivariate setting one would consider additional explanatory series, see future blog post) and the user is frequently interested in an estimate of $y_T$ at the end $t=T$ of the sample. How is this estimation problem solved by classic time series approaches?
Classic Time Series Approach
See the next slide 9:
We deduce:
- Unobserved data $x_{0,T+1},x_{0,T+2},...$ and $x_{0,0},x_{0,-1},...$ in the target $y_t$ (formula 1) is substituted by forecats (and backcasts) from a time series model (the type of forecast approach is not important at this stage).
- One-step ahead forecasting is a special case of the above problem, when $h=1$ and $\gamma_{0}=1$ (all other $\gamma_k$ vanish).Alternatively, one could set $h=0$ and $\gamma_{-1}=1$ (all other $\gamma_k$ vanish). Or ...
In a nutshell: the signal extraction problem, the estimation of $y_t$, is a challenging estimation problem which generalizes one-step ahead forecasting.
- If the weights $\gamma_k$ converge rapidly towards zero, then the problem is less challenging.
- If the weights $\gamma_k$ converge slowly towards zero then... good luck!
How and why is the user supposed to provide the weights $\gamma_k$ of the target filter (first slide above)?
Specifying the Target Filter
Ideally, the weights $\gamma_k$ should reflect
- the purpose of the analysis (what is the objective of the application) and, subsidiary,
- user preferences.
Consider the following hopefully illustrative examples (see also section 2.1 in
Optimal Real-Time Filters for Linear Prediction Problems):
- A user wants to predict tomorrow's realization of an interesting time series: then the specification of $\gamma_k$ and of the target is straightforward, see slide 9 above.
- A user wants a $h$-day ahead forecast: the target is, once again, straightforward.
- A user wants to analyze the seasonally-adjusted component of a time series. He is interested in today's (seasonally-adjusted) realization (think about unemployment figures).
- For monthly data, one might consider $y_T:=x_{T+6}-x_{T-6}$ (which is not observable) whereby $\gamma_{-6}=1, \gamma_{6}=-1$ and all other $\gamma_k$ vanish. This is just an application of the (possibly simplest) monthly seasonal adjustment filter (yearly difference operator applied to future observations).
- Note that $y_T=x_T-x_{T-12}$ (which is observable) would correspond to the seasonally adjusted component half-a-year back in time (not today's figure).
- Many users would prefer relying on a more sophisticated design (X-13-SEATS is considered the 'golden standard' in seasonal adjustment for monthly data).
- A user wants to analyze the trend component of a time series. He's interested in today's trend component.
- A very simple trend specification could be $y_t=\sum_{k=-M}^{M}\frac{1}{2M+1}x_{0,t-k}$ (which is not observable at the sample end $t=T$) with weights $\gamma_k=\frac{1}{2M+1}, |k|\leq M$ and 0 otherwise (the equally-weighted MA-filter is a classic design in financial momentum designs).
- Note that $y_t=\sum_{k=0}^{2M+1}\frac{1}{2M+1}x_{0,t-k}$ (which is observable in $t=T$ assuming $T\geq 2M+1$) would correspond to a shifted estimate (not today's figure)
- But some users would prefer more sophisticated trend-designs.
The above seasonal adjustment and trend filters are called symmetric because $\gamma_k=\gamma_{-k}$ so that future and past observations are weighted equally (the filter does not shift the input series). Often (though not always) target filters are
symmetric.
For the specification of a 'target signal', the user could also rely on
classic designs (such as Hodrick-Prescott or Henderson or
Christiano-Fitzgerald, for example) or on formal
model-based approaches
such as
ARIMA (canonical decomposition: top-down approach) or
unobserved
components models (state space: bottom-up approach).
Hopefully, the above examples illustrated that the target signal depends on the
- objective of the analysis and, subsidiary, on
- user preference/experience
Stated otherwise: there is no single best universally accepted target. In the following I briefly introduce
my own preferred target signal specification, namely ideal filters.
Ideal Filters
Definition
A so-called ideal filter is characterized by a very sharp (discontinuous) transfer function, resulting in a rectangular amplitude function, see
DFA from which the following is pasted:
For cutoff=$\pi/6$ this looks like (by symmetry the negative frequencies were skipped):
The filter weights (of the ideal lowpass) can be obtained by inverse Fourier transform:

where cutoff is the frequency at discontinuity. Note that $\gamma_j$ converge as a damped sinusoid towards zero for increasing $|j|$ but the convergence is rather slow.
Examples
The following sample (R-) code
ideal lowpass is a selection of (R-) code copy-pasted from
MDFA_Legacy_MSE.r in the
MSE-tutorial (I slightly modified the plot).
Let's simulate data: three different AR(1)-processes with coefficients -0.9, 0.1 and 0.9:
rm(list=ls())
###################################################
### code chunk number 18: exercise_dfa_ms_1
###################################################
# Generate series of length 2000
lenh<-2000
len<-120
# Specify the AR-coefficients
a_vec<-c(0.9,0.1,-0.9)
xh<-matrix(nrow=lenh,ncol=length(a_vec))
x<-matrix(nrow=len,ncol=length(a_vec))
yhat<-x
y<-x
# Generate series for each AR(1)-process
for (i in 1:length(a_vec))
{
# We want the same random-seed for each process
set.seed(10)
xh[,i]<-arima.sim(list(ar=a_vec[i]),n=lenh)
}
The mid-process, with parameter 0.1 fits log-returns of US-INDPRO quite well. The other two processes are for illustrative purposes, mainly.
We want to filter these series by relying on an ideal (symmetric) filter with cutoff $\pi/6$. For that purpose we rely on the above formula (for computing $\gamma_j$) and we truncate the bi-infinite filter (truncation point $M=900$):
# Compute the coefficients of the symmetric target filter
cutoff<-pi/6
# Order of approximation
ord<-900
# Filter weights ideal trend (See DFA)
gamma<-c(cutoff/pi,(1/pi)*sin(cutoff*1:ord)/(1:ord))
ts.plot(gamma[1:36])
Note that we computed one half (one side) of the filter only: the other side is mirrored. The symmetric filter requires future and past observations and therefore we apply it in the middle of the generated time series:
###################################################
### code chunk number 19: exercise_dfa_ms_2
###################################################
# Extract 120 observations in the midddle of the longer series
x<-xh[lenh/2+(-len/2):((len/2)-1),]
# Compute the outputs yt of the (truncated) symmetric target filter
for (i in 1:length(a_vec))
{
for (j in 1:120)
{
y[j,i]<-gamma[1:900]%*%xh[lenh/2+(-len/2)-1+(j:(j-899)),i]+
gamma[2:900]%*%xh[lenh/2+(-len/2)+(j:(j+898)),i]
}
}
We can now plot the data and the filter outputs:
par(mfrow=c(3,1))
for (i in 1:3) #i<-1
{
ymin<-min(y[,i])
ymax<-max(y[,i])
ts.plot(x[,i],main=paste("Data and (blue) and target (red), a1 = ",a_vec[i],sep=""),col="blue",
ylim=c(ymin,ymax),
gpars=list(xlab="", ylab=""))
lines(y[,i],col="red")
mtext("Real-time", side = 3, line = -1,at=len/2,col="blue")
mtext("target", side = 3, line = -2,at=len/2,col="red")
}
Here's the plot
The data corresponding to $a_1=0.9$ is smoothest (top plot, blue line). In contrast the series for $a_1=-0.9$ is very noisy (bottom plot, blue line). When applying this filter to white noise, the mean duration between consecutive peaks (or consecutive troughs) of the filtered series is $2\pi/cutoff=12$ (topic of future blog post about momentum filters). The cutoff parameter is intuitive and easy to understand and therefore various (well-known) estimation problems can be operationalized:
- Recession indicators:
- the duration of a typical (historically observed) business-cycle is at least two years (we ignore the twin-dip in the early 80's...)
- therefore we may set cutoff$=2\pi/24$.
- All components with shorter duration (shorter than 2 years: for example seasonals or monthly calendar effects or measurement 'noise') are completely eliminated by the bi-infinite ideal lowpass (bi-infinite means that the filter coefficients extend into the infinite past as well as into the infinite future).
- Trading:
- A fund-manager does not want to proceed to more than 4 trades per series and per year
- I just had a corresponding request: the slow trading-frequency is due to costs (large portfolio) and to customer requirements (risk-aversion: bad experiences)
- therefore one can set cutoff$=\pi/64$ (let's assume 256=2^8 trading days per year which amounts to a mean duration of 256/4=64 days between consecutive trades i.e. a periodicity of 2*64=128 and therefore cutoff=$2\pi/128= \pi/64$).
Note that
- the cutoff determines the mean duration: the effective duration between consecutive peaks/troughs is a random variable (sometimes larger, sometimes smaller)
- the above symmetric filter relies on (lots of) future data points and therefore $y_T$ is not observable at the sample end $t=T$. In the classic approach $y_T$ is estimated by supplying forecasts from a time series model, see slide 8 above (backcasts are generally ignored because $\gamma_k$ converge sufficiently rapidly to zero). The DFA tackles the estimation problem differently (see up-coming blog posts).
Why Do I Prefer Ideal Filters?
The cutoff-parameter has a nice intuitive appeal which fits 'idealized' customer-requests often better than any other (model-based, classic filter, ... ) target specification (known to me).
- As an example, the parameter $\lambda$ in the HP-filter is often interpreted in similar terms (HP proposed a value $\lambda=1600$ for quarterly data in order to extract the trend (remove the cycle/noise))
- but since pass- and stopbands merge over a broader frequency-range (the transition is smooth in contrast to the discontinuous ideal filter) the trend cannot be neatly separated.
To conclude we note that ideal
highpass or ideal
bandpass filters can be derived easily from ideal
lowpass:
- Highpass=1-Lowpass or: $\gamma_k^{high}=1-\gamma_k^{low}$
- Bandpass=Lowpass(with larger cutoff)-Lowpass(with smaller cutoff) or: $\gamma_k^{band}=\gamma_k^{low, large cutoff}-\gamma_k^{low, small cutoff}$
More generally, any non-pathological target-shape can be approximated by suitably normalized (and thin) bandpass rectangles (Riemann integral).
Comments
Post a Comment