File
turbulence.m
Name
turbulence
Synopsis
turbulence - calculates turbulence per period using mahalanobis distance and characterizes turbulent periods based on desired q-percentile distribution threshold based on Kritzman et al. (2010)
Introduction
NOTE: PART OF A SET OF 2 RELATED FILES:
Kritzman and Li (2010) define financial turbulence as a condition in which
asset prices, given their historical patterns of behavior, behave in an
uncharacteristic fashion, including extreme price moves, decoupling of
correlated assets, and convergence of uncorrelated assets. They quantify
turbulence via the Mahalanobis distance (see Merton (1937)), which measures
the statistical unusualness of a set of returns given their historical
pattern of behavior. Their measure is very general and can be applied across
asset classes for which time-series return data are available.
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.']);
num_days = size(asset_returns,1);
% Find the mean return and covariance of asset returns
mu = mean(asset_returns, 1)';
Sigma = cov(asset_returns);
turbulence_series = zeros(num_days,1);
% Calculate the turbulence for each period
for i=1:num_days
y = asset_returns(i,:)';
turbulence_series(i) = (y-mu)'*inv(Sigma)*(y-mu);
end
% Find the threshold that characterizes turbulence
threshold = prctile(turbulence_series,100*q);
% Find the turbulent periods
turbulent_periods = find(turbulence_series > threshold);
Examples
NOTE: Numbers used in the examples are arbitrary valid values.
They do not necessarily represent a realistic or plausible scenario.
asset_returns = ...
[ 0.0595, 0.1211,-0.0806;
-0.1091, 0.0897,-0.0254;
0.0901, 0.0714,-0.0915;
0.1086, 0.0033,-0.1173;
0.0614, 0.0151, 0.0291];
q = .75;
[turbulence_series, threshold, turbulent_periods] = ...
turbulence(asset_returns, q);
References