I'm currently working with historical index data from Yahoo Finance and would like to plot the GARCH(1,1) volatility of these indexes. I'm working with the Datafeed and Finance Tollboxes in Matlab right now, and I'm able to get the data and plot the indexes. However I'm having some difficulty understanding the following methodology to get the GARCH sigmas.

clear all;
%close all;
format short;

t = cputime;
Connect = yahoo;
dataFTSE=fetch(Connect,'^FTSE','Jan 1 1990',today, 'd');
dataN225=fetch(Connect,'^N225','Jan 1 1990',today, 'd');
dataGSPC=fetch(Connect,'^GSPC','Jan 1 1990',today, 'd');
subplot 311;
xlabel('Time (date)')
ylabel('Adjusted Close price ($)')
subplot 312;
xlabel('Time (date)')
ylabel('Adjusted Close price ($)')
subplot 313;
xlabel('Time (date)')
ylabel('Adjusted Close price ($)')
yt = get(gca,'YTick');
set(gca,'YTickLabel', sprintf('%.0f|',yt))
e = cputime - t

From then on I get the indexes in financial objects, where the prices are in cell arrays. What I think needs to happen is to fit the GARCH(1,1) model like so:


where U is a vector with just the prices of the index? I don't have a lot of experience with Matlab's data structures so any info or references will be greatly appreciated. The reason I don't want to use the R script is to have some uniformity of plots in my thesis.

--EDIT-- I'm appending some more code which I think produces the plot I was after. It should be relatively easy to vectorize the index inputs and produce different plots.

dataGSPCret = [0.0 price2ret(dataGSPC(:,end))'];
[coeff3, errors3, LLF3, innovations3, sigmas3] = ...
sigmaGSPC = fints(dataGSPC(:,1),sigmas3','retSP500',...

And then plot the GARCH variance over the daily returns.

subplot 311; hold on;
plot(retFTSE); plot(sigmaFTSE); hold off;
subplot 312; hold on;
plot(retN225); plot(sigmaN225); hold off;
subplot 313; hold on;
plot(retGSPC); plot(sigmaGSPC); hold off;
  • $\begingroup$ For anyone looking to do something similar, I believe the appended code above is what I was trying to show with GARCH. $\endgroup$
    – cmdel
    Commented Jul 12, 2012 at 8:16

1 Answer 1


You would want to use garchfit if you have it. If you don't have access to that you could use the MFE toolbox.

Anyway, as for the inputs, it could be a vector with a constant mean of zero. This would be like fitting an AR(p) model to the prices and then estimating the Garch parameters on the residuals.

EDIT: Matlab has updated the Econometrics toolbox in recent years so that one would no longer use the garchfit function. These are instructions on how to convert the older garchfit code into the current code.

  • $\begingroup$ Any links to using GARCH without the econometrics toolbox? $\endgroup$
    – WJA
    Commented May 11, 2017 at 9:53
  • 1
    $\begingroup$ @JohnAndrews Looks like the link above was dead. You can use the MFE toolbox to fit GARCH models in Matlab without the Econometrics toolbox. $\endgroup$
    – John
    Commented May 11, 2017 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.