Help with code

I am trying to use the code (please see below) on my data to estimate a dynamic panel model using X-differencing. With the help of users the code is running but unfortunately I can only see on the screen

b8 t2
b8 t2
.
.
.
b8 t2

However, I am interested in the estimates of my regressors. Any help please?
Thanks,
jmist

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;

x1 = x;        @ the first regressor  @
    x2 = z;        @ the second regressor @
    x3 = m;
ivar=4;        @ the total number of regressors = 2 @
    
    x4 = rndn(t,n);
x5 = rndn(t,n);
x6 = rndn(t,n);


output file = D:\temp\Msul\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;

1 Answer



0



The program you are using computes an estimate and t-statistics using simulated data.   The program doesn't access your data at any point.  Your data is stored in y, z, and m, and then transferred into x1, x2, and x3.  Then random numbers are stored in x4, x5 and x6.   The program accesses none of the matrices except the y matrix which it destroys in the process of creating a new y matrix.

The program would have to be significantly modified to generate estimates and t-statistics for your data.

 

Your Answer

1 Answer

0

The program you are using computes an estimate and t-statistics using simulated data.   The program doesn't access your data at any point.  Your data is stored in y, z, and m, and then transferred into x1, x2, and x3.  Then random numbers are stored in x4, x5 and x6.   The program accesses none of the matrices except the y matrix which it destroys in the process of creating a new y matrix.

The program would have to be significantly modified to generate estimates and t-statistics for your data.

 


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