Diego Aguado
Diego Aguado

Reputation: 1596

How to save in a variable significance of a coefficient estimated by OLS using statsmodels in python?

I performed a linear regression(OLS) using statsmodels.formula.api and showing the paramenters and summary the following way:

 result = sm.ols(formula="items ~ views + price", data=nvo).fit()
 print result.params

This is very usefull but I would like to save the significance of a the coefficient of price in a variable, how can I acces the elements of the summary object? Specificly how can I save the R squared, significance and the confidence interval?

Upvotes: 0

Views: 1072

Answers (1)

Diego Aguado
Diego Aguado

Reputation: 1596

Oh, I managed to answer my own question. You just have to go ahead and do the following:

print result.pvalue
print result.conf_int()
print result.rsquared

Upvotes: 1

Related Questions