File
optimal_gap_thresholds.m
Name
optimal_gap_thresholds
Synopsis
optimal_gap_thresholds - Calculates the optimal gap thresholds according to nts ratio and true positive rate 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
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.']);
% We check only integer thresholds as in the paper
nts = zeros(max_thresholds(1), max_thresholds(2));
true_positives = zeros(max_thresholds(1), max_thresholds(2));;
for i=1:max_thresholds(1)
for j=1:max_thresholds(2)
thresholds = [i;j];
[noise_to_signal num_predicted_crises] = joint_gap_indicators( ...
indicators_series, thresholds, is_crisis_series, horizon);
nts(i,j) = noise_to_signal;
true_positives(i,j) = num_predicted_crises;
end
end
% Find the optimal thresholds for the nts objective
[vals ind] = min(nts);
[val index] = min(vals);
nts_thresholds = [ind(index);index];
% Find the optimal thresholds fpr the true positive objective
[vals ind] = max(true_positives);
[val index] = max(vals);
true_positive_thresholds = [ind(index);index];
Examples
NOTE: Numbers used in the examples are arbitrary valid values.
They do not necessarily represent a realistic or plausible scenario.
indicators_series = ...
[1.7 1.8 1.5 3.0 4.2 5.3 3.2 3.6 3.4 2.3 2.1 8.0 1.0 0.5 2.2; ...
130 132 120 124 130 124 140 165 180 140 130 120 132 129 110]';
max_thresholds = [1; 20];
horizon = 3;
is_crisis_series = [0 0 0 0 0 0 0 0 0 0 0 0 1 0 0]'
[nts_thresholds, true_positive_thresholds] ...
= optimal_gap_thresholds(indicators_series, is_crisis_series,horizon, ...
max_thresholds);
References