# OptimalCuttingFrequency

OptimalCuttingFrequency computes the optimal cutting frequency for the Fourier estimator of integrated variance

## Syntax

• Nopt=OptimalCuttingFrequency(x,t)example

## Description

OptimalCuttingFrequency computes the optimal cutting frequency for running the Fourier estimator of the integrated variance on noisy timeseries data.

Nopt =OptimalCuttingFrequency(x, t) Computation of the optimal cutting frequency for estimating the integrated variance from a vector x of noisy observations of a univariate diffusion process.

## Examples

expand all

### Computation of the optimal cutting frequency for estimating the integrated variance from a vector x of noisy observations of a univariate diffusion process.

% Generate data.
n=1000;
dt=1/n;
t=0:dt:1;
x=randn(n,1)*sqrt(dt);
% generate the diffusion process
x=[0;cumsum(x)];
noise_to_signal =0.5; % noise-to-signal ratio
sigma_eps = noise_to_signal*std(diff(x));
noise=sigma_eps*randn(size(x));
% add noise, which is i.i.d. N(0,sigma_eps^2)
x=x+noise;
Nopt = OptimalCuttingFrequency(x,t); % optimal cutting frequency
ivar=FE_int_vol(x,t,'N',Nopt);
disp(['The optimal cutting frequency is: ' num2str(Nopt)])
disp(['The value of the integrated variance is: ' num2str(ivar)])
The optimal cutting frequency is: 168
The value of the integrated variance is: 1.1166

## Input Arguments

### x — Observation 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

## Output Arguments

### Nopt —Optimal cutting frequency. Scalar

Integer representing the optimal cutting frequency.

We assume our timeseries data are noisy observations $\tilde x$ from a diffusion process following the Ito stochastic differential equation $$dx(t)= \sigma(t) \ dW(t) + b(t) \ dt,$$ where $W$ is a Brownian motion on a filtered probability space. Let $\sigma$ and $b$ be random processes, adapted to the Brownian filtration.

The integrated variance of the process over the time interval $[0,T]$ is defined as $$\int_0^T \sigma^2(t) dt.$$ For any positive integer $n$, let ${\cal S}_{n}:=\{ 0=t_{0}\leq \cdots \leq t_{n}=T \}$ be the observation times.

The observations are affected by i.i.d. noise terms $\eta(t_i)$ with mean zero and finite variance $$\tilde x(t_i)=x(t_i)+\eta(t_i).$$ See the Reference for further mathematical details.

Moreover, let $\delta_i(\tilde x):= \tilde x(t_{i+1})-\tilde x(t_i)$ be the increments of $\tilde x$.

The optimal cutting frequency $N$ for computing the Fourier estimator of the integrated variance from noisy timeseries data is obtained by minimization of the estimated MSE.

The Fourier estimator of the integrated variance over $[0,T]$, is then defined as $$\widehat\sigma^{2}_{n,N}:= {T^2 \over {2N+1}}\sum_{|s|\leq N} c_s(d\tilde x_n) c_{-s}(d\tilde x_n),$$ where for any integer $k$, $|k|\leq N$, the discretized Fourier coefficients of the increments are $$c_k(d\tilde x_{n}):= {1\over {T}} \sum_{i=0}^{n-1} e^{-{\rm i} {{2\pi}\over {T}} kt_i}\delta_i(\tilde x).$$

## References

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