error G0121: Matrix not positive definite


I get the following error when running both "Minimum Lagrange Multiplier Unit Root Test with Two Structural Breaks." and "Minimum Lagrange Multiplier Unit Root Test with Two Structural Breaks."

(0): error G0121: Matrix not positive definite

Currently active call: nLMk

Stack trace: nLMk

I cant find a fix anywhere and will greatly appreciate if you could help me. My data is as follows:

E      8186.00      8325.00   8382.00   8393.00  8585.00  8735.00  8799.00  8864.00  8938.00  9022.00  9078.00  9131.00  9168.00  9208.00  9244.00  9286.00  9306.00  9347.00  9396.00  9380.00  9260.00  9489.00  10099.00 9868.00  9908.00  9988.00  9963.00  10063.00 10268.00 10523.00 10721.00 10914.00 11532.00 11785.00 13135.00 17928.00 17782.00 20854.00 30712.00 35214.00

1 Answer


Without seeing the code, we cannot give you an exact answer. Most commonly "error G0121 : Matrix not positive definite" occurs when a matrix that is not positive definite is passed to the GAUSS procedure invpd.

Often the line is performing least squares estimation, something like:

b_hat = invpd(X'X)*X'Y;

and the matrix X does not have full rank. This will occur if:

  1. Two or more of the variables in the model are linearly dependent.
  2. The model is underdetermined, i.e. there are more variables than observations.
  3. The original data was loaded incorrectly so that one of the above is true.
    1. I would view your independent and dependent variables after they are loaded to make sure that they are what you would expect. If so, I would check to see if they have full rank with the GAUSS rank function.

      One more thing. I notice that at the start of your error message, the line number is 0. This means that the code was not run from a file. This can be because a part of a file was run by highlighting some code and either hitting F4 or selecting "Run selected text". This will also happen if you copy and entire program to the clipboard from another program and paste it into the GAUSS program input/output window. If you are, by chance, performing this second practice, I would strongly recommend that you open the file in GAUSS and run it from there. It will allow GAUSS to give you a specific line number on which the problem is occurring as well as one-click navigation to the location of the error, etc.

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy