# Qreg problem in GAUSS 19.1

Hi all,

I am new to GAUSS and have been trying to use the Qreg package downloaded from http://www.thierry-roncalli.com/Gauss.html but encounter the following error when trying to run demo.prg:

G0048 : Matrix singular [qreg.src, line 313]

File qreg.src, line 313, in _Qreg_solveLP1
dy = (A*(q.*r)) / (A*(q.*A'));
Traceback:

File qreg.src, line 93, in Qreg
beta[.,i] = -_Qreg_solveLP1(-y,X',X'sv,ones(N,1),sv);
File qardl.prc
File demo.prg, line 45, in <main>
{bigbt, cv, bigphi, bigpi, biggam, biglam} = qardl(data,pst,qst,tau);

The data seems to have been uploaded correctly and an error with demo data here is unexpected. Any assistance would be very welcome.

0
accepted

Just above line 313 of qreg.src (where the error occurs), add these lines:

save A;
save q;
save r;

Then run the program again. This time your new code will save the data which is causing the problem to your hard disk. Next, load this data into GAUSS with these statements:

Take a look at these matrices and see if there are any problems like redundant columns (particularly in A).

If that does not show any problems, then create the X matrix from the least-squares estimation on line 313 by entering:

X = A*(q.*A')

Now inspect X to see if there are any obvious problems like redundant columns or columns of zeros, etc. If not, then perform the linear independence check from this blog post to see if you can find out which columns are the problems.

Once the problem in the matrix is identified, we can try and find out why it ended up this way.

0

Hi,

thanks for your help. I found that the first two rows of the matrix A are identical rows of '1's and that the first two rows and the first two columns of X are identical. That explains the 'Matrix singular' error, but it's not clear to me from the data file why it would be like that.

0

The problem now is to make sure A only gets one column of ones.

The Qreg code adds a column of ones for the constant term to the front of your data. So if you are adding a column of ones yourself, there is the problem.

However, now I see in your stack trace from the original error that you are using the qardl function. I believe there is a QARDL package which uses Qreg which instructs you to remove the Qreg code which adds the constant term.

I think this is likely to be the problem. If you are using the QARDL package take a look at its README file and I think you will find this instruction.

0

Hi, I found the details in the README file and that has solved the problem. Thanks for your patience in pointing me to what was wrong!

0

I'm glad you got it working and happy to help!

### Have a Specific Question?

Get a real answer from a real person

### Need Support?

Get help from our friendly experts.