# Detrending with a Gaussian kernel

Reading some papers, I've been seeing notions of "Gaussian detrending"

https://royalsocietypublishing.org/doi/10.1098/rsbl.2019.0713#d3e1047

I've seen the notion of Gaussian smoothing and such, but I am having some trouble studying Gaussian detrending.

Could someone link me a good resource on the topic or explain it to me?

Thank you

I also never heard this term before. Let's take the full quote and read it line by line.

[...] To better distinguish the signal of critical slowing down from background noise and periodic trends,

So they want to denoise the data and remove the patterns that repeat periodically. This sounds like they want to do the smoothing of the data rather than de-trending.

we preprocessed the raw case data by detrending with a Gaussian kernel. The early warning signal itself was calculated so that for a moving window centred at time index $$i$$, a corresponding kernel weight $$w_{ij}$$ was assigned to the value of the statistic (mean, variance, etc.)

They use a rolling window that moves through time. For the value at time $$i$$ it calculates the weighted statistic, using the weights obtained using the Gaussian kernel.

at index $$j$$ and then normalized so that $$N_i = \sum_j w_{ij}$$.

It's equivalent to having the weights normalized, so they sum to one.

Thus, for the time $$i$$ and statistic $$f$$, the rolling window estimator mi was defined as

$$m_i(f_j(x)) = \sum_{j=i-b+1}^i \frac{w_{ij} f_j(x)}{N_i}$$

At point $$i$$ it calculates the standard weighted average, to get the average value of the statistic $$f$$.

where the only tuning parameter is the bandwidth $$b = 40$$ (here set to 40 months, exceeding the period of malaria's seasonality to reduce any influence of seasonality on the overall trend). [...]

The tunable parameter tells the kernel how long back in time it has to look.

So they take the Gaussian kernel centered at time point $$i$$, use it to calculate the weights $$w_{ij}$$ for the surrounding points, and then use the weights to compute the weighted average. This rather smooths the data than does de-trending, but they mentioned the "periodic trends", so it sounds like they wand also to smooth out some of the periodic patterns observed in the data.

• fabiandablander.com/Deep-Warning.html so here they mention about using Guassian filter and Lowess filter to detrend, is it a similar thing as far as you can tell?
– Phil
Commented Jul 22, 2022 at 22:26
• @Phil yes, it seems so.
– Tim
Commented Jul 23, 2022 at 5:38