Five snippets of signal analysis

Signal Analysis currently features tests and procedures addressed at verifying certain hypotheses, such as linearity, stationarity, changes of regime, and the kind of information utilized in back/forecasting time series, possibly by calibration. In such context, methodological updates are required, especially when it comes to dealing with series characterized by high irregularities or when unobservable are involved as in the case of Kalman filtering.1,2 Many Regime-Switching techniques, for instance, are affected by strict requirements such as stationarity and single-point shift3,4 which require amelioration or updating. Similarly, time-varying parameters utilized for back/ forecasting purposes are better computed in a Bayesian context, in order to exploit prior pieces of evidence based on their known distribution. Finally, current stationarity tests5,6 in a nonlinear setting with dramatic changes in trend and subsample variances may require substantial corrections. Section 1 is devoted to defining random signals, whereas Section 2 tackles the issue of Regime-Switch testing. Section 3 produces a novel technique in the field of signal smoothing. The following two sections illustrate the steps for implementing Bayesian Monte Carlo simulation and calibration, whereas the final section is addressed at supplying corrected stationarity tests. Section 7 concludes.


Introduction
Signal Analysis currently features tests and procedures addressed at verifying certain hypotheses, such as linearity, stationarity, changes of regime, and the kind of information utilized in back/forecasting time series, possibly by calibration. In such context, methodological updates are required, especially when it comes to dealing with series characterized by high irregularities or when unobservable are involved as in the case of Kalman filtering. 1,2 Many Regime-Switching techniques, for instance, are affected by strict requirements such as stationarity and single-point shift 3,4 which require amelioration or updating. Similarly, time-varying parameters utilized for back/ forecasting purposes are better computed in a Bayesian context, in order to exploit prior pieces of evidence based on their known distribution. Finally, current stationarity tests 5,6 in a nonlinear setting with dramatic changes in trend and subsample variances may require substantial corrections. Section 1 is devoted to defining random signals, whereas Section 2 tackles the issue of Regime-Switch testing. Section 3 produces a novel technique in the field of signal smoothing. The following two sections illustrate the steps for implementing Bayesian Monte Carlo simulation and calibration, whereas the final section is addressed at supplying corrected stationarity tests. Section 7 concludes.

Definition of signal
All of the aforementioned procedures share the assumption of a signal represented by a real-valued random sequence which, for the discrete time notation [ ] With unknown distribution, mean 1 1 T X T X t t − ∑ = = and finite variance 2 x σ < ∞ . More specifically, Equation (1) may be decomposed Cramér 7 in the following fashion * X X S t t t t ε = + + Where ( )

Sequential and cluster-based regime switching
Regime switching is intended as a single or multiple change of pattern of the signal in terms of mean, variance, and autocorrelation structure. 9,10 It is often associated to rare events such as disasters with permanent effects like earthquake aftermaths or financial crises. 11 Changes associated to regime switching are generally abrupt and of sizable magnitude, and may be tested for their statistical significance by means of some preselect critical-value standard. 12 Regime switching is closely associated to structural-break testing. 13 However, it is more pervasive by attempting to establish not only the date and size of breaks, but also the moment effects over the signal of interest. Moreover, regime switching is deeply involved with threshold behavior, which analyzes the event of a variable taking an extreme value at some time of its evolution. In practice, the parameterization of the signal after each break is tested for in a context of a Markov switching model. Many tests exist for the detection of regime switches, 2 whereby the different states of the signal may be identified within a given degree of likelihood. Among these tests, two stand out for their usefulness and simplicity: Sequential F-test (two-sample Kolmogorov-Smirnov test) for linear (nonlinear) signals. 3,4 Sample cluster-based Quasi-Likelihood Ratio (QLR) test of the τ∈ Τ Τ< . The subsample length is established arbitrarily, usually on a peak-to-peak basis. The F-test version for establishing the number of regime switches is given by the following statistic

