0 votes
1 view
in Data Science by (13.1k 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 (19.9k 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|']

...