# How can I estimate the 2 parameters of this signal?

I have a digital signal of fixed length (e.g. 100 samples). Somewhere within this signal is a contiguous region characterized by "low variance". The remainder of the signal is characterized by significantly higher variance.

Here is an example:

I need to estimate the start-time and end-time of the "low variance" region. So, in the example above, the ideal outcome would be to estimate that the "low variance" region starts at time 14 and ends at time 38.

My first idea was to exhaustively search (2D) for the start-time $$t_0$$ and end-time $$t_1$$ that maximize the difference between the variances of the two guessed regions: $$\text{metric} = \text{var}(\boldsymbol{x}_\text{high}) - \text{var}(\boldsymbol{x}_\text{low})$$

where $$\boldsymbol{x}_\text{low}$$ denotes the vector of samples in the presumed "low variance" region (between guess $$\hat{t}_0$$ and guess $$\hat{t}_1$$), and $$\boldsymbol{x}_\text{high}$$ denotes the vector of other samples.

However, that idea doesn't work well at all. It tends to underestimate the width of the "low variance" region because adding a few samples of the "low variance" region to the "high variance" region can increase $$\text{var}(\boldsymbol{x}_\text{high})$$.

I also considered maximizing $$\left|\text{mean}(\boldsymbol{x}_\text{high}) - \text{mean}(\boldsymbol{x}_\text{low})\right|$$, but that fails if the two regions have similar means (which can happen).

What would be a better algorithm for finding this "low variance" region?

• @agone The data is unsigned and we can freely assume it's normalized between 0 and 1. The efficiency requirement ultimately boils down to silicon area in digital hardware (in my case, an FPGA). I'm not expecting computational complexity to be an issue. Commented Oct 21, 2023 at 23:17
• @agone Logs are perfectly fine on an FPGA. Commented Oct 21, 2023 at 23:23
• @agone I am not worried about the FPGA implementation at all. I would like to focus on the nature of the algorithm. Commented Oct 21, 2023 at 23:24
• There are many ways of calculating logarithms in FPGAs. Plenty of parallelizable options exist. Like I said, I am not worried about the FPGA implementation at all. Commented Oct 21, 2023 at 23:43
• Hi Harry, I remember reading about change detection in the detection theory book by Steven Kay. If you can find access to that book, I think it'll help Commented Oct 22, 2023 at 19:03

Your task is somewhat of an instance of offline change detection. Try to take a look at this and its documentation / review paper for some implemented algorithms. If you can assume your signal segments to be made up of i.i.d. samples, with the mean and variance changing between the segments, you could start with CostNormal as the applied cost function ,termed $$c_\Sigma$$ in the paper, and see if it does the job.

• Yes, the literature on "change detection" looks the most hopeful. Thanks for these specific tips. I will investigate. Commented Oct 25, 2023 at 10:25

As per signal profile given, choose a window of fix length and stride over it with fixed interval say ts, calculate the energy with each stride. When you get the energy profile with respect to each stride, identify lowest energy region(finding minima of the curve), now you just got to convert this stride to actual time series.

• How do I calculate the optimal window length? Would an energy profile be helpful if the energy could be any value in either region? Commented Oct 25, 2023 at 10:23

The low variance region can be described as the domain of the largest set of the minimal consecutive first derivative values.

At any point in the following process, a proper(Cos...) windowing method of size 3 or limited more, using mean applied would minimize the error at the expense of exact transition values.

Take the log of the absolute value of the discrete derivative:

[log(abs($$\boldsymbol{x}_\text{o}$$$$\boldsymbol{x}_\text{1}$$)),log(abs($$\boldsymbol{x}_\text{1}$$-$$\boldsymbol{x}_\text{2}$$)),...log(abs($$\boldsymbol{x}_\text{n-1}$$-$$\boldsymbol{x}_\text{n}$$))]

The minimums indicate possible regions.

Loop through finding the longest sequence of minimal values. That is your resulting set.

• I'm not sure if we can guarantee that the first differences would necessarily be smaller in one region or the other. But either way, I think we can remove the log operations because (if I understand correctly), they are redundant. Commented Oct 21, 2023 at 23:27
• Then the hard part would be to define "minimal values". How do we decide which values belong to which region? Commented Oct 21, 2023 at 23:28
• Calculate the mean across a window. Commented Oct 21, 2023 at 23:41
• What would be the size of that window? Is there an optimal window size? Commented Oct 21, 2023 at 23:42
• If smaller means better, then I guess I should just set the window size to 1? Commented Oct 21, 2023 at 23:47