Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (17.6k points)

How can I find the p-value (significance) of each coefficient?

lm = sklearn.linear_model.LinearRegression()

lm.fit(x,y)

1 Answer

0 votes
by (41.4k points)

Use statsmodels regression to pull of the p-values:

import statsmodels.api as sm

mod = sm.OLS(Y,X)

fii = mod.fit()

p_values = fii.summary2().tables[1]['P>|t|']

If you wish to learn more about Data Science, visit Data Science tutorial and Data Science courses by Intellipaat.

Browse Categories

...