# Why my Deming Regression line change so much when switching variables? If they seem to be a linear relationship betwen them?

I am trying to fit a line that best predicts the production of energy Y given the speed of wind X, a typical Y = xm + b , using deming regression. I am looking for the slope and the intercept of that line using the following formula:

I assume that 𝛿 = 1.

This is my following python implementation of deming regression:

def deming_regresion(df, X, y, delta = 1):
'''Takes a pandas DataFrame, name of the
columns as strings and the value of delta,
and returns the slope and intercept following deming regression formula'''

cov = df.cov()
mean_x = df[X].mean()
mean_y = df[y].mean()
s_xx = cov[X][X]
s_yy = cov[y][y]
s_xy = cov[X][y]

slope = (s_yy  - delta * s_xx + np.sqrt((s_yy - delta * s_xx) ** 2 + 4 * delta * s_xy ** 2)) / (2 * s_xy)

intercept = media_y - pendiente  * media_x

return slope, intercept


I meassure the % of MSE and MAE in the predictions and I get the following results when trying to predict Y = Energy Production and X = Wind Speed:

And the % of MSE and MAE are (MSE 97.72, MAE 69.85), slope, intercept of 17.85353671, -345.34106788.

When I switch variables, X = Energy Production and Y = Wind Speed I get this:

With these % of errors (MSE 44.9, MAE 32.23) and slope intercept of 0.04957782881808902, 21.051520903377014.

Why this happens? What am I doing wrong? I used Orthogonal Regression from scipy because my delta is equal to 1 and I still get very similar results. Maybe is a very stupid question but I will appreciate your help.

If you need any more info you can ask, I tried to put as much info as I could but maybe I missed something important.