Error G0156 : Illegal redefinition of procedure with X-DIFFERENCING AND DYNAMIC PANEL MODEL ESTIMATION

Hi All,

I am trying to use the x-differencing code on dynamic panel posted by a user but can get it to work. Please can you help?

Thanks JMist

7 Answers



0



This is the code posted a while ago.

 

The program itself has two infinite loops.  I changed lines 149 on

endo;
endo;
endo;
endo;

to

endo;
iccc = iccc + 1;
endo;
icase = icase + 1;
endo;
ipcase = ipcase + 1;
endo;

and was able to get the program to run. I also added print statements at line 146:

t2 = (b8-rho)./w;
print b8;;
print t2;
tsim[is,.] = t2;

I'm guessing that b8 is a coefficient, and t2 a t-statistic, but I could be wrong. To use this on your data, extract lines 97 through 145 into another file, set y to a vector of your data, and set t to some value (I don't know what value it should be because I haven't seen the paper). You also need to add some code to estimate or set a value for rho. Then put print statements at the end printing out whatever results you need. I'm not sure this is right, but it might be.

 

Thanks

JMist



0



If I am correct you are trying to run this code: x-differencing and dynamic panel data. What errors are you getting?

aptech

1,773


0



I am getting the following error:

Line 21 in D:\temp\Msul\x_diff_dynamic_panel_estimation.gss
Illegal redefinition of procedure G0156 : 't'
Line 22 in D:\temp\Msul\x_diff_dynamic_panel_estimation.gss
Illegal redefinition of procedure G0156 : 'n'
Line 25 in D:\temp\Msul\x_diff_dynamic_panel_estimation.gss
Illegal redefinition of procedure G0156 : 't'

 

I am using the following code

new;

outwidth 250;
cls;
@-----------------------------------------------------------------@
load y[T,N] =D:\temp\Msul\y.dat;     @ 40 time series and 19 cross section @
load x[T,N] = D:\temp\Msul\x.dat;
load z[T,N] = D:\temp\Msul\z.dat;
load m[T,N] = D:\temp\Msul\m.dat;

format /m1 /rd 10,4;
output file = table4.out reset;
output on;
isim = 2000;
"======================================";

ipcase = 1;
do while ipcase <= 9;
if ipcase == 1;
t = 20;
n = 10;
endif;
if ipcase == 2;
t = 30;
n = 10;
endif;
if ipcase == 3;
t = 40;
n = 10;
endif;

if ipcase == 4;
t = 50;
n = 10;
endif;
if ipcase == 5;
t = 100;
n = 10;
endif;
if ipcase == 6;
t = 200;
n = 10;
endif;

if ipcase == 7;
t = 300;
n = 10;
endif;
if ipcase == 8;
t = 400;
n = 10;
endif;
if ipcase == 9;
t = 500;
n = 10;
endif;
icase = 5;
do while icase <= 5;
if icase == 1;
rho = 0.1;
endif;
if icase == 2;
rho = 0.3;
endif;
if icase == 3;
rho = 0.5;
endif;
if icase == 4;
rho = 0.7;
endif;
if icase == 5;
rho = 0.9;
endif;
if icase == 6;
rho = 1.0;
endif;
bsim = zeros(isim,6);
seed = 120932;
tsim = zeros(isim,1);

iccc = 1;
do while iccc <= 2;
if iccc == 1;
aaa = 1;
endif;
if iccc == 2;
aaa = rndus(1,n,seed).*100;
endif;

is = 1;
do while is <= isim;

u = rndns(t+100,n,seed).*aaa;

y = u;

i = 2;
do while i <= t+100;
y[i,.] = y[i-1,.]*rho + u[i,.];
i = i + 1;
endo;

y = y[101:t+100,.];

yy = y[2:t,.];
yx = y[1:t-1,.];

nm1 = 0;
dm1 = 0;

nm2 = 0;
dm2 = 0;

ii = 1;
do while ii <= t-3;

yy = y[2+ii:t,.];
yx = y[1+ii:t-1,.];

yy = yy - y[ii,.];
yx = yx - y[ii+1,.];

xx = vec(yx);

nm1 = nm1 + xx'vec(yy);
dm1 = dm1 + xx'xx;

ii = ii + 1;
endo;
b8 = invpd(dm1)*nm1;

dm3 = 0;
ii = 1;
do while ii <= t-3;

yy = y[2+ii:t,.];
yx = y[1+ii:t-1,.];

yy = yy - y[ii,.];
yx = yx - y[ii+1,.];

ee = yy - yx*b8[1];
ex = sumc(ee.*yx);
dm3 = dm3 + ex;
ii = ii + 1;
endo;

dm3 = dm3'dm3;
w = invpd(dm1)*dm3*invpd(dm1);
w= sqrt(diag(w));
t2 = (b8-rho)./w;
print b8;;
print t2;
tsim[is,.] = t2;
is = is + 1;
endo;
iccc = iccc + 1;
endo;
icase = icase + 1;
endo;
ipcase = ipcase + 1;
endo;



0



The problem is that you reference T before it is defined.

new;

