I want to use a Matlab script to calculate Heston Nandi GARCH prices. I found an appropriate script online and it asks for the "unconditional variance" as an input. How do I calculate the appropriate unconditional volatility? I found this formula online: $$\sigma^2 = s^2 = \frac{1}{n-1} * \sum_{t=1}^n [r^2_t] $$

Is this the appropriate one to use? Do I take the variance according to this formula for all asset returns up to the point in time of the option I am trying to value?


Full Script: `function OptionPrice=HestonNandi(S_0,X,Sig_,T,r)

%%%%%%%%%%%%% % this function calculates the price of Call option based on the GARCH % option pricing formula of Heston and Nandi(2000). The input to the % function are: current price of the underlying asset, strike price, % unconditional variance of the underlying asset, time to maturity in days, % and daily risk free interest rate. %%%%%%%%%%%

% Author: Ali Boloorforoosh % email: a_bol@jmsb.concordia.ca % Date: Nov. 1,08

            %%%%% sample inputs %%%%%
% S_0=100;                    stock price at time t
% X=100;                      strike prices
% Sig_=.04/252;               unconditional variances per day
% T=30;                       option maturity
% r=.05/365;                  daily risk free rate


% function Integrand1 and Integrand2 return the values inside the 
% first and the second integrals

function f1=Integrand1(phi)

function f2=Integrand2(phi)

% function that returns the value for the characteristic function
function f=charac_fun(phi)

    phi=phi';    % the input has to be a row vector

    % GARCH parameters
    lam_=-.5;                   % risk neutral version of lambda
    g=150;                      % gamma coefficient
    g_=g+lam+.5;                % risk neutral version of gamma
    w=Sig_*(1-b-a*g^2)-a;       % GARCH intercept

    % recursion for calculating A(t,T,Phi)=A_ and B(t,T,Phi)=B_

    for i=2:T-1

    A_=A(:,1)+phi.*r+B(:,1).*w-.5*log(1-2.*a.*B(:,1));                    % A(t;T,phi)
    B_=phi.*(lam_+g_)-.5*g_^2+b.*B(:,1)+.5*(phi-g_).^2./(1-2.*a.*B(:,1)); % B(t;T,phi)

    f=f'; % the output is a row vector




  • $\begingroup$ This might help you: quant.stackexchange.com/questions/26357/… $\endgroup$ – Quantuple Jun 17 '16 at 6:56
  • $\begingroup$ Thanks for the link, it shows the relationship of $ \omega $ and unconditional variance, which the script I posted uses to calculate $ \omega $ . How can I find the unconditional variance that is required as an input though? Thanks! $\endgroup$ – SW7 Jun 17 '16 at 11:48
  • $\begingroup$ This might help you: quant.stackexchange.com/questions/26076/… $\endgroup$ – Quantuple Jun 17 '16 at 11:55
  • $\begingroup$ Thanks for your quick reply. Does this mean that I can simply use the sample variance of, say, the past 20 values of log asset returns as an input and should receive an accurate result? Is this the way the HN-GARCH is usually implemented? Sorry for all the questions, I have looked this up but could not find any info that seemed to serve the script I want to use. $\endgroup$ – SW7 Jun 17 '16 at 12:33
  • $\begingroup$ So I suppose what I am really asking is how do I implement the specific code above? What do I use for $\sigma$ ? $\endgroup$ – SW7 Jun 17 '16 at 19:29

I'm not sure if you still need an answer, however, if you take a look at the original paper of Heston&Nandi (2000) you will find that "Sig_" as defined in your code, is similar to their annualized long-run volatility (P.579), except that here it is not annualized.


solving this for $\omega$ leads to what your code calls "GARCH intercept".

Furthermore, in your implementation


which is


As you can see, "Sig_" should be the conditional variance of the following time step (in the single-lag case).

Therefore, from what i understand, "Sig_" here is simply an arbitrary starting value for h(0), i.e., the conditional variance.

To answer your question, yes, one could set it equal to the sample variance, but also to any other reasonable value. It barely has any effect on the result and due to the strong mean reversion property of the conditional variance it doesn't matter for longer return samples (few hundred observations).

You should also keep in mind that you have to estimate your own parameters for the data you are using.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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