0

Im using following code to train my model

trip_model = sm.OLS(x_dependent, y_variables).fit()

and print summary as

trip_model.summary()

I just want to take only the following values out of Summary

F-statistic , coef

how to get it?

Vivek Kumar
  • 35,217
  • 8
  • 109
  • 132
syv
  • 3,528
  • 7
  • 35
  • 50
  • This is a statsmodel class, not related to scikit-learn. Removing that tag. – Vivek Kumar Apr 10 '18 at 10:46
  • Possible duplicate of [How to extract a particular value from the OLS-summary in Pandas?](https://stackoverflow.com/questions/37508158/how-to-extract-a-particular-value-from-the-ols-summary-in-pandas) – Vivek Kumar Apr 10 '18 at 10:47

1 Answers1

1

The value returned by the fit function is a RegressionResults structure. You can check the documentation to see how to access each particular value:

f_statistic = trip_model.fvalue
coef = trip_model.params
jdehesa
  • 58,456
  • 7
  • 77
  • 121
  • Yes., this link helped http://www.statsmodels.org/devel/generated/statsmodels.regression.linear_model.RegressionResults.html – syv Apr 10 '18 at 10:55