Closed DF-18 closed 3 years ago
Hi @DF-18 , can you please provide a copy of your dataset, if you are not using the default ones?
Hi @DF-18 , can you please provide a copy of your dataset, if you are not using the default ones?
The dataset is default. And the version of MATLAB is 2015b.
I cannot reproduce that problem on 2018A. What do you have on line 49 of bivariate_caviar.m? And on line 78? In that part of the code you eventually need to replace "parfor" statements with normal "for" statements, insert a debug breakpoint and try to see what happens here:
r_i = r(:,i);
rhs_i = sortrows(r_i(1:100),1,'ascend');
q_i = rhs_i(qo);
c(:,i) = univariate_model(r_i,q_i,a,um_beta0,options);
q(i) = q_i;
There must be something being performed in a different way that produces differently sized variables or uncompatible variables. Maybe sortrows
output, maybe fminsearch
output. No clue. But I need some debugging being performed by you.
The code in bivariate_caviar.m from line 49 is as follows:
[caviar,beta,ir_fm,ir_mf,se,stats] = bivariate_caviar_internal(r,a,cir,cse);
The code in bivariate_caviar.m from line 78 to line 85 is as follows:
parfor i = 1:2 % line 78
r_i = r(:,i);
rhs_i = sortrows(r_i(1:100),1,'ascend');
q_i = rhs_i(qo);
c(:,i) = univariate_model(r_i,q_i,a,um_beta0,options);
q(i) = q_i;
end
After replacing "parfor" in line 78 to "for", MATLAB reports another error. (see below)
Error using sortrows Too many input parameters error bivariate_caviar>bivariate_caviar_internal (line 80) rhs_i = sortrows(r_i(1:100),1,'ascend'); error bivariate_caviar (line 49) [caviar,beta,ir_fm,ir_mf,se,stats] = bivariate_caviar_internal(r,a,cir,cse); error run_cross_sectional>run_cross_sectional_internal (line 111) [caviar,~,ir_fm,ir_mf] = bivariate_caviar(r_i,ds.A); error run_cross_sectional (line 48) [result,stopped] = run_cross_sectional_internal(ds,temp,out,k,d,car,sf,fr,analyze); error run>@(ds,temp,file,analyze)run_cross_sectional(ds,temp,file,0.95,0.40,0.08,0.40,3,analyze) error run (line 159) [result,stopped] = run_function(ds,temp,out,analyze);
Ok, I found the problem but there are other sortrows calls scattered around. You have to find them and remove the last parameter ascend, basically. I will release something but it might take some time.
Ok, I found the problem but there are other sortrows calls scattered around. You have to find them and remove the last parameter ascend, basically. I will release something but it might take some time.
You are right about the sortrows funtion. Now I can get the result of the CROSS SECTIONAL part.
BTW, a paper of Engle mentioned that there are different ways to calculate LRMES, such as simulation or using a formulation of MES. Which way does this project use? I searched "LRMES" and find nothing about the calculation of LRMES.
Derived from MES in closed form. It's the formulation provided by V-Lab.
Derived from MES in closed form. It's the formulation provided by V-Lab.
Do u mean this formulation "1-exp(log(1-d)*beta)"?
Quote : This is called Long-Run Marginal Expected Shortfall or LRMES. Specifically, it is calculated as 1-exp(log(1-d)*beta), where d is the six-month crisis threshold for the market index decline and its default value is 40%, and beta is the firm's beta coefficient.
Yes, absolutely correct. But let's close this now, as we are going off-topic and I've already answered this question many times. Feel free to open other tickers if you need help!
Dear Tommaso,
I am trying to run the CrossSectional part of this project. Is it correct to edit run.m like this?(see below) BTW, nothing else changed.
measures_setup = { % NAME ENABLED ANALYZE COMPARE FUNCTION 'Component' false true true @(ds,temp,file,analyze)run_component(ds,temp,file,bw,0.99,0.98,0.05,0.2,0.75,analyze); 'Connectedness' false true true @(ds,temp,file,analyze)run_connectedness(ds,temp,file,bw,0.05,false,0.06,analyze); 'CrossEntropy' false true true @(ds,temp,file,analyze)run_cross_entropy(ds,temp,file,bw,'G',0.4,'W','N',analyze); 'CrossQuantilogram' false true true @(ds,temp,file,analyze)run_cross_quantilogram(ds,temp,file,bw,0.05,60,'SB',0.05,100,analyze); 'CrossSectional' true true true @(ds,temp,file,analyze)run_cross_sectional(ds,temp,file,0.95,0.40,0.08,0.40,3,analyze); 'Default' false true true @(ds,temp,file,analyze)run_default(ds,temp,file,bw,'BSM',3,0.08,0.45,2,0.10,100,5,0.95,analyze); 'Liquidity' false true true @(ds,temp,file,analyze)run_liquidity(ds,temp,file,bw,21,5,'B',500,0.01,0.0004,analyze); 'RegimeSwitching' false true true @(ds,temp,file,analyze)run_regime_switching(ds,temp,file,true,true,true,analyze); 'Spillover' false true true @(ds,temp,file,analyze)run_spillover(ds,temp,file,bw,10,'G',2,4,analyze); };
If the way I set is correct, I'm confused about the error that MATLAB reported.(see below)
bivariate_caviar>bivariate_caviar_internal (line 78) too many outputs error bivariate_caviar (line 49) [caviar,beta,ir_fm,ir_mf,se,stats] = bivariate_caviar_internal(r,a,cir,cse); error run_cross_sectional>run_cross_sectional_internal (line 111) [caviar,~,ir_fm,ir_mf] = bivariate_caviar(r_i,ds.A); error run_cross_sectional (line 48) [result,stopped] = run_cross_sectional_internal(ds,temp,out,k,d,car,sf,fr,analyze); error run>@(ds,temp,file,analyze)run_cross_sectional(ds,temp,file,0.95,0.40,0.08,0.40,3,analyze) error run (line 159) [result,stopped] = run_function(ds,temp,out,analyze);
I'm new to MATLAB, so maybe I'm doing a stupid thing here. How to fix the issue to get the results as expected?