0

I am trying to use statsmodels predict method for a multiple linear regression analysis in Python but I always get the same error:

TypeError: RegressionModel.predict() got multiple values for argument 'params'

After running model = sm.OLS(y_train, X_train).fit() I obtained the regression coefficients with model.params.values and the output is as follows:

array([ -0.23481626, 56.13254025, -61.06123804, 56.10006434, -53.70845756, -10.98175732, 26.32430393, 3.36806063, -10.48230617])

at this point I tried to make predictions:

X_test = sm.add_constant(X_test)

predictions = model.predict(params = model.params.values, exog = X_test)

but I get the error:

TypeError: RegressionModel.predict() got multiple values for argument 'params'

X_test is a pandas.core.frame.DataFrame with shape (38, 21)

I checked the official documentation at the link statsmodels.regression.linear_model.OLS.predict but could not solve the problem

any suggestions?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.