FM_spot_cov

FM_spot_cov computes the spot covariance of a bivariate diffusion process via the Fourier-Malliavin estimator

Syntax

  • C_spot=FM_spot_cov(x1,x2,t1,t2,T)example
  • C_spot=FM_spot_cov(x1,x2,t1,t2,T,Name,Value)example
  • [C_spot, tau_out]=FM_spot_cov(___)example

Description

example

C_spot =FM_spot_cov(x1, x2, t1, t2, T) Example of call of FM_spot_cov with default values of N, M and tau.

example

C_spot =FM_spot_cov(x1, x2, t1, t2, T, Name, Value) Example of call of FM_spot_cov with custom choices of N, M and tau.

example

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

Examples

expand all

  • Example of call of FM_spot_cov with default values of N, M and tau.
  • The following example estimates the path of the spot covariance of a bivariate 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;0.4,0.4;2,2;1,1];
    Rho=[0.5,-0.5,0,0,-0.5,0.5];
    x0=[log(100); log(100)]; 
    V0=[0.4; 0.4];
    [x,V,t]=Heston2D(T,n,parameters,Rho,x0,V0); 
    % Spot covariance estimation
    t1=t; 
    t2=t;
    [C_spot, tau_out]=FM_spot_cov(x(:,1),x(:,2),t1,t2,T);
    M=(length(C_spot)-1)/2;   
    figure
    Cov=Rho(6)*sqrt(V(:,1)).*sqrt(V(:,2));
    plot(tau_out,Cov(1:round(n/(2*M)):end));
    hold on
    plot(tau_out,C_spot); 
    xlabel('tau'); 
    title('Spot co-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_cov with custom choices of N, M and tau.
  • The following example estimates the path of the spot covariance of a bivariate 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; 0.4 , 0.4; 2 , 2; 1 , 1 ];
    Rho=[0.5 ; -0.5 ; 0 ; 0 ; -0.5 ; 0.5];
    x0=[log(100); log(100)]; V0=[0.4; 0.4];
    [x,V,t] = Heston2D(T,n,parameters,Rho,x0,V0); 
    % Estimation of the spot covariance 
    t1=t; 
    t2=t;
    tau=0:T/50:T;
    [C_spot,tau_out]=FM_spot_cov(x(:,1),x(:,2),t1,t2,T,'N',5000,'M',100,'tau',tau);
    figure
    Cov=Rho(6)*sqrt(V(:,1)).*sqrt(V(:,2));
    plot(tau_out,Cov(1:round(n/50):end));
    hold on
    plot(tau_out,C_spot); 
    xlabel('tau'); 
    title('Spot co-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_cov when tau has length larger than 2M + 1.
  • The following example estimates the path of the spot covariance of a bivariate 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; 0.4 , 0.4; 2 , 2; 1 , 1 ];
    Rho=[0.5 ; -0.5 ; 0 ; 0 ; -0.5 ; 0.5];
    x0=[log(100); log(100)]; V0=[0.4; 0.4];
    [x,V,t] = Heston2D(T,n,parameters,Rho,x0,V0); 
    % Estimation of the spot covariance 
    t1=t; 
    t2=t;
    tau=0:T/1000:T;
    [C_spot,tau_out]=FM_spot_cov(x(:,1),x(:,2),t1,t2,T,'N',5000,'M',100,'tau',tau);
    figure
    Cov=Rho(6)*sqrt(V(:,1)).*sqrt(V(:,2));
    M=100;
    plot(tau_out,Cov(1:round(n/(2*M)):end));
    hold on
    plot(tau_out,C_spot); 
    xlabel('tau'); 
    title('Spot co-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

    x1 — Observation values of process 1. Vector.

    Row or column vector containing the observed values.

    Data Types: single| double

    x2 — Observation values of process 2. Vector.

    Row or column vector containing the observed values.

    Data Types: single| double

    t1 — Observation times of process 1. Vector.

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

    Data Types: single| double

    t2 — Observation times of process 2. Vector.

    Row or column vector with the same length of x2 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(min(length(x1),length(x2))-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(min(length(x1),length(x2))-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

    C_spot —Spot covariance of processes 1 and 2. Vector

    Values of the spot covariance of processes 1 and 2.

    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 vectors x1 and x2 contain discrete observations from a bivariate diffusion process $(x_1,x_2)$ following the Ito stochastic differential equation $$dx^i(t)= \sigma^i(t) \ dW^i(t) + b^i(t) \ dt, \quad i=1,2,$$ where $W^1$ and $W^2$ are two Brownian motions defined on the filtered probability space $(\Omega, (\mathcal{F}_t)_{t \in [0,T]}, P)$, with correlation $\rho$, while $\sigma^1, \sigma^2, b^1$ and $b^2$ are random processes, adapted to $\mathcal{F}_t$.

    See the References for further mathematical details.

    The spot covariance $c$ between the processes $x^1$ and $x^2$ at time $t \in [0,T]$ is defined as $$c(t):= \frac{d \langle x^1, x^2 \rangle_t}{dt} = \rho \sigma^1(t) \sigma^2(t).$$ Let $i=1,2$. For any positive integer $n_i$, let $\mathcal{S}^i_{n_i}:=\{ 0=t^i_{0}\leq \cdots \leq t^i_{n_i}=T \}$ be the observation times for the $i$-th asset. Moreover, let $\delta_l(x^i):= x^i(t^i_{l+1})-x^i(t^i_l)$ be the increments of $x^i$.

    The Fourier estimator of the spot covariance at time $t \in [0,T]$ is given by $$\widehat c_{n_1,n_2,N,M}(\tau)= \sum_{|k|\leq M} \left(1-{|k|\over M}\right)c_k(c_{n_1,n_2,N}) \, e^{{\rm i}\frac{2\pi}{T}k\tau},$$ where: $$c_k(c_{n_1,n_2,N})={T\over {2N+1}} \sum_{|s|\leq N} c_{s}(dx^1_{n_1})c_{k-s}(dx^2_{n_2}),$$ $$c_k(dx^i_{n_i})= {1\over {T}} \sum_{l=0}^{n_i-1} e^{-{\rm i}\frac{2\pi}{T}kt^i_l}\delta_{l}(x_i).$$

    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