Skip to content Skip to sidebar Skip to footer

Can I Use Autoregression Modelling For Signal Denoising?

As follows, my task is to use AR modeling to remove artifacts from noisy signals. Let's say I have ECG or EMG in raw data. On IEEE I have found that this is possible via Wavelet tr

Solution 1:

As I understand it right now it is used to forecast the data.

Yes, that's a common case for AR(p) models; but in order to forecast, its parameters should be estimated and it is done over the observations you provide to it. Therefore you can have so-called "fitted values" and use them as the "denoised" version of the signal at hand. This is because AR(p) is this:

y_t = \phi_1 * y_{t-1} + \phi_2 * y_{t-2} + ... + \phi_p * y_{t-p} + e_t

where \phi_j's are the AR parameters to be estimated and e_t is assumed to be a white noise with some variance. You can see this e_t as the noise on top of the underlying signal and therefore fitted values are somewhat denoised version.

Before the software implementation, we should note that AR(p) is modelling a wide sense stationary series so if a non-stationary behaviour exists (e.g. trend / seasonality), either it should explicitly be removed first (e.g. differencing), or implicitly removed (e.g. ARI(p, d) modelling).

Here is a deliberately noisy signal:

noisy_AR

and here is the fitted values of an AR(2) model on top of it:

noisy_plus_denoised

This is what I understand from the "denoising with AR models"; the e_t component in the assumed model represents the noise, and therefore fitted values give the "denoised" version.

As for the coding part: there are many ways to fit an AR(p) model with Python libraries, but possibly the most convenient one is through statsmodels.tsa.ar_model.AutoReg:

from statsmodels.tsa.ar_model import AutoReg

model = AutoReg(your_data, lags=p)
result = model.fit()
fitted_values = result.fittedvalues

Deciding on the order of AR(p) is whole another issue, but one quick way is to look at the PACF plot of your data and see after which lag does it vanish e.g.

pacf_ex

This would indicate an AR(2) model.

Post a Comment for "Can I Use Autoregression Modelling For Signal Denoising?"