Var
represents the variance of the braced argument. From Equation (3), the M-sized string of F statistics and associated p-values may be obtained. A regime switch, namely a subsample variance outlier with respect to the sample variance, is said to significantly exist if its m.th p-value falls short of some preselect critical value, usually 5%.
In case of a nonlinear signal, the test statistic corresponding to F m is represented by the two-sample Ansari-Bradley test for equal sample tied-rank scores, also defined as quasi-variances. 15 The Ansari-Bradley test requires several steps departing from the padded signal vector { ; }; = + ; = + ; , üüü m t θ τ θ τ = ∈Θ Θ Τ ∀ ∈ , and from the associated vector R θ of the locations of the values in Z θ ranked in increasing order. Next, the locations of vector R θ are parted into two group vectors depending on their origin, namely, their belonging to the subsample or to the entire sample. Formally, the concept may be expressed as Subsequently, the tied-rank vector U θ from each end of Z θ is computed, so that the smallest and largest values of U θ get rank 1, the next smallest and largest get rank 2, etc. Finally, the Ansari-Bradley test statistic 15 is shown to be computed as follows Which is the sum of the tied ranks associated to the m.th subsample? From Equation (4), the test statistic * W m may be obtained by subtraction of the mean tied-rank score sum together with the corresponding p-value. The statistic is asymptotic normal under the null hypothesis that two stochastic processes come from the same distribution, against the alternative that they come from distributions sharing the same median but different variances. In the present context, it may also be loosely viewed as a test for heteroskedasticity. 16 The QLR test, in its simplest form, checks the null hypothesis of one versus two regime switches, and is built up from forming two non-sequential clusters each characterized, possibly, by different distributions. Thereafter, the QLR is computed upon the two samples, with the proviso that these produce a Gaussian mixture where the standard Likelihood-Ratio testing cannot be implemented. For this purpose, the relevant literature provides appropriate critical values. 12 Because of its stricture in admitting a maximum of two regime switches and of its computational complexity, the QLR test receives here no applied treatment.

