I have the following OLS model from StatsModels:
X = df['Grade']
y = df['Results']
X = statsmodels.tools.tools.add_constant(X)
mod = sm.OLS(y,X)
results = mod.fit()
When trying to predict a new Y value for an X value of 4, I have to pass the following:
results.predict([1,4])
I don't understand why an array with the first value being '1' needs to be passed in order for the predict function to work correctly. Why do I need to include a 1 instead of just saying:
results.predict([4])
I'm not clear on the concept at work here. Does anybody know what's going on?