Estimating GARCH parameters using fmincon
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Conditional Variance Models 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!