G0047 Mysterious Error !

Dear all,

Please help I am new and using macbook pro . Gauss 17.

I am running an existing programme from Camacho. I replaced the original variables (299 rows) with my have 3 variables with 218 rows each. The software says I wrong:

1- Rows Don't Match ... line 24.

2 - When I click on DEBUG, a blue arrow appears in front of  "format/rd 1,4;"    in the code below.

new;
format/rd 1,4;
library optmum,pgraph;
graphset;optset;
#include optmum.ext;
_opalgr=2;_opmiter=500;
__output=2;
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Loading variables
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
load tim[] = t.txt;
load ipi[] = ipi.txt;
load ici2[] = ici2.txt;
load ici[] = ici.txt;
@ici=ici2[1:rows(ici2)-2];@
bbbb=tim~ipi~ici;    // HERE IS LINE 24.

4 Answers



0



  1. The tilde operator '~' provides horizontal concatenation. So the line of code:
    bbbb=tim~ipi~ici;

    is stacking the variables tim, ipi, ici side-by-side to create a new matrix. For this to work, each of them must have the same number of rows.

    I would recommend against using the load function. If you have data in a text file, I would recommend you use csvReadM. It is more robust and easy to use. Here is a tutorial about csvReadM.

  2. To step through your program, you can use the buttons on the toolbar 'step in' , 'step over'. On mac they will be white arrows inside of a teal circle. If you hover your mouse over the button, you will see a tooltip with the action that the button performs.


0



Dear sir,
You may have realised that if I use csvreadM with a text file, the portion of code in bold will not be executed because the variable "ipi" will not be seen.
Or if have got a chance to run the code I did send to you on the support link, it could be great to let me see  your results.
pleae !!!

I also sent you an excel file (via the support link) to show that rows actually match

Hence the issue is to find out a way to concatenate variables in macbook ...

load tim[] = t.txt;
load ipi[] = ipi.txt;
load ici[] = ici.txt;
bbbb=tim~ipi~ici;
capt=rows(ipi)-1; @ capt is the sample size @ *********

bb1=bbbb[1:capt+1,3];
x1=bb1;
bb1=bb1[1:rows(bbbb)-1,1]~bb1[2:rows(bbbb),1];
bb2=bbbb[1:capt+1,2];
x2=100*ln(bb2);



0



The problem
The concatenation is failing with the error message:

Rows don't match

because variables tim, ipi and ici have different numbers of rows after they are loaded.

You can check this by entering the following commands in the GAUSS command prompt after you run your program and get the error:

print "rows(tim) = " rows(tim);
print "rows(ipi) = " rows(ipi);
print "rows(ici) = " rows(ici);

You will see that these numbers are different.

The resolution
The behavior of load can be confusing to novice users and it is slower than csvReadM. That is why I suggested that you use csvReadM to load the data instead of load.

You should take a look at the tutorial I posted earlier about csvReadM. But for quick reference, assuming each of your text files contains a header followed by 218 observations, you could do this:

//Start on row 2 to skip header
first_row = 2;
tim = csvReadM("t.txt", first_row);
print rows(tim);

If the rows seem wrong, then print observations like this:

print tim;

This should show you your problem. For example, maybe you do not have a header, but have extra blank lines at the end of the file which load was reading as missing values. You can specify a range of rows with csvReadM like this:

//Read in rows 1 through 281
row_range = { 1, 281 };
tim = csvReadM("t.txt", row_range);
print rows(tim);

Do this for the other two variables, then run the concatenation statement in the GAUSS command prompt and it will work. Once you have done this, then REPLACE the load statements with csvReadM and this first error will be resolved.



0



You are a genius... It works !

However convergence stopped and GAUSS gave me this warning:

"Negative Hessian is not positive definite"

Do you know how to solve it ?

 

Best regards

Your Answer

4 Answers

0
  1. The tilde operator '~' provides horizontal concatenation. So the line of code:
    bbbb=tim~ipi~ici;

    is stacking the variables tim, ipi, ici side-by-side to create a new matrix. For this to work, each of them must have the same number of rows.

    I would recommend against using the load function. If you have data in a text file, I would recommend you use csvReadM. It is more robust and easy to use. Here is a tutorial about csvReadM.

  2. To step through your program, you can use the buttons on the toolbar 'step in' , 'step over'. On mac they will be white arrows inside of a teal circle. If you hover your mouse over the button, you will see a tooltip with the action that the button performs.
0

Dear sir,
You may have realised that if I use csvreadM with a text file, the portion of code in bold will not be executed because the variable "ipi" will not be seen.
Or if have got a chance to run the code I did send to you on the support link, it could be great to let me see  your results.
pleae !!!

I also sent you an excel file (via the support link) to show that rows actually match

Hence the issue is to find out a way to concatenate variables in macbook ...

load tim[] = t.txt;
load ipi[] = ipi.txt;
load ici[] = ici.txt;
bbbb=tim~ipi~ici;
capt=rows(ipi)-1; @ capt is the sample size @ *********

bb1=bbbb[1:capt+1,3];
x1=bb1;
bb1=bb1[1:rows(bbbb)-1,1]~bb1[2:rows(bbbb),1];
bb2=bbbb[1:capt+1,2];
x2=100*ln(bb2);

0

The problem
The concatenation is failing with the error message:

Rows don't match

because variables tim, ipi and ici have different numbers of rows after they are loaded.

You can check this by entering the following commands in the GAUSS command prompt after you run your program and get the error:

print "rows(tim) = " rows(tim);
print "rows(ipi) = " rows(ipi);
print "rows(ici) = " rows(ici);

You will see that these numbers are different.

The resolution
The behavior of load can be confusing to novice users and it is slower than csvReadM. That is why I suggested that you use csvReadM to load the data instead of load.

You should take a look at the tutorial I posted earlier about csvReadM. But for quick reference, assuming each of your text files contains a header followed by 218 observations, you could do this:

//Start on row 2 to skip header
first_row = 2;
tim = csvReadM("t.txt", first_row);
print rows(tim);

If the rows seem wrong, then print observations like this:

print tim;

This should show you your problem. For example, maybe you do not have a header, but have extra blank lines at the end of the file which load was reading as missing values. You can specify a range of rows with csvReadM like this:

//Read in rows 1 through 281
row_range = { 1, 281 };
tim = csvReadM("t.txt", row_range);
print rows(tim);

Do this for the other two variables, then run the concatenation statement in the GAUSS command prompt and it will work. Once you have done this, then REPLACE the load statements with csvReadM and this first error will be resolved.

0

You are a genius... It works !

However convergence stopped and GAUSS gave me this warning:

"Negative Hessian is not positive definite"

Do you know how to solve it ?

 

Best regards


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