Spectral representation theorem for signal decomposition and optimal smoothing
A large amount of signal smoothers (i.e. smoothed trends) is nowadays available for applied work in many different scientific fields. Of these, the most notable are the Savitzky-Golay, the Daubechies, the Hodrick-Prescott filters and the Hilbert Huang Transform. [17][18][19][20][21][22][23] All of these methods, however, share serious problems when it comes to data resolution. In fact, they all require prior input of specific parameters, namely, the polynomial degree for the first two methods, the window width for the first and the decomposition level for the second method. In addition, it requires a preselected smoothing coefficient for the third method and, finally, a 'sifting' grid search for the last.
For details of such inputs, the reader is redirected to the respective reference listed in this paper. Suffice here to warn that arbitrary, and thus casual, choice of any of these parameters is conducive to the risk of over/under fitting of the slow mode * X t with respect to the original signal X t of Equation (1). The immediate consequence is inefficient estimation in terms of suboptimal denoising, namely and loosely stated, a bang-bang signal extraction yielding either a too flat smoother that is statistically inconsistent with the original peak/ trough pattern or that too closely replicates the original signal itself. We propose here a fast, automatic, and efficient smoothing procedure that applies the Spectral Representation Theorem to a signal 1 X of whichever nature: stationary or not, linear or nonlinear. The signal may be approximated by means of the following periodic function where ˆ, X t k is a fitted sequence of the original signal, µ is the is a functional form, ( ) . X f t ∆ = expresses the existence of linearity and nonlinearity of the process as evidenced by the value of the exponent attached to the lagged signal. The fitted signal of Equation (5), which is the smoother estimable by Ordinary Least Squares (OLS), may be defined as the Spectral Representation Transform of the original signal with time-varying amplitude (Hamilton, 1994 . The optimal smoother is therefore defined as For the optimal lag * K of Equation (5) and the performance index closely akin to the Percent Root Mean Square Error (PRMSE), defined as Where . is the Euclidean norm of its argument.

Bayesian monte carlo simulation with bootstrapping for back/forecasting
Bayesian Monte Carlo simulation with bootstrapping is one of the two signal back/forecasting procedures herein proposed. The other procedure is shown in Section 6. Whereas the latter is a full-blown Kalman filter with time-varying parameters extracted from Gibbs sampling, 2 this procedure is based on bootstrapping known dates and values of the signal to produce a feasible MCMC which represents the back/forecasted signal along select P<∞ periods. This procedure is thus a game of chance which involves all of the elements of Equation (2) such that we may proceed to back/forecasting a signal by means of two different techniques: I. Back/forecast the smoother of Equation (4) by P periods and thereafter append stationary shocks drawn from the distribution of the original signal, 24 II. Perform random reconstruction of the cyclical pattern of the original signal by applying the principles of peak/trough selection and bootstrapping these cyclical extrema without replacement. 25 While the first technique works well only under the assumption of fully or fairly regular cycles in amplitude and length, and is likely to be affected by substantial uncertainties, 26-28 the second technique preserves the stochastics of the original signal and is by consequence more trustworthy from the distributional viewpoint. There follows that Bayesian prior values drawn from the known distribution of the original signal can be utilized along the entire signal sample so as to forestall predictive uncertainties. Implementation of this preferred technique requires three consecutive steps: Find the peaks and troughs of the signal X t throughout the entire sample. Scrap all occurrences separated by a cyclical distance far exceeding or falling too short of the average cycle.
The number of trough-to-trough cycles remained may be denoted as1 C T ≤  . Subsequently form a matrix ( ) ,3 F C of triplets of dates in the following order: lower-date trough, peak date, and upper-date trough.
The latter is the lower-date trough of the subsequent cycle, and so on. Each triplet encapsulates a specific cycle of given length. Bootstrap N times the rows of matrix F so as to obtain a matrix ( ) , G P D of the reshuffled values of the signal X t . For each row of this matrix such values might be further simulated up to D draws to produce Bayesian priors from the distribution of X t and generate a new matrix G with the posteriors. From this matrix find the series which mostly approximates the original signal X t in terms of mean and/or variance. This is the optimal prediction signal ** X p , for [ ] 1, p P ∈ , commonly defined as the "mode" since it is the closest to the actual data. This procedure is quick and easy to implement as opposed to the lengthier procedure featured in the next section, which needs a larger, often cumbersome informational set provided by the proxy instrument (s) utilized.

Bayesian calibration for back/forecasting
Calibration is a technique for back/forecasting the signal X t by means of a matrix of proxy instruments ( ) where T>T τ∈ and 1 n≥ respectively are the sample length and size. It assumes a statistically significant relationship among the two datasets for the overlapping sample length T such that back/forecasting P periods ahead (behind) by means of Z p is expected to produce a mode ** X p . The relationship is customarily expressed in terms of a fixed-time parameter set ( ) : ,1 0 B n usually estimated by means of OLS. 29 Bayesian calibration in the present context is an extension of the above model as it contemplates time-variable parameters connecting the two datasets and letting the prediction process be estimated by a dynamic statespace (SS) model whose upshot is a MCMC process characterized by ergodicity. 2 This model is represented by two equations whose workings in a Bayesian framework are better detailed elsewhere 30 Where, for p given as above (Sect. 1.3), and B X p p respectively are the state(s) and the observable(s), whereas and e v p p are orthogonal I.I.D. zero-mean disturbances. More precisely,

( )
: , B P n p is the time-varying parameter set whose first input is given by the Bayesian prior 0 B conditional upon a normal distribution. The variable C p is a slope parameter set connecting the contemporary state(s) and observable(s) and has the same size as B p . , n n except the last which is a scalar. The first component of p Ω is the Riccati matrix of the state covariance, which is distributed as an Inverse Wishart, whereas the other two components respectively are the state and the observable error covariances, distributed as Inverse Gamma. Matrix p Ω may be defined as the prior information set for predicting 1 B p+ and its estimation errors e p . Once this value is computed conditional on the covariances and on their distributional properties, the ensuing posterior 1 p Ω + is utilized for computing 2 B p+ in the same fashion, and so on along the process. This prior-posterior-prior sequence of the information set is at the heart of the conditional adaptive Kalman Filter for which the conditional parameters of Equation (9) at any stage are optimally estimated and ends as soon as P is hit. 1 Needless to say, optimality refers in the present context to the valuable information set p Ω delivered stage-wise onto the parameters. More explicitly, let the Kalman Gain be ( ) Such that the Riccati matrix be represented overtime as the following nonlinear and recursive process Needless to say, all of the elements in Equations (10) to (12) enter the real-time information matrix p Ω . Optionally, in order to gain further information by letting and 1 B B p p+ be conditioned directly by the observable X p , the covariance matrix Q p in Equation (11) may be replaced by the variance of the observable itself.

Proposed method for correction of stationarity test statistics
In this last Section a novel method is proposed for correcting the conventional stationarity test statistic in a setting of non-flat linear trends, and non-constant smoothers and cycles. Among such tests, the most notorious applicable to linear signals is the t-type Augmented Dickey-Fuller (ADF) test 5,6 which embeds an option for the intercept and/or for linear trend. Similarly, for nonlinear signals the Kapeitanos-Shin-Snell (KSS) t-type test is commonly applied with similar options. 31,32 The critical asymptotic values with preselected p-values of the test statistics are tabulated in the respective references. The null hypothesis implied by both test statistics involves first differencing of the signal, which in Econometrics is dealt with Autoregressive Conditional Heteroskedasticity (ARCH) testing in case of subsample changing variances. 33,34 We endeavor in the present context to follow a richer avenue, given the plethora of ad hoc tests and statistics available for deeply scrutinizing the performance of the signal in terms of changing trends, means and/or variances, and cyclical shapes. Among these we test, in a two-sample setting, for major changes that might have occurred within. Specifically, we test from Equation (2) the evolution of the slow-mode term * X t , which includes a linear trend X t  estimable by OLS, and the smoother ˆ* , X t K of Equation (7). We also test for equal variances by means of the F-or Ansari-Bradley test of Equations (3) and (4) respectively. We finally add a test for different subsample shape in terms of cyclical amplitude (e.g. Schwabe cycle).
Let the following: Where the computed TS are penalized whenever one or more of the coefficients j Ψ exceeds or falls short of unity. Penalization consists of the reduction in the absolute value of the computed TS, possibly below the associated critical value or even turning into a positive value. In practice, the farther away are the coefficients j Ψ from their expected values, the greater the risk of nonstationarity in spite of stationarity originally detected by the conventional test statistics. Incidentally, the asymptotic 10%, 5%, and 1% critical values of the computed TS are -2.22, -2.93, and -3.40. [35][36][37] Incidentally, such values are close to some simulated experiments over 10,000 replications of the nonlinear version of Equation (2).

Conclusion
Five statistical practitioner's procedures in support of signal analysis have been introduced and discussed. Such snippets were shown to be useful for better and efficient implementation of the corresponding procedures and of some select hypothesis tests existing in the received literature. Of notable consideration are the optimal smoothing and the corrected ADF test procedures, both characterized by significant novelty in their implementation techniques. The Bayesian stepwise procedures for Monte Carlo simulation and calibration are also of interest because of their ability to perform back/forecasting of signals over long periods of time, if necessary. Of the two, the former may be preferred because quick and easy to implement. The first and the last snippets were found to be particularly useful in a highly erratic environment regarding the signal. The latter, in particular, is worth of notice because of its capability to reverse the results of the traditional stationarity test statistics.