outwidth 250;
cls;
@-----------------------------------------------------------------@
load y[T,N] =D:\temp\Msul\y.dat;     @ 40 time series and 19 cross section @
load x[T,N] = D:\temp\Msul\x.dat;
load z[T,N] = D:\temp\Msul\z.dat;
load m[T,N] = D:\temp\Msul\m.dat;

Each of the above load statements is trying to load in T rows (observations) and N, but neither T nor N have yet been defined. Assuming that T should be 40 and N should be 19, then add those assignments just before the first load, like this:

new;

outwidth 250;
cls;
@-----------------------------------------------------------------@
T = 40; //Assign 'T' before using
N = 19; //Assign 'N' before using
load y[T,N] =D:\temp\Msul\y.dat;     @ 40 time series and 19 cross section @
load x[T,N] = D:\temp\Msul\x.dat;
load z[T,N] = D:\temp\Msul\z.dat;
load m[T,N] = D:\temp\Msul\m.dat;

The reason that you get the error of redefinition of procedure 't' is that as GAUSS is in the compile phase (turning the text on page into a form that the computer can run), it sees the symbol T which has not been defined. The only way that T could be used before it is defined, is if T is a GAUSS procedure. So GAUSS scans through the rest of the file and sees the assignment to T a little further down in the file:

t = 20;

Since GAUSS has already determined that T can only legally be a procedure, it returns the error illegal redefinition of procedure when T is assigned to.

aptech

1,773


0



Thanks. Errors have disappeared but for some reasons not getting any results  apart from those generated by the command line:

format /m1 /rd 10,4;
output file = table4.out reset;

 

Although I have read my data into Gauss.

Any help please?

jmist



0



It looks like the only output that this code gives is from these two lines:

print b8;;
print t2;

The double semi-colon at the end of the b8 print statement means DO NOT print a new-line after printing b8. So while the code is running you should see output printed to the screen that looks like this:

b8 t2
b8 t2
.
.
.
b8 t2

Where each b8 or t2 above is the value of that variable at the time of the print statement. Also, because of the output statement at the top of the file, this same information should also be sent to the file named table4.out.

Am I correct to assume that you are seeing the output that I describe above, but would like more output from the program? If that is correct, some new print statements will need to be added to the program. That should not be too difficult to do. If there is other specific output that you would like to see from this program, post another question on the user forum with the code and a description of what output you need and we can assist with that.

(Also please select the response in this thread that describes the cause of your error as the correct answer. This will make it easier for others searching for the answer to a similar problem to find help. Thanks!)

aptech

1,773


0



Thanks. You are correct-I see

b8 t2
b8 t2
.
.
.
b8 t2

But what I wanted is more output using my own data.
Ok will post another question. Thanks again.
jmist

Your Answer

7 Answers

0

This is the code posted a while ago.

 

The program itself has two infinite loops.  I changed lines 149 on

endo;
endo;
endo;
endo;

to

endo;
iccc = iccc + 1;
endo;
icase = icase + 1;
endo;
ipcase = ipcase + 1;
endo;

and was able to get the program to run. I also added print statements at line 146:

t2 = (b8-rho)./w;
print b8;;
print t2;
tsim[is,.] = t2;

I'm guessing that b8 is a coefficient, and t2 a t-statistic, but I could be wrong. To use this on your data, extract lines 97 through 145 into another file, set y to a vector of your data, and set t to some value (I don't know what value it should be because I haven't seen the paper). You also need to add some code to estimate or set a value for rho. Then put print statements at the end printing out whatever results you need. I'm not sure this is right, but it might be.

 

Thanks

JMist

0

If I am correct you are trying to run this code: x-differencing and dynamic panel data. What errors are you getting?

0

I am getting the following error:

Line 21 in D:\temp\Msul\x_diff_dynamic_panel_estimation.gss
Illegal redefinition of procedure G0156 : 't'
Line 22 in D:\temp\Msul\x_diff_dynamic_panel_estimation.gss
Illegal redefinition of procedure G0156 : 'n'
Line 25 in D:\temp\Msul\x_diff_dynamic_panel_estimation.gss
Illegal redefinition of procedure G0156 : 't'

 

I am using the following code

new;

outwidth 250;
cls;
@-----------------------------------------------------------------@
load y[T,N] =D:\temp\Msul\y.dat;     @ 40 time series and 19 cross section @
load x[T,N] = D:\temp\Msul\x.dat;
load z[T,N] = D:\temp\Msul\z.dat;
load m[T,N] = D:\temp\Msul\m.dat;

format /m1 /rd 10,4;
output file = table4.out reset;
output on;
isim = 2000;
"======================================";

ipcase = 1;
do while ipcase <= 9;
if ipcase == 1;
t = 20;
n = 10;
endif;
if ipcase == 2;
t = 30;
n = 10;
endif;
if ipcase == 3;
t = 40;
n = 10;
endif;

if ipcase == 4;
t = 50;
n = 10;
endif;
if ipcase == 5;
t = 100;
n = 10;
endif;
if ipcase == 6;
t = 200;
n = 10;
endif;

if ipcase == 7;
t = 300;
n = 10;
endif;
if ipcase == 8;
t = 400;
n = 10;
endif;
if ipcase == 9;
t = 500;
n = 10;
endif;
icase = 5;
do while icase <= 5;
if icase == 1;
rho = 0.1;
endif;
if icase == 2;
rho = 0.3;
endif;
if icase == 3;
rho = 0.5;
endif;
if icase == 4;
rho = 0.7;
endif;
if icase == 5;
rho = 0.9;
endif;
if icase == 6;
rho = 1.0;
endif;
bsim = zeros(isim,6);
seed = 120932;
tsim = zeros(isim,1);

iccc = 1;
do while iccc <= 2;
if iccc == 1;
aaa = 1;
endif;
if iccc == 2;
aaa = rndus(1,n,seed).*100;
endif;

is = 1;
do while is <= isim;

u = rndns(t+100,n,seed).*aaa;

y = u;

i = 2;
do while i <= t+100;
y[i,.] = y[i-1,.]*rho + u[i,.];
i = i + 1;
endo;

y = y[101:t+100,.];

yy = y[2:t,.];
yx = y[1:t-1,.];

nm1 = 0;
dm1 = 0;

nm2 = 0;
dm2 = 0;

ii = 1;
do while ii <= t-3;

yy = y[2+ii:t,.];
yx = y[1+ii:t-1,.];

yy = yy - y[ii,.];
yx = yx - y[ii+1,.];

xx = vec(yx);

nm1 = nm1 + xx'vec(yy);
dm1 = dm1 + xx'xx;

ii = ii + 1;
endo;
b8 = invpd(dm1)*nm1;

dm3 = 0;
ii = 1;
do while ii <= t-3;

yy = y[2+ii:t,.];
yx = y[1+ii:t-1,.];

yy = yy - y[ii,.];
yx = yx - y[ii+1,.];

ee = yy - yx*b8[1];
ex = sumc(ee.*yx);
dm3 = dm3 + ex;
ii = ii + 1;
endo;

dm3 = dm3'dm3;
w = invpd(dm1)*dm3*invpd(dm1);
w= sqrt(diag(w));
t2 = (b8-rho)./w;
print b8;;
print t2;
tsim[is,.] = t2;
is = is + 1;
endo;
iccc = iccc + 1;
endo;
icase = icase + 1;
endo;
ipcase = ipcase + 1;
endo;

0

The problem is that you reference T before it is defined.

new;

outwidth 250;
cls;
@-----------------------------------------------------------------@
load y[T,N] =D:\temp\Msul\y.dat;     @ 40 time series and 19 cross section @
load x[T,N] = D:\temp\Msul\x.dat;
load z[T,N] = D:\temp\Msul\z.dat;
load m[T,N] = D:\temp\Msul\m.dat;

Each of the above load statements is trying to load in T rows (observations) and N, but neither T nor N have yet been defined. Assuming that T should be 40 and N should be 19, then add those assignments just before the first load, like this:

new;

outwidth 250;
cls;
@-----------------------------------------------------------------@
T = 40; //Assign 'T' before using
N = 19; //Assign 'N' before using
load y[T,N] =D:\temp\Msul\y.dat;     @ 40 time series and 19 cross section @
load x[T,N] = D:\temp\Msul\x.dat;
load z[T,N] = D:\temp\Msul\z.dat;
load m[T,N] = D:\temp\Msul\m.dat;

The reason that you get the error of redefinition of procedure 't' is that as GAUSS is in the compile phase (turning the text on page into a form that the computer can run), it sees the symbol T which has not been defined. The only way that T could be used before it is defined, is if T is a GAUSS procedure. So GAUSS scans through the rest of the file and sees the assignment to T a little further down in the file:

t = 20;

Since GAUSS has already determined that T can only legally be a procedure, it returns the error illegal redefinition of procedure when T is assigned to.

0

Thanks. Errors have disappeared but for some reasons not getting any results  apart from those generated by the command line:

format /m1 /rd 10,4;
output file = table4.out reset;

 

Although I have read my data into Gauss.

Any help please?

jmist

0

It looks like the only output that this code gives is from these two lines:

print b8;;
print t2;

The double semi-colon at the end of the b8 print statement means DO NOT print a new-line after printing b8. So while the code is running you should see output printed to the screen that looks like this:

b8 t2
b8 t2
.
.
.
b8 t2

Where each b8 or t2 above is the value of that variable at the time of the print statement. Also, because of the output statement at the top of the file, this same information should also be sent to the file named table4.out.

Am I correct to assume that you are seeing the output that I describe above, but would like more output from the program? If that is correct, some new print statements will need to be added to the program. That should not be too difficult to do. If there is other specific output that you would like to see from this program, post another question on the user forum with the code and a description of what output you need and we can assist with that.

(Also please select the response in this thread that describes the cause of your error as the correct answer. This will make it easier for others searching for the answer to a similar problem to find help. Thanks!)

0

Thanks. You are correct-I see

b8 t2
b8 t2
.
.
.
b8 t2

But what I wanted is more output using my own data.
Ok will post another question. Thanks again.
jmist

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.