File
early_warning_signal.m
Name
early_warning_signal
Synopsis
early_warning_signal - Calculates some metrics of an indicator to be used as an early warning signal of costly asset price booms.
Introduction
Alessi and Detken (2009) use a signaling methodology to predict costly aggregate asset price boom/bust cycles. The performance of a host of real and financial variables as early warning indicators for costly aggregate asset price boom/bust cycles are examined, using data for 18 OECD countries between 1970 and 2007. A signaling approach is used to predict asset price booms that have relatively serious real economy consequences. The authors propose a loss function to rank the tested indicators given policymakers relative preferences with respect to missed crises and false alarms. The paper analyzes the suitability of various indicators as well as the relative performance of financial-versus-real, global-versus-domestic, and money- versus-credit-based-liquidity indicators.
License
=============================================================================
Copyright 2011, Dimitrios Bisias, Andrew W. Lo, and Stavros Valavanis
COPYRIGHT STATUS: This work was funded in whole or in part by the Office of
Financial Research under U.S. Government contract TOSOFR-11-C-0001, and is,
therefore, subject to the following license: The Government is granted for
itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
worldwide license to reproduce, prepare derivative works,
distribute copies to the public, perform and display the work.
All other rights are reserved by the copyright owner.
THIS SOFTWARE IS PROVIDED "AS IS". YOU ARE USING THIS SOFTWARE AT YOUR OWN RISK. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS, OR THE UNITED STATES GOVERNMENT BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================
Inputs
Outputs
Code
% Run warning message
warning('OFRwp0001:UntestedCode', ...
['This version of the source code is very preliminary, ' ...
'and has not been thoroughly tested. Users should not rely on ' ...
'these calculations.']);
n = length(indicator);
% First find the threshold when exceeded the indicator issues a signal
threshold = prctile(indicator,percentile*100);
% The values in the "confusion" matrix
A = 0;
B = 0;
C = 0;
D = 0;
for i=1:n-num_periods
% If the indicator is greater than the threshold a signal is issued
signal_issued = indicator(i) > threshold;
% Find if there is an asset price costly boom in the next num_periods
has_costly_boom = sum(booms(i+1:i+num_periods)) > 0
if signal_issued
if has_costly_boom
A = A+1;
else
B=B+1;
end
else
if has_costly_boom
C = C+1;
else
D = D+1;
end
end
end
true_pos = A/(A+B);
true_neg = D/(C+D);
L = theta *C/(A+C) + (1-theta)* B/(B+D);
usefulness = min(theta, 1-theta) - L;
dp = true_pos - (A+C)/(A+B+C+D);
Examples
NOTE: Numbers used in the examples are arbitrary valid values.
They do not necessarily represent a realistic or plausible scenario.
indicator = [.15 .50 .7 -.14 .10 .45 .64 .75 .7 .2 ...
.15 .34 .86 .84 0.39 0.1 0.4 .45 .5 .5]';
booms = [0 0 0 0 0 0 0 1 0 0 ...
0 0 1 0 0 0 0 0 0 0]';
num_periods = 3;
percentile = .7;
theta = .2;
[true_pos true_neg usefulness dp] = early_warning_signal( ...
indicator, booms, theta, percentile, num_periods);
References