# Error when performing autoregressive GEE in Python

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", \


The complete error:

Traceback (most recent call last):
File "<pyshell#50>", line 1, in <module>
File "D:\Python27\lib\site-packages\statsmodels\genmod\generalized_estimating_equations.py", line 1113, in fit
self._update_assoc(mean_params)
File "D:\Python27\lib\site-packages\statsmodels\genmod\generalized_estimating_equations.py", line 1261, in _update_assoc
self.cov_struct.update(params)
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
brent.optimize()
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.