From equation (3.38), is the same in both cases when
The numerators are always equal, so is the same iff
This is fairly easy to do, since with overwhelming probability
import numpy as np
import pandas as pd
import statsmodels.api as sm
x, y = np.random.normal(size=100), np.random.normal(size=100)
model_1 = sm.OLS(y, x).fit()
model_2 = sm.OLS(x, y).fit()
model_1.params[0] == model_2.params[0]
False
This is fairly easy to do cheesily by letting x
= y
x = np.random.normal(size=100)
y = x
model_1 = sm.OLS(y, x).fit()
model_2 = sm.OLS(x, y).fit()
model_1.params[0] == model_2.params[0]
True