FM_spot_vol

FM_spot_vol computes the spot volatility of a diffusion process via the Fourier-Malliavin estimator

Syntax

  • V_spot=FM_spot_vol(x,t,T)example
  • V_spot=FM_spot_vol(x,t,T,Name,Value)example
  • [V_spot,tau_out]=FM_spot_vol(___)example

Description

example

V_spot =FM_spot_vol(x, t, T) Example of call of FM_spot_vol with default values of M,N and tau.

example

V_spot =FM_spot_vol(x, t, T, Name, Value) Example of call of FM_spot_vol with custom choices of M,N and tau.

example

[V_spot, tau_out] =FM_spot_vol(___) Example of call of FM_spot_vol when tau has length larger than 2M + 1.

Examples

expand all

  • Example of call of FM_spot_vol with default values of M,N and tau.
  • The following example estimates the path of the spot volatility of a Heston model from a discrete sample. The Heston model assumes that the spot variance follows a Cox-Ingersoll-Ross model.

    % Heston model simulation
    T=1;  
    n=23400;  
    parameters=[0,0.4,2,1];
    Rho=-0.5;
    x0=log(100); 
    V0=0.4;
    [x,V,t]=Heston1D(T,n,parameters,Rho,x0,V0); 
    % Spot volatility estimation 
    [V_spot, tau_out]=FM_spot_vol(x,t,T);
    M=(length(V_spot)-1)/2;   
    figure
    plot(tau_out,V(1:round(n/(2*M)):end));
    hold on
    plot(tau_out,V_spot); 
    xlabel('tau'); 
    title('Spot volatility estimates Vs Actual values')
    legend('Actual values','Estimated values')
    Click here for the graphical output of this example (link to Ro.S.A. website).

  • Example of call of FM_spot_vol with custom choices of M,N and tau.
  • The following example estimates the path of the spot volatility of a Heston model from a discrete sample. The Heston model assumes that the spot variance follows a Cox-Ingersoll-Ross model.

    % Heston model simulation
    T=1; 
    n=23400;  
    parameters=[0,0.4,2,1];
    Rho=-0.5;
    x0=log(100); 
    V0=0.4;
    [x,V,t]=Heston1D(T,n,parameters,Rho,x0,V0); 
    % Spot volatility estimation
    tau=0:T/50:T;
    [V_spot, tau_out]= FM_spot_vol(x,t,T,'N',5000,'M',100,'tau',tau);
    figure
    plot(tau_out,V(1:round(n/50):end));
    hold on
    plot(tau_out,V_spot); 
    xlabel('tau'); 
    title('Spot volatility estimates Vs Actual values')
    legend('Actual values','Estimated values')
    Click here for the graphical output of this example (link to Ro.S.A. website).

  • Example of call of FM_spot_vol when tau has length larger than 2M + 1.
  • The following example estimates the path of the spot volatility of a Heston model from a discrete sample. The Heston model assumes that the spot variance follows a Cox-Ingersoll-Ross model.

    % Heston model simulation
    T=1; 
    n=23400;  
    parameters=[0,0.4,2,1];
    Rho=-0.5;
    x0=log(100); 
    V0=0.4;
    [x,V,t]=Heston1D(T,n,parameters,Rho,x0,V0); 
    % Spot volatility estimation
    tau=0:T/1000:T;
    [V_spot, tau_out]= FM_spot_vol(x,t,T,'N',5000,'M',100,'tau',tau);
    figure
    M=100;
    plot(tau_out,V(1:round(n/(2*M)):end));
    hold on
    plot(tau_out,V_spot); 
    xlabel('tau'); 
    title('Spot volatility estimates Vs Actual values')
    legend('Actual values','Estimated values')
    WARNING: estimation will be performed on the equally-spaced grid with mesh size equal to T/(2*M), provided as an output variable.
    
    Click here for the graphical output of this example (link to Ro.S.A. website).

    Input Arguments

    expand all

    x — Observed process values. Vector.

    Row or column vector containing the observed values.

    Data Types: single| double

    t — Observation times. Vector.

    Row or column vector with the same length of x containing the observation times.

    Data Types: single| double

    T — Estimation horizon. Scalar.

    Data Types: single| double

    Name-Value Pair Arguments

    Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

    Example: 'N',400 , 'M',20 , 'tau', 0:T/100:T

    N —Cutting frequency.scalar.

    If N is not specified, it is set equal to floor((length(x)-1)/2).

    Example: 'N',400

    Data Types: single | double

    M —Cutting frequency.scalar.

    If M is not specified, it is set equal to floor(floor((length(x)-1)/2)^0.5).

    Example: 'M',20

    Data Types: single | double

    tau —Estimation times.vector.

    If tau is not specified, it is set equal to 0:T/(2*M):T.

    Example: 'tau', 0:T/100:T

    Data Types: single | double

    Output Arguments

    expand all

    V_spot —Spot variance estimates. Vector

    Estimated values of the spot variance of the process.

    tau_out —Estimation times. Vector

    Coincides with the input vector tau unless the length of the latter is larger than 2M+1.

    More About

    expand all

    Additional Details

    We assume that the vector x contains discrete observations from a diffusion process $x$ following the Ito stochastic differential equation $$dx(t)= \sigma(t) \ dW(t) + b(t) \ dt,$$ where $W$ is a Brownian motion defined on the filtered probability space $(\Omega, (\mathcal{F}_t)_{t \in [0,T]}, P)$, while $\sigma$ and $b$ are random processes, adapted to $\mathcal{F}_t$.

    See the Reference for further mathematical details.

    The spot volatility of the process $x$ at time $t \in [0,T]$ is defined as $V(t):=\sigma^2(t)$.

    For any positive integer $n$, let $\mathcal{S}_{n}:=\{ 0=t_{0}\leq \cdots \leq t_{n}=T \}$ be the observation times. Moreover, let $\delta_l(x):= x(t_{l+1})-x(t_l)$ be the increments of $x$.

    The Fourier estimator of the spot volatility at time $t \in [0,T]$ is given by $$\widehat V_{n,N,M}(\tau)= \sum_{|k|\leq M} \left(1-{|k|\over M}\right)c_k(\sigma_{n,N}) \, e^{{\rm i}\frac{2\pi}{T}k\tau},$$ where: $$c_k(\sigma_{n,N})={T\over {2N+1}} \sum_{|s|\leq N} c_{s}(dx_{n})c_{k-s}(dx_{n}),$$ $$c_k(dx_{n})= {1\over {T}} \sum_{l=0}^{n-1} e^{-{\rm i}\frac{2\pi}{T}kt_l}\delta_{l}(x).$$

    References

    Mancino, M.E., Recchioni, M.C., Sanfelici, S. (2017), Fourier-Malliavin Volatility Estimation. Theory and Practice, "Springer Briefs in Quantitative Finance", Springer.

    Sanfelici, S., Toscano, G. (2024), The Fourier-Malliavin Volatility (FMVol) MATLAB toolbox, available on ArXiv.

    This page has been automatically generated by our routine publishFS