This is an attempt to reproduce some results presented in Bayesian Spectrum Estimation of Unevenly Sampled Nonstationary Data by Qi et al.
They attacked the problem of spectral estimation. Traditional methods assume stationarity and uniform spacing between samples of data. To overcome those limitations, Qi et al. used a non-stationary Kalman filter to jointly estimate all spectral coefficients instantaneously.
The Matlab code was tested on Octave 4.2.2 and ought to work fine with any non-ancient Matlab / Octave version.
User inputs:
sigtrue
: This is the standard error of the true observation noise.dt
: The specifies the time interval between two observations. We assume that the observations were evenly sampled, but the technique can handle unevenly sampled data.t
: It is the times at which the data were sampled.f_true
: The frequency of the observations.f
: An array storing the frequency bands.beta
: This parameter controls how fast the amplitude of the signal varies.
The priors can be modified:
z
: This scales the process noise (default:z=1000
).m0
andv0
: Those are the mean and variance of the initial state respectively. The mean is supposed to be zero, and the variance to be diagonal (default: diagonal elements are equal to 100).
kfiltering
calls the Kalman filter and ksmoothing
calls the Kalman smoother.
The Kalman smoother requires the results from the Kalman filter.
How to use the code is best illustrated in the test file test_sine_125.m
whose results are presented in the next section.
We synthesize an evenly sampled signal that contains one 125Hz sinusoid wave modulated
with an exponentially fast decaying amplitude.
We test all frequencies from 1Hz to 125Hz. The signal is plotted over T=[0:2]
with a discretization dt=0.002 (it must be smaller than 0.004, the inverse gives the Nyquist sampling rate).
All parameters are set to their defaults if not explicitly specified, in particular z=1000
.
The variance (filled area in red in the previous figure) is huge and so useless. This is to be ascribed to the large value of z
.
A large value means that the amplitude of the frequencies can change a lot from one time-step to the next. Even if the
decay is exponential, this does not hold. The figure below shows much better predictive results with z=1
.
- It is assumed that the signal is composed of only a few number of frequencies. The model has no built-in device to induce sparsity. We will set a spike and slab prior on the state. This is a natural way to express a prior belief that most frequencies are exactly zero.
- The treatment could be done using variational Bayesian methods as in Unified Inference for Variational Bayesian Linear Gaussian State-Space Models by Barber and Chiappa.
Laurent de Vito
All third-party libraries are subject to their own license.
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.