I'm trying to understand simple regression and how the model predict work. The result of predict is an array of fitted values. But what if I only want one value for example.
If I want X=11 ( expected predict to only give me 110 ) why do I still get array of output and how can I reduce to only one value ? to get 110 ?
import statsmodels.api as sm
X = [1,2,3,4,5,6,7,8,9,10]
Y = [10,20,30,40,50,60,70,80,90,100]
X = sm.add_constant(X)
model = sm.OLS(Y,X)
results = model.fit()
ypred = model.predict(11)
print(ypred)
Output :
[[ 11. 11.]
[ 11. 22.]
[ 11. 33.]
[ 11. 44.]
[ 11. 55.]
[ 11. 66.]
[ 11. 77.]
[ 11. 88.]
[ 11. 99.]
[ 11. 110.]]