Hi all, I have plotted a Y vs X and then fitted the plot with a straight line. Now, ideally, there shouldn’t be any correlation b/w Y and X but I can see a slope (let’s say m1) in the fitted line so wanted to make a small correction in the Y ONLY. (something like Y_new = Y */+ some factor)
that means, after correcting the Y, the newly fitted line in the Y_new vs X will have a slope zero. Now I understand that I have to rotate the fitted line by some angle about a point (x0,𝑦0) in the +/- direction to get the Y_new. (seems like choosing the point can also be tricky but for the moment let’s take any point on either end of the boundary) But not sure how can I achieve this mathematically and in the code as well. Sorry if it seems trivial, I am kind of confused about it. A part of the plotting routine and fitting of the plot is given below
thanks for your note. unfortunately, it didn’t work. Also, I have tried similar corrections before; mostly meaningful hits and trials method; adding or multiplying constants. Needless to say, didn’t work either. However, I was looking for a more generalized way to rotate the fitted line regardless of the initial positive or negative slope. kind of Euler rotations that will correct the Y. I hope it makes some sort of sense.
If you want a horizontal line from that fit, the first problem is where do you want that horizontal line; if the fit is y = a*x + b, do you want y=b? or at what point of the original line? Or just fit a horizontal line to the data in the first place.
the point on either end would do and rotate the line accordingly. Like if there is a negative slope to the correlation and we choose left most point OR right most point of the original fit then the rotation would be counter-clockwise to make it Y_new = b.
Similarly, if the original fit has a positive slope, the rotation would be clockwise w.r.t both endpoints of the fit to make it Y_new = b. Makes sense?
Your assumption is right. ‘Slope1’ is from the original fit and I was trying to correct the new_Y based on Y_old - slope1/sqrt(x); Isn’t that what this suggestion of yours means?