Turn Detection

Turn-Detection is a program for detecting turns from an increasing level to a decreasing one as soon as possible after they have occurred. The program has been used for on-line detection of turns in business-cycles [1], [2] and for detection of the peak in influenza incidence [3].

Turn Detection computes a non-parametric alarm statistic for detection of a turning point[4], [5]. The alarm statistic is based on maximum likelihood estimates of two different regressions:

monotonically increasing and inversely u-shaped for peak detection and monotonically decreasing and u-shaped for trough detection ([6], [7], [8] and [9]). The estimates and the deviances are used for turning point detection.Two different methods are available for calculation of the alarm statistic, the SRnp method and the LRnp method.

SRnp

SRnp uses the Shiryaev-Roberts approach, [10], [11], which means that the alarm statistic is an unweighted sum of partial maximum likelihood ratios,

L(1,s)+L(2,s)+...+L(s,s).

The standard deviation of the variable at each time point j, σj, can also be specified. The alarm limit can be varied, to yield different false alarm probability.

When s values are entered, the program computes (s+1) non-parametric regressions, of which one is "decreasing", denoted D. The quadratic deviation from D is denoted QD, and the other s deviations are denoted QC1, QC2,...,QCs. The alarm statistic, SRnp, is computed as

.

LRnp

The LRnp method treats the time of the turn as an unknown random variable with constant intensity, which implies a Geometric distribution with intensity parameter (p). This means that the alarm statistic is a weighted sum of partial maximum likelihood ratios,

where wj is calculated under the assumption of a Geometric distribution. The full likelihood ratio method is evaluated in e.g. [12].

The standard deviation of the variable at each time point j, σj, must also be specified, as well as the intensity (p). The constant (g) in the alarm limit can be varied, to yield different false alarm probability.

When s values are entered, the program computes (s+1) non-parametric regressions, of which one is "decreasing", denoted D. The quadratic deviation from D is denoted QD, and the other s deviations are denoted QC1, QC2,...,QCs. The alarm statistic, LRnp, is computed as

.

Using the program

Input Data

The input data is entered in the "Data"-sheet. Time and one Y-value must be entered, standard error can be omitted by leaving the column blank. Several Y-value can be entered for each time point, in the picture below four y-values are entered for time 1, one y-value for time 2 and three y-values for time 3.

Starting the program

The program is started by pressing "Run Turn Detection" on the Turn Detection menu or by pressing Ctrl-R on the keyboard.

Here you can choose to calculate the alarm statistics with SRnp or LRnp. For SRnp a limit for the alarm should be given. For LRnp the intensity should be specified, this value must be between 0 and 1. A constant also needs to be specified, which is used in the calculation of the alarm limit. You can also chose between u-shaped and inversely u-shaped for detecting upward (u-shaped) or downward (inversely u-shaped) turn. Then, the parameters are chosen the calculation is started by pressing the "Execute"-button.

The "Reset Project"-button is used to remove all input data, charts and calculated values.

The Results

The results are presented in different worksheets within the Excel workbook. To switch between the worksheets press the tabs at the bottom of the screen.

Copying data

If you want copy a graph to Word it's recommended to use "Paste Special" in the Edit-menu and choose Picture in the paste as box, otherwise the graph will be pasted as a link to the Excel-document, which can cause problems if the document is moved or changed.

Saving data

The program is written in VBA (Visual Basic forApplications)for Excel, therefore the input data and results are saved in the same way as any regular Excel-file, and can be saved in multiple copies under different names. It's a good idea to keep a copy of the original file since opening and saving an Excel-document many times may cause the file size to grow.

References:

[1]Andersson, E., Bock, D. and Frisén, M. (2005) Statistical surveillance of cyclical processes with application to turns in business cycles. Journal of Forecasting, 24, 465-490.

[2]Andersson, E., Bock, D. & Frisén, M. (2004) Detection of turning points in business cycles. Journal of Business Cycle Measurement and Analysis, 1, 1, pp 98-115.

[3]Bock, D., Andersson, E. and Frisén, M. (2008) Statistical Surveillance of Epidemics: Peak Detection of Influenza in Sweden. Biometrical Journal, 50, 71-85.

[4]Andersson, E. (2002) Monitoring cyclical processes - a nonparametric approach,

Journal of Applied Statistics, 29, 973-990.

[5]Frisén, M. (1994) Statistical Surveillance of Business Cycles,

Department of Statistics, Göteborg University, Sweden.

[6]Robertson, T, Wright, F. T. and Dykstra, R. L. (1988) Order restricted inference,

Wiley, Chichester.

[7]Frisén, M. (1986) Unimodal regression, The Statistician, 35, 479-485.

[8]Frisén, M. (1980) U-shaped regression,

Compstat. Proceedings in computational statistics, pp. 304-307.

[9]Frisén, M. (1988) Unimodal Regression.

In Encyclopedia of Statistical Sciences, Vol. 9 (Eds, Kotz, S. and Johnson, N. L.) Wiley.

[10]Shiryaev, A. N. (1963) On optimum methods in quickest detection problems. Theory of Probability and its applications, 8, 22-46.

[11]Roberts, S. W. (1966) A comparison of some control charts procedures. Technometrics, 8, 411-430.

[12]Frisén, M. (2003) Statistical surveillence. Optimality and methods. International Statistical Review, 71, 403-434.