原程序是这样的:
new;
T = 100 + 50; /* 100 observations + 50 presample values */
N= 10000; /* the number of replications is 10000 */
seed1=124564; /* fix the seed */
rstat=0;
bstat=0;
size=0; /* initialize statistics */
i=1; /* I start the loop */
do while i<=n;
e=rndns(t,2,seed1); /*generating 2 pseudo normal random data*/
/* generate 2 stationary autoregressive processes,
** rho=0.25 with drifts.
/* Replace 0.25 by 1 for random walks
rho=0.25;
y1= recserar(0.3 + e[.,1],0, rho);
y2= recserar(0.5 + e[.,2],0, rho);
y1= y1[51:t,.]; /*discard the first 50 observations */
y2= y2[51:t,.];
x = ones(t-50,1)~y2;
xxi=invpd(x’x); b=xxi*(x’y1); e=y1-x*b;
s2=e’*e/(rows(x)-cols(x));
sd=sqrt(diag(s2*xxi));
tstud=b./sd;
t2= tstud[2,1]; /* take the t-stat for the slope coeff */
bols2 = b[2,1]; /* idem */
r2= 1 - sumc(e^2) / sumc((y1-meanc(y1))^2);
size = sumc(abs(t2).> 1.96) + size ;
rstat =rstat|r2; /* stack r-squared */
bstat = bstat|bols2; /* stack coefficients */
i=i+1;
endo;
output file = es3.res on; /* or reset;*/
print; format /rz 10, 5;
但是我用gauss运行的时候它就不认rstat=0;这是怎么回事?是我的gauss少什么插件吗?
