>> Home >> Resources & support >> FAQs >> xtgee reports convergence not achieved

## Why does xtgee sometimes report that convergence was not achieved?

 Title xtgee reports convergence not achieved Authors William Gould, Brian Poi, and Vince Wiggins, StataCorp

### Question:

I attempted to fit a model using xtgee with an exchangeable correlation matrix but received the message “exchangeable correlation matrix not positive definite. Convergence not achieved.” If I used other correlation matrix structures, I sometimes received a similar error message.

In this FAQ, we assume that you are not getting the “convergence not achieved” error message because xtgee has performed the maximum number of iterations. If that limit is being reached, you should try specifying a higher number in the iterate() option of xtgee or increase the maximum number of iterations by using set maxiter.

### Background: Exchangeable correlation

Suppose that we want to fit a Gaussian-family, identity link xtgee model with exchangeable correlation; i.e.,

         y_it = X_it*b + u_it                         (1)


where u_it has correlation matrix

               +-                -+
|  1  p  p  ...  p |
|  p  1  p  ...  p |
|  p  p  1  ...  p |                   (2)
|  .               |
|  .               |
|  p  p  p  ...  1 |
+-                -+


In the above, vector b and scalar p are to be estimated.

This model commonly arises in a random-effects context. One assumes that

                u_it = v_i + e_it                     (3)


where v_i are fixed constants within panel and e_it are independent.

The random-effects equation (3) implies a constant correlation matrix (2), and in fact p is

                            s2_v
p =   ------------
s2_v + s2_e


where s2_v is the variance of v_i and s2_e is the variance of e_it. Thus p will be positive.

When p is positive, there is no problem.

The xtgee model, that is, the model in (1) and (2), is more general than the random-effects model in that p can be negative as well. Sometimes the population value of p may be less than 0.

Exchangeable correlation models with p < 0 can have substantive problems.

Below we consider such models more carefully.

### Negative-correlation matrices

Correlation matrices must be positive definite or at least positive semidefinite. That sounds arcane, but it has important implications. Consider the matrix

                +-               -+
|    1  -.8  -.8  |
|  -.8    1  -.8  |
|  -.8  -.8    1  |
+-               -+


The above matrix is not positive definite; its determinant is -1.944.

Therefore, it cannot be a correlation matrix. Try all you want, but you cannot generate data for three variables with the above correlations.

This outcome should not surprise you. Rather than -.8, let’s use -1:

                +-               -+
|    1   -1   -1  |
|   -1    1   -1  |
|   -1   -1    1  |
+-               -+


You cannot create three variables correlated like this. If x1 and x2 are correlated -1, and x2 and x3 are correlated -1, x1 and x3 have to be correlated +1. Said mathematically: the above matrix is not positive definite.

So p = -1 does not work and p = -.8 does not work. Do any negative numbers work? Yes. For a 3 x 3 matrix, p > -.5 produces a positive-definite matrix, i.e., a valid correlation matrix.

For 4 x 4 matrices, the cutoff is -.333.... If p > -.333..., it is a valid correlation matrix, and if p ≤ -.3333..., it is not.

The formula for the cutoff is

                max_neg_corr  =  -1 / (n-1)


which leads to the following table:

                             max
n     neg. corr.
---------------------------
2        -1
3         -.5
4         -.33333...
5         -.25
11         -.1
101         -.01
1,001         -.001
1,000,001         -.000001
---------------------------


### Application to GEE model

Thus, if you have constant negative correlation,

               +-                -+
|  1  p  p  ...  p |
|  p  1  p  ...  p |
|  p  p  1  ...  p | ,     p < 0
|  .               |
|  .               |
|  p  p  p  ...  1 |
+-                -+


that is, what GEE modelers call an exchangeable correlation matrix with p < 0, there is a limit as to how negative p can be. That limit is a function of n, the number of observations within panels (which is equal to the number of rows and columns of the correlation matrix).

If you have data generated by an exchangeable correlation process with p < 0, there are limits on p. If the maximum panel size in your data is 11, then p must be greater than -.1. If the maximum panel is 11 but you know that larger panels exist in the population, and that maximum theoretical size is 101, then p must be greater than -.01. If you think that the panel size is unlimited, then p must be greater than (or equal to) 0. Moreover, the exchangeable model makes little sense when p < 0 unless maximum possible panel sizes are fixed, say, at 2, 3, or 10.

With some datasets, xtgee wants to converge to a p that is too negative, rendering the exchangeable correlation matrix to be non–positive definite and hence invalid. The ado-file update issued in October 2006 modified xtgee to warn the user in such cases. If p is too negative, you will see

. xtgee ... (output omitted) exchangeable working correlation matrix not positive definite convergence not achieved r(430);

In that ado-file update, we also modified xtgee to reset p during iterations to be just inside the minimum boundary implied by the observed maximum panel size, which should help models that can converge to do so. However, for some datasets, xtgee wants to converge to an invalid set of parameters, and the exchangeable assumption is simply untenable.

The problem of non–positive-definite correlation matrices can arise with some other correlation structures as well. They can arise in the unstructured, stationary, and nonstationary cases, although they cannot arise for autoregressive and independent correlation matrices. The changes we have made apply in those cases, too.