DMML
DMML

Reputation: 1452

Python 2.7- statsmodels - result.conf_int()

This post is an addition to the post found here: Python 2.7 - statsmodels - formatting and writing summary output

I got everything formatted how I need, except the confidence interval is giving me problems.

I have tried a number of different things including:

low, high = result.conf_int()

Which, when printed, returns:

 low
 Out[260]: 0

 high
 Out[261]: 1

Similarly, I've tried:

low, up = result.conf_int().T

But get the error:

 ValueError: too many values to unpack

Same thing when I try:

for item in result.conf_int().T:
     low, high = item
     print low
     print high

ValueError: too many values to unpack

I also tried looking it up both here (I have 0.4.3 and couldn't find a page for this version) and here. Neither were helpful in solving this problem.

Upvotes: 1

Views: 5839

Answers (2)

Ankur Nadda
Ankur Nadda

Reputation: 21

Use the following:

print('confidence interval of cofficients: \n', Results.conf_int())

Upvotes: -1

jseabold
jseabold

Reputation: 8283

I think you've put in pandas object to the model, so conf_int will return a DataFrame. Try something like

conf_int = results.conf_int()
print conf_int[0]
print conf_int[1]

Upvotes: 3

Related Questions