|
SETS:
OBS/1..11/:
Y,
X;
OUT/CONS,SLOPE,RSQRU,RSQRA/: R;
ENDSETS
DATA:
Y=166 153 177 201 216 208 227 238 268 268 274;
X=352 373 411 441 462 490 529 577 641 692 743;
ENDDATA
SETS:
OBSN(OBS):XS,YS;
ENDSETS
NK=@SIZE(OBS);
XBAR=@SUM(OBS:X)/NK;
YBAR=@SUM(OBS:Y)/NK;
@FOR(OBS(I):
XS(I)=X(I)-XBAR;
YS(I)=Y(I)-YBAR;
XYBAR=@SUM(OBSN:XS*YS);
XXBAR=@SUM(OBSN:XS*XS);
YYBAR=@SUM(OBSN:YS*YS);
R(@INDEX(SLOPE))=XYBAR/XXBAR;
R(@INDEX(CONS))=YBAR-R(@INDEX(SLOPE))*XBAR;
RESID=@SUM(OBSNYS-R(@INDEX(SLOPE))*XS)^2);
R(@INDEX(RSQRU))=1-RESID/YYBAR;
R(@INDEX(RSQRA))=1-(RESID/YYBAR)*(NK-1)/(NK-2);
@FOR(OBSNFREE(XS);@FREE(YS));
END |
|