So I am faced with a problem for which I can't find a simple solution. I have attached an image of my basic explanation of the problem. enter image description here

In the above image, we have two signals that have portions of high correlation and portions of low correlation. You can observe that the highly correlated points fall on this line with slope 1. I want to identify those points via some linear-regression model. So the idea is as follows:

Given a red line with a perfect slope (=1), we have the following linear-regression model

$y_{MODEL} = mx + b + \epsilon$

Here, $\epsilon$ is the error bounded by 95% confidence interval of this model.

Now, given two signals, $S_1$ and $S_2$, I want to see whether they fall within this model (and specifically) fulfill the criteria of being within 95% of the regression data confidence intervals. My problem is I don't know how I can fit a linear regression model to $S_1$ and $S_2$.

In theory, what I'd like to do is apply some type of constraint optimization that takes some coupled value of $S_1$ and $S_2$, sees which of those falls within the 95% bounds of $y_{MODEL}$.

I'm also not against using a whole different method, as long as I can find the highly correlated points between $S_1$ and $S_2$. I'd appreciate any guidance with this and it would be very helpful if I can get some reference to some code (I'm doing this in MATLAB) but Python is fine too.


1 Answer 1


If I were you I would try first to use logarithmic transformation and bring the values close to each other. In that case you would have a linear relationship sattisfied.

import numpy as np
data = np.log(data)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.