Although this question is a programming question and would, therefore, be more suitable for StackOverflow, I would like to address the question over here given that it is the result of a rather unknown method for non-statisticians, and I was hoping other people may have encountered the same issue.

I am testing the GEE with a small dataset in Python. When I use the independent or exchangeable covariance matrix, it works perfectly fine. However, when I attempt to use the autoregressive covariance matrix, I get a # ValueError: Not a bracketing interval. What may be the reason for that error?

The dataset consists of several different variables, but has only five samples. In the GEE, I use one group, and the time variable is the cumulative sum of dur_int_sec:

    eda_t_filt         SDNN  dur_int_sec
0    -0.181794   126.970082    65.691406 
1     0.130116   130.083402    98.619141
2    -0.106355   113.451393   129.865234
3     0.005535    90.197269   343.261719
4     0.013384   112.712131   241.161132

# The code
ar = sm.cov_struct.Autoregressive()
gee_by_task_ar = sm.GEE.from_formula("SDNN ~ eda_t_filt", \    
    groups=np.ones(5), data=by_task, time=np.cumsum(by_task.dur_int_sec), cov_struct=ar)
gee_by_task_ar_res = gee_by_task_ar.fit() # ValueError: Not a bracketing interval.

The complete error:

Traceback (most recent call last):
  File "<pyshell#50>", line 1, in <module>
    gee_by_task__ar_res = gee_by_task_ar.fit() # ValueError: Not a bracketing interval.
  File "D:\Python27\lib\site-packages\statsmodels\genmod\generalized_estimating_equations.py", line 1113, in fit
  File "D:\Python27\lib\site-packages\statsmodels\genmod\generalized_estimating_equations.py", line 1261, in _update_assoc
  File "D:\Python27\lib\site-packages\statsmodels\genmod\cov_struct.py", line 768, in update
    self.dep_params = brent(fitfunc, brack=[b_lft, b_ctr, b_rgt])
  File "D:\Python27\lib\site-packages\scipy\optimize\optimize.py", line 2003, in brent
    res = _minimize_scalar_brent(func, brack, args, **options)
  File "D:\Python27\lib\site-packages\scipy\optimize\optimize.py", line 2035, in _minimize_scalar_brent
  File "D:\Python27\lib\site-packages\scipy\optimize\optimize.py", line 1841, in optimize
    xa, xb, xc, fa, fb, fc, funcalls = self.get_bracket_info()
  File "D:\Python27\lib\site-packages\scipy\optimize\optimize.py", line 1829, in get_bracket_info
    raise ValueError("Not a bracketing interval.")
ValueError: Not a bracketing interval.

1 Answer 1


The variables in your model formula do not exist in the data you provided, so I'm not sure what you are trying to do here.

But in general, I have seen this AR covariance structure fail when the data are a poor fit to the AR model. The error message could be improved, but I suspect that is what is going on here.

  • $\begingroup$ Selected the wrong columns excuse me. But you think the problem could be that there is too little data? $\endgroup$ Nov 5, 2016 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.