Error using mvregress : Covariance is not positive-definite. AND Error in varm/estimate : sigma(solve,solve), logL] = mvregress(D, R, 'covtype' , 'full' , 'varformat', 'beta' , ...

5 vues (au cours des 30 derniers jours)
Hello there
I am trying to calculate the betas and alphas from the CAPM model, for 62 stocks, using a var model but i get this error message. I tested the model for less stocks and i found out that it works for 32 or less. I tried to exclude the 32th or 33th stock but it didnt make any differance. i also checked if there are any negative values at the cov matrix but there were not. Any suggestions?
X = GSPC-rf;
[T,n] = size(Y1); %Y1(36x62) = matrix with monthly returns of 62 stocks for 36 months
Mdl = varm(n,0);
[EstMdl,EstCoeffSEMdl] = estimate(Mdl,Y1,'X',X);
results = summarize(EstMdl);
% looking at variance - covariance matrix
R = cov(Y1);
len=length(R);
for i=1:len
if R(i,i)<0
disp(i)
end
end

Réponses (0)

Catégories

En savoir plus sur Atomic, Molecular & Optical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by