# Simple question about printing out results

0

In the below, an input of the procedure ols isĀ printr. And it is set to 1 before the procedure.

Why do I need printr and it in the procedure??

new;
cls;
library pgraph;
pqgwin many;

/* step 1:DGP */
b1 = 1;
b2 = 2;
b0 = 0|0;
k = 2;
sig2 = 4;
Tru_b = b1|b2;
T = 2000;
x2 = rndu(T,1)*5;
emat = rndn(T,1)*sqrt(sig2);
ymat = b1 + x2*b2 + emat;
/* step 2:Estimation (OLS) */
X=ones(T,1)~x2;
Y=ymat;
printr = 1;
{bhat,Yhat,residual,sig2hat,stde,t_val,p_val,F_val,R2,R2_,SC,AIC} = ols1(Y,X,printr);

title("Y and fitted Y");
xy(T,Ymat~Yhat);
title("Error term and Residuals");
xy(T,emat~residual);
end;

proc(12) = ols1(Y,X,printr);
T=rows(Y);
k=cols(X);
bhat =inv(X'*X)*X'*Y;
Yhat = X*bhat;
ehat = Y - Yhat;
sig2hat = ehat'ehat/(T-k);
varbhat = sig2hat*invpd(X'X);
stde = sqrt(diag(varbhat));
t_val = (bhat-b0)./stde;
p_val = cdftc(t_val,T-k);
mY = meanc(Y);
TSS = Y'Y - T*mY^2;

/* Test H0: all coefficients are zero. Refer to the section 4 for details */
R = eye(k);
L = k; @ # of restrictions @
gam = zeros(k,1);
F_val = (R*bhat - gam)'invpd(R*invpd(X'X)*R')*(R*bhat-gam)/(L*sig2hat);

if printr == 1;
/* Results */
"Parameter Estimates S.E. t-value p-value"
seqa(1,1,k)~bhat~stde~t_val~p_val;

"S.E. of regression" sqrt(sig2hat);
"F-value" F_val;
"p-value(F)" cdffc(F_val,L,T-k);
"R2" R2;
"SC" SC;
"AIC" AIC;

endif;

retp(bhat,Yhat,ehat,sig2hat,stde,t_val,p_val,F_val,R2,R2_,SC,AIC);
endp;

0

The procedure you posted allows the user to control whether the parameter estimates, standard error and some other statistics are printed to the screen when the procedure is run.

You pass it a 1 if you want it to print this output to the GAUSS program input/output window or a 0 if you do NOT want the statistics displayed.

Since you have the source code, you could remove the need to pass in the 'printr' input. It is not part of the GAUSS standard package or a GAUSS application module, so it would not cause you problems there.

0

The procedure you posted allows the user to control whether the parameter estimates, standard error and some other statistics are printed to the screen when the procedure is run.

You pass it a 1 if you want it to print this output to the GAUSS program input/output window or a 0 if you do NOT want the statistics displayed.

Since you have the source code, you could remove the need to pass in the 'printr' input. It is not part of the GAUSS standard package or a GAUSS application module, so it would not cause you problems there.

• ### Aptech Systems, Inc. Worldwide Headquarters

Aptech Systems, Inc.
2350 East Germann Road, Suite #21
Chandler, AZ 85286

Phone: 360.886.7100
FAX: 360.886.8922

• ### Training & Events

Want more guidance while learning about the full functionality of GAUSS and its capabilities? Get in touch for in-person training or browse additional references below.

• ### Tutorials

Step-by-step, informative lessons for those who want to dive into GAUSS and achieve their goals, fast.

• ### Want to find out more?

Get a real answer from a real person

• ### Have a Specific Question?

Get a real answer from a real person

• Need Support?
• ### Support Plans

Premier Support and Platinum Premier Support are annually renewable membership programs that provide you with important benefits including technical support, product maintenance, and substantial cost-saving features for your GAUSS System or the GAUSS Engine.

• ### User Forums

Join our community to see why our users are considered some of the most active and helpful in the industry!