Sort returns into quintiles rebalance monthly not enough input arguments

1 回表示 (過去 30 日間)
Emily Read
Emily Read 2019 年 7 月 11 日
回答済み: Steven Lord 2019 年 7 月 15 日
Hello everyone
I want to sort some return data (matrix of 4280 rows, 7380 columns from 1996 to 2012) into quintiles at the start of each month. They need to be sorted by their dispersion betas (conData) from the previous month.
I have already defined and opened each of the 6 input variables in the same workspace.
However, when I press run, my immediate error is:
Error using CSD_portfolioReturnsMONTHLY (line 25)
Not enough input arguments.
Could anyone help me with this issue please?
I have attached a sample of the 'thedata' file
My code (CSD_portfolioReturnsMONTHLY) is:
% Portfolios are rebalanced MONTHLY
% INPUT
% 'thedata' is a Nx(M+2) matrix of spot returns, structured as [datenum retMkt ret(1) ret(2) ... ret(M)]
% 'conData' is a Nx(M+2) matrix of dispersion betas on which returns will be conditioned, structured as [datenum conMkt con(1) con(2) ... con(M)]
% 'weightData' is a Nx(M+2) matrix of values for constructing weights, structured as [datenum weightTOTAL weight(1) weight(2) ... weight(M)]
% 'NQ' is the number of quartiles at which data will be assigned
% 'CSAD' is a Nx2 matrix, structured as [datenum CSAD]
% 'FF' is a Nx3 matrix, structured as [datenum FF(1) FF(2)]
% OUTPUT
% 'outputRet' is a Nx(NQ+4) matrix of portfolio returns (mktCap-weighted), structured as [month year ret(1) ret(2) ... ret(NQ) ret(>0) ret(<0)]
% 'outputBetaDisp' is a Nx(NQ+4) matrix of portfolio CSAD betas (PRE-formation), structured as [month year beta(1) beta(2) ... beta(NQ) beta(>0) beta(<0)]
% 'outputBetaPost' is a Nx(NQ+4) matrix of portfolio CSAD betas (POST-formation), structured as [month year beta(1) beta(2) ... beta(NQ) beta(>0) beta(<0)]
% 'outputRetEW' is a Nx(NQ+4) matrix of portfolio returns(equally-weighted), structured as [month year ret(1) ret(2) ... ret(NQ) ret(>0) ret(<0)]
% 'alphasCAPM' is a Nx(NQ+4) matrix of portfolio alphas (POST-formation) based on the CAPM, structured as [month year alpha(1) alpha(2) ... alpha(NQ) alpha(>0) alpha(<0)]
% 'alphasFF' is a Nx(NQ+4) matrix of portfolio alphas (POST-formation) based on the FF model, structured as [month year alpha(1) alpha(2) ... alpha(NQ) alpha(>0) alpha(<0)]
% 'mktCapT' is a Nx(NQ+4) matrix of portfolio total mkt Cap, structured as [month year mktCapT(1) mktCapT(2) ... mktCapT(NQ) mktCapT(>0) mktCapT(<0)]
function [outputRet outputBetaPre outputBetaPost outputRetEW alphasCAPM alphasFF mktCapT FCSAD] = CSD_portfolioReturnsMONTHLY(thedata, conData, weightData, NQ, CSAD, FF)
thedata = sortrows(thedata,1);
conData = sortrows(conData,1);
weightData = sortrows(weightData,1);
The code continues from there...

回答 (1 件)

Steven Lord
Steven Lord 2019 年 7 月 15 日
When you press the green triangle in the Editor (which I assume is what you mean when you said "when I press run") that attempts to run your code with no input arguments. Your function requires at least three inputs (and probably all six it is defined to accept) and so you can't run it using that green triangle by default.
You can click the small downward-pointing triangle before the word Run on that button and type code to run that calls your function with the inputs in your workspace. Then pressing the green triangle will execute that code instead of calling your function with no input arguments.

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by