Not Available. OLS

Hi guys. I am trying to run Fama McBeth regressions. Ι get an error (0) : error G0058 : Index out of range. I do not know where it is from. I searched and found that the reason would be that there are not applicable data in loaded texts. Should I replace N/A data with something else? Thank you in advance. I would appreciate any help with Fama McBeth method.

4 Answers



0



accepted

Narrowing down the line of the error is a good start. Most likely, the line will have some matrix indexing like this:

z = x[idxa,idxb];

Assuming that the line above is the actual line of code with the error, then we could use the debugger or add some simple print statements like this:

print "rows(x) = " rows(x);
print "cols(x) = " cols(x);
print "idxa = " idxa;
print "idxb = " idxb;

z = x[idxa,idxb];

Then after we run the code again, we will see the size of x and we will see which rows and columns are trying to be selected. This should make the indexing error clear.

aptech

1,773


0



The first thing you should do is to run the program file, rather than running commands interactively. When you do this, GAUSS will show you the line number of the error. Look at this tutorial for assistance.

It is possible that you have NaN's or missing values in some of your data which is causing this problem. However, it could be for other reasons. For example, let's say we have a vector x with 5 elements.

// Create a 5x1 column vector
x = { 1.1, 2.2, 3.3, 4.4, 5.5 };

after creating that column vector, we can cause the error G0058: Index out of range by trying to read or write to an element of x which does not exist. For example, both of the following cases will return the 'out of range' error.

// Try to read the 6th element from a vector with 5 elements
z = x[6];

// Try to write to the 12th element of a vector with 5 elements
x[12] = 9;

If the index value is a NaN or missing value, instead of a 5 or a 12, you will also get the 'index out of range error'.

You should verify that you loaded your data correctly into GAUSS.

If you are still having trouble, could you post a link to the code you are using?

aptech

1,773


0



Thank you very much! I did as you said and I ran the program and the error appeared in 120 line. Again I can not understand the reason but there is some progress. Do you mean to copy paste the code?



0



Firstly I have to thank you again for your prompt answer. Secondly, after some changes there are more errors in next lines. Does it mean that the first error do not exist anymore? Also, I have an error dependent variable has no variation among others. My dependent variable is about stock returns.

The problem is that the code is given to me. It is explained to me but I do not know what should modify

Your Answer

4 Answers

0
accepted

Narrowing down the line of the error is a good start. Most likely, the line will have some matrix indexing like this:

z = x[idxa,idxb];

Assuming that the line above is the actual line of code with the error, then we could use the debugger or add some simple print statements like this:

print "rows(x) = " rows(x);
print "cols(x) = " cols(x);
print "idxa = " idxa;
print "idxb = " idxb;

z = x[idxa,idxb];

Then after we run the code again, we will see the size of x and we will see which rows and columns are trying to be selected. This should make the indexing error clear.

0

The first thing you should do is to run the program file, rather than running commands interactively. When you do this, GAUSS will show you the line number of the error. Look at this tutorial for assistance.

It is possible that you have NaN's or missing values in some of your data which is causing this problem. However, it could be for other reasons. For example, let's say we have a vector x with 5 elements.

// Create a 5x1 column vector
x = { 1.1, 2.2, 3.3, 4.4, 5.5 };

after creating that column vector, we can cause the error G0058: Index out of range by trying to read or write to an element of x which does not exist. For example, both of the following cases will return the 'out of range' error.

// Try to read the 6th element from a vector with 5 elements
z = x[6];

// Try to write to the 12th element of a vector with 5 elements
x[12] = 9;

If the index value is a NaN or missing value, instead of a 5 or a 12, you will also get the 'index out of range error'.

You should verify that you loaded your data correctly into GAUSS.

If you are still having trouble, could you post a link to the code you are using?

0

Thank you very much! I did as you said and I ran the program and the error appeared in 120 line. Again I can not understand the reason but there is some progress. Do you mean to copy paste the code?

0

Firstly I have to thank you again for your prompt answer. Secondly, after some changes there are more errors in next lines. Does it mean that the first error do not exist anymore? Also, I have an error dependent variable has no variation among others. My dependent variable is about stock returns.

The problem is that the code is given to me. It is explained to me but I do not know what should modify


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