dfa {signalextraction} | R Documentation |
The Direct Filter Approach (DFA) provides efficient estimates of signals at the current boundary of time series in real time. For that purpose, one-sided ARMA-filters are computed by minimizing customized error criteria. The DFA can be used for estimating either the level or turning-points of a series, owing to the fact that that both criteria are incongruent and cannot be optimized simultaneously. In the context of real time turning-point detection, various risk profiles can be operationalized, which account for the speed and/or the reliability of the one-sided filter.
dfa(x, quart = FALSE, d = 0, pb = 1/14, sb = 1/7, tpfilter = FALSE, lambda = 3, expweight = 1.5, pbd = if((length(x)<100)) 1.08 else 1.03, limamp = if(!tpfilter) 1.5 else 3, i2 = TRUE, n.loops = 10, verbose = 1)
x |
Numerical vector, containing a time series with at least 61 monthly or 23 quarterly entries. Missing values are not allowed. |
quart |
Logical, describes whether argument x contains
quarterly data. If so, set quart=TRUE , for monthly data the
default value quart=FALSE is appropriate. |
d |
Numerical, defaults to 0. Corresponds to the integration order of the series. It may take the values {0, 1, 2,}. If the series is bounded, no differencing (d=0) is necessary. For trending series the optimization criterion is biased, see section 6.1 in Wildi (2007). Taking first order differences (d=1) in such a case enables to reestablish efficiency (unbiasedness) by a transformation of the pseudo-periodogram. |
pb |
Numerical, takes values between 0 and π, defaults to
pi/14 and determines the pass band. Together with argument
sb , it describes the shape of the symmetric transfer
function. |
sb |
Numerical, takes values between 0 and π, defaults to
pi/7 and determines the stop band. Together with argument
pb , it describes the shape of the symmetric transfer
function. |
tpfilter |
Logical, defaults to TRUE , which makes the
dfa -routine a turning point filter. In this case, the two
variables lambda and expweight account for speed
and/or reliability of the filter, see section 5.3 in Wildi
(2007). Else, if tpfilter=FALSE , the dfa -routine
corresponds to a best level filter. |
lambda |
Numerical, defaults to 3, but only affects the output if
tpfilter ist set to TRUE . Argument lambda is a
Lagrange parameter for phase restriction that corresponds to
chi in formula 5.3 of Wildi (2007). Larger values induce
smaller time delays, but noisier signal estimates. Typical values
for lambda are in [1,20]. |
expweight |
Numerical, defaults to 1.5, but only affects the
output if tpfilter=TRUE . Reasonable values are in [0.5,2].
Argument expweight determines the shape of the
frequency weighting function W(omega) in formula 5.3 of Wildi
(2007). More precisely, W(omega)=abs(omega)^{expweight}. Larger
values emphasize the stop band of the filter. Therefore
high-frequency components are damped more effectively. This results
in increased reliability. |
pbd |
Numerical, takes values > 1 and defaults to 1.08 for series
with less than 100 observations, and 1.03 else. This argument is a
regularity constraint. Moduli of poles of the ARMA filter are
constrained to exceed pbd . Larger values of pbd
generally imply a smoother transfer function. |
limamp |
Numerical, defaults to 1.5 for turning point estimation,
and to 3 for best level estimation. This argument is a regularity
constraint that constrains the amplitude to be smaller than the
product of limamp and A(0). It should be larger than 1, and we have
found that values between 1.5 and 2 are fine in the case of level
approximation tpfilter=FALSE , whereas values between 3 and 5
are reasonable constraints in the case of turning point estimation. |
i2 |
Logical, defaults to TRUE . If TRUE , it forces
the time delay of the one-sided filter to vanish at frequency
zero. In practice, it is often the case that the use of this
constraint leads to better estimates, especially if turning points
are of interest, i.e. if tpfilter=TRUE . |
n.loops |
Numerical, defaults to 10. It is the number of initial Stochastic Annealing proposals for the nonlinear optimization in computing the filter, of which the best is chosen and optimized further. A bigger number usually leads to a more precise solution, but the code takes longer to run. |
verbose |
Numerical, defaults to 1 and steers the amount of text output in the optimization routine. Allowed values are 0 (no output at all), 1 (minimal output for run-time control) and 2 (full output for tracking the optimization steps). |
Please note that we here refer to Wildi (2007) for further
details. Depending on how the arguments are set, the main function
dfa
minimizes one of the error criteria presented in the
book. This is either the one given in formula 3.7 (for level
estimation on stationary data: d
=0, tpfilter=FALSE
),
6.7 (for level estimation on non-stationary trending data:
d
=1, tpfilter=TRUE
) or 5.4 (detection of turning
points, tpfilter=TRUE
). The level-criteria 3.7 and 6.7 mate the
structure of the underlying estimation problem because one can show
that they correspond to efficient estimates of the (unknown)
mean-square real-time filter error. Criterion 5.4 is a generalization
(for chi=1 and W(omega)= 1 the preceding level
criteria result) which enables to improve speed (smaller time delay in
the pass-band) and reliability (better damping in the stop-band) of
the filter. One can show that it improves level characteristics in the
vicinity of turning points and that delays are weighted more heavily
than anticipations, see sections 5.2 and 5.3 in Wildi (2007).
An object of class dfa
, containing
argli |
The function call in a list with values for all arguments |
xf |
The filtered real time series |
critval |
Corresponds to the minimized criterion value (either of the formulas 3.7, 5.4 or 6.7 in Wildi (2007), according to the arguments in the function call). In the case of level estimation, this value is also an estimate of the mean-square filter error (computed in the frequency domain). |
ar.coef |
AR-coefficients of the one-sided filter |
ma.coef |
MA-coefficients of the one-sided filter |
perall |
The periodogram (for d =0) or pseudo-periodogram
(for d=1 ) of the input series |
amp |
Amplitude function of the one-sided real time filter |
pha |
Time delay (phase divided by frequency) of the one-sided real time filter |
Marc Wildi & Marcel Dettling, <[wia/dem]@zhwin.ch>
Marc Wildi, Real-Time Signal Extraction (Beyond Maximum Likelihood Principles), Springer. To appear in 2007.
coef.dfa
, fitted.dfa
,
plot.dfa
, outsamp
data(fit) ## Instead of calling data(fit), one could run (time consuming) ## set.seed(21) ## data(x) ## fit <- dfa(x) plot(fit)