I am trying to fit a linear regression model implemented in statsmodels library.
I have a doubt regarding the fit() method. Let's say I have data sample of size 15 and I broke it down into 3 parts and fit the model. Does call to each fit() will fit the model properly or will it overwrite previous values.
import numpy as np
import statsmodels.api as sm
# First call
X = [377, 295, 457, 495, 9] # independent variable
y = [23, 79, 16, 41, 40] # dependent variable
X = sm.add_constant(X)
ols = sm.OLS(y,X).fit()
#print(ols.summary())
# Second call
X = [243, 493, 106, 227, 334]
y = [3, 5, 1, 62, 92]
X = sm.add_constant(X)
ols = sm.OLS(y,X).fit()
#print(ols.summary())
# Third call
X = [412, 332, 429, 96, 336]
y = [30, 1, 99, 4, 33]
X = sm.add_constant(X)
ols = sm.OLS(y,X).fit()
#print(ols.summary())
scores = [9, 219, 200, 134, 499]
scores = sm.add_constant(scores)
print(ols.predict(scores))