File
crowded_trades.m
Name
crowded_trades
Synopsis
crowded_trades - calculates the crowdedness per factor using definition 1 or definition 2 in Pojarliev et al. (2011).
Introduction
Pojarliev and Levich (2011) propose a method for detecting crowded trades in the currency fund world, but their approach may be used to measure the popularity or crowdedness of any trade with an identifiable time-series return. They focus on currency funds because they have access to a new database of daily currency fund data. The high-frequency data in their sample allowed them to develop measures of crowdedness over economically relevant horizons. They define style crowdedness as the percentage of funds with significant positive exposure to a given style less the percentage of funds with significant negative exposure to the same style. To estimate crowdedness, they use data from 107 currency managers that cover the period from April 2005 to June 2010.
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.']);
% If we do not specify the threshold then set it to 1.96 (5% significance)
if nargin < 4
threshold = 1.96;
end
num_factors = size(factor_returns, 2);
if (factor_index > num_factors ) || (factor_index < 1)
error('Bad factor index.');
end
% We need to have the same days for returns of factors and returns of funds
if size(funds_returns,1)~=size(factor_returns,1)
error('Unequal number of days for funds and factors');
end
num_days = size(funds_returns, 1);
num_funds= size(funds_returns, 2);
% Initialize
positive_funds = 0;
negative_funds = 0;
for i = 1:num_funds
output = funds_returns(:,i);
% Regress each fund's returns on the factors and a constant
whichstats = {'beta', 'tstat'};
stats = regstats(output,factor_returns,'linear',whichstats);
betas = stats.beta;
t_stat = stats.tstat.t;
if nargin < 4
% Check significance for the particular factor
t_stat_factor = t_stat(factor_index+1);
if t_stat_factor > threshold
positive_funds = positive_funds + 1;
end
if t_stat_factor < -threshold
negative_funds = negative_funds + 1;
end
end
if nargin == 4
% Check the value of beta with respect to the threshold
beta_factor = betas(factor_index+1);
if beta_factor > threshold
positive_funds = positive_funds + 1;
end
if beta_factor < -threshold
negative_funds = negative_funds + 1;
end
end
end
crowdedness = (positive_funds - negative_funds)/num_funds;
Examples
NOTE: Numbers used in the examples are arbitrary valid values.
They do not necessarily represent a realistic or plausible scenario.
factor_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];
funds_returns = ...
[-0.0805,-0.0510, 0.0438, 0.0614, 0.0243;
-0.1051,-0.1011,-0.0079, 0.0591,-0.0500;
-0.1108,-0.0928, 0.1030, 0.0155,-0.0915;
0.1055, 0.1013,-0.0990,-0.0790,-0.0718;
-0.0816, 0.0644,-0.2163, 0.0651, 0.1410];
factor_index = 1; threshold=.6
crowdedness_test1 = crowded_trades(funds_returns, factor_returns, ...
factor_index, threshold);
crowdedness_test2 = crowded_trades(funds_returns, factor_returns, ...
factor_index);
References