Estimating GARCH parameters using fmincon
Afficher commentaires plus anciens
Hi,
I am using the following code to estimate the garch parameters. However I get the following message:
fmincon stopped because it exceeded the function evaluation limit, options.MaxFunEvals = 300 (the default value).
I have increased the value, but am getting the same message?!?!
-------------------------------------------------------------------
par0 = [0.00001,0.09,0.89];
A = [0,1,1];
b = 1;
[par,fval] = fmincon(@GarchParameters,par0,A,b,[],[],[0,0,0],[]);
--------------------------------------------------------------
function LLF = GarchParameters(par)
data = xlsread('FTSEPrices.xlsx');
Prices = data;
T = length(Prices);
LogReturns = zeros(T-1,1);
for i = 1:T-1
LogReturns(i) = log(Prices(i+1)/Prices(i));
end
AverLogReturns = mean(LogReturns);
ErrorTermSquared = (LogReturns - AverLogReturns).^2;
AverageErrorTermSquared = mean(ErrorTermSquared);
ConditionalVariance = zeros(T,1);
ConditionalVariance(1) = par(1)+par(2)*AverageErrorTermSquared + par(3)
*AverageErrorTermSquared;
for i = 2:T
ConditionalVariance(i) = par(1) + par(2)*ErrorTermSquared(i-1) + par(3)
*ConditionalVariance(i-1);
end
ConditionalVariance = ConditionalVariance(2:end);
LLF = 0.5*sum(log(ConditionalVariance))+0.5*(sum(ErrorTermSquared.
/ConditionalVariance));
--------------------------------------------------------------------
Please help
Thanks Jen
Réponses (0)
Catégories
En savoir plus sur Conditional Variance Models dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!