I want to understand this code.

rm = r(:,1); % index returns rm_0 = rm - mean(rm); rf = r(:,2); % security returns rf_0 = rf - mean(rf); [p,h] = dcc_gjrgarch(r); % p is the conditional correlations % and h is the conditional variances sm = sqrt(h(:,1)); sf = sqrt(h(:,2)); rho = squeeze(p(1,2,:)); c = quantile(rm_0,a); z = sqrt(1 - rho.^2); u = rm_0 ./ sm; x = ((rf_0 ./ sf) - (rho .* u)) ./ z; r0_n = 4 / (3 * length(rm_0)); r0_s = min([std(rm_0 ./ sm) (iqr(rm_0 ./ sm) ./ 1.349)]); h = r0_s * r0_n ^0.2; f = normcdf(((c ./ sm) - u) ./ h); f_sum = sum(f); k1 = sum(u .* f) ./ f_sum; k2 = sum(x .* f) ./ f_sum; mes = -1 .* min((sf .* rho .* k1) + (sf .* z .* k2),0);""

More Shakeel Sajjad's questions See All
Similar questions and discussions