Table of Contents


File

joint_gap_indicators.m

Name

joint_gap_indicators

Synopsis

joint_gap_indicators - Calculates the signal-to-noise (SNR) ratio and the number of predicted crises of joint signal indicators for particular thresholds based on Borio et al. (2009).

Introduction

NOTE: PART OF A SET OF 2 RELATED FILES:

Borio (2009) construct macroeconomic early warning indicators to predict banking sector crises by extending the framework of Borio and Lowe (2004). The three indicators used are the property price gap, the (real) equity price gap, and the credit gap. This approach is grounded in the endogenous-cycle view of financial instability. The authors argue that the coexistence of unusually rapid credit growth and asset prices indicate the build-up of financial imbalances that raise the likelihood of subsequent financial distress.

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

indicators_series
Name:
indicators_series
Description:

The joint signal indicators yearly time series.

Type:
float
Range:
(-inf,+inf)
Dimensions:

Tx2 matrix

  1. Rows represent dates.
  2. Columns represent different signal indicators.

thresholds
Name:
thresholds
Description:

The thresholds used to signal a crisis.

Type:
float
Range:
(0,+inf)
Dimensions:

2x1 matrix

  1. Rows represent indicators.

is_crisis_series
Name:
is_crisis_series
Description:

This value signals a crisis with a value of 1. Note: values are yes/no flags, represented as 1/0 values, respectively.

Type:
float
Range:
{0, 1}
Dimensions:

Tx1 matrix

  1. Rows represent dates. In the paper it is set 1 to 3 years

horizon
Name:
horizon
Description:

Indicates the number of periods in advance for which the early warning signal will be generated, e.g. data from t-6 will predict signal at t.

Type:
integer
Range:
{0,T}
Dimensions:

scalar


Outputs

nts
Name:
nts
Description:

Noise-to-signal ratio defined as Type-II errors / 1 - Type-I errors.

Type:
float
Range:
(0,+inf)
Dimensions:

scalar


num_predicted_crises
Name:
num_predicted_crises
Description:

The number of crises predicted.

Type:
integer
Range:
{0,K}
Dimensions:

scalar


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.']);




num_years = size(indicators_series,1);
buffer_length = 10;

successes = 0;
false_alarms = 0;
missed_crises = 0;
negative_successes = 0;

% We need to have at least 10 years of data
if num_years < buffer_length
    error('Not enought years of data.');
end

% We 'll run the HP filters from year buffer_length to num_years-horizon 
gaps = zeros(num_years-buffer_length+1-horizon,2);
for t=buffer_length:num_years-horizon
    for i=1:2
        trend = hpfilter(indicators_series(1:t,i),1600);
        % Gap is the difference of the value of the time_series and the
        % trend
        gaps(t-buffer_length+1,i) = trend(t) - indicators_series(t,i);
    end

    % If both of the gaps are greater than the corresponding thresholds
    % then we have a signal that there will be a crisis in the next horizon
    % years
    if sum(gaps(t-buffer_length+1,:)>thresholds')==2
        if sum(is_crisis_series(t+1:t+horizon))>0
            successes = successes + 1;
        else
            false_alarms = false_alarms+1;
        end

    else
        % No crisis is predicted for the next horizon years
        if sum(is_crisis_series(t+1:t+horizon))>0
            missed_crises = missed_crises + 1;
        else
            negative_successes = negative_successes+1;
        end
    end
end


type_I_error = 0;
type_II_error = 0;
if (false_alarms + negative_successes) ~=0
    type_II_error = false_alarms/(false_alarms + negative_successes);
end
if (missed_crises + successes) ~=0
    type_I_error = missed_crises/(missed_crises + successes);
end

nts = type_II_error/(1-type_I_error);
num_predicted_crises = successes;

Examples

NOTE: Numbers used in the examples are arbitrary valid values.
They do not necessarily represent a realistic or plausible scenario.

 indicators_series = ...
 [.17 .18 .15 .30 .42 .53 .32 .36 .34 .23 .21 .80 .10 .05 .22; ...
  130 132 120 124 130 124 140 165 180 140 130 120 132 129 110]';

 thresholds = [.1; 20] ;
 horizon = 3;
 is_crisis_series = [0 0 0 0 0 0 0 0 0 0 0 0 1 0 0]';

 [nts num_predicted_crises] = joint_gap_indicators(indicators_series, ...
 thresholds, is_crisis_series, horizon);

References

Borio et al. (2009). Towards an operational framework for financial stability:" fuzzy" measurement and its consequences. Documentos de Trabajo (Banco Central de Chile), (544), 1.

Bisias et al. (2012). A survey of systemic risk analytics (Working paper #0001). Washington, DC: Office of Financial Research, 53-54.