Escolar Documentos
Profissional Documentos
Cultura Documentos
Apendice Cap15
Apendice Cap15
3
proc iml ;
y = {49,61,55,69,51,38,64,68,70,60,53,59,48,46,59,53,54,48,54,53,37};
x = {35,26,29,32,23,26,31,33,35,28,29,32,23,26,33,36,26,30,33,25,23};
t = {1,1,1,1,1,1,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3};
k=3;
* nmero de grupos;
n=7;
* nmero de repeties por grupo;
nk=n*k;
* nmero total de observaes;
In = I(n);
Jn = J(n,n,1);
Ink = I(nk);
Jnk = J(nk,nk,1);
Z = J(nk,1,1)||design(t); * calcula a matriz Z;
PZ = Z*ginv(t(Z)*Z)*t(Z); * calcula P = Z(ginv(Z'Z))Z';
*Calcula as somas de quadrados usando (15.25);
exx = t(X)*(Ink-PZ)*X;
exy = t(X)*(Ink-PZ)*y;
eyy = t(y)*(Ink-PZ)*y;
Beta = exy/exx;
* Calcula Beta usando (15.26);
*Calcula a SQ resduo ajustado para a covarivel;
SQRyx = eyy - (exy)**2/exx;
* calcula SQRy.x usando (15.27);
gl_Ryx = k*(n-1)-1;
* calcula gl associado a SQRy.x;
*Calcula a SQ resduo sem o ajuste para a covarivel;
tyy = t(y)*(Ink-Jnk/nk)*y;
* calcula tyy usando (15.34);
txy = t(X)*(Ink-Jnk/nk)*y;
* calcula txy usando (15.34);
txx = t(X)*(Ink-Jnk/nk)*X;
* calcula txx usando (15.34);
SQTyx = tyy - txy**2/txx;
* calcula Ty.x usando (15.33);
gl_Tyx = k*n-2;
* calcula gl associado a Ty.x;
print 'Somas de quadrados importantes',,, exx exy eyy SQRyx gl_Ryx SQTyx gl_Tyx,;
print Beta /;
GL_RYX
SQTYX
17 1141.4709
GL_TYX
19
BETA
1.1782219
Testando a hiptese
SQH01
162.02561
GL_H01
2
SQRYX
979.44529
GL_RYX
17
GL_H02
F02 PROB_F02
1 8.4400558 0.0098538
SQRYX
979.44529
GL_RYX
17
GL_H03
F03 PROB_F03
2 0.8419561 0.4502464
SQFYX
880.58959
GL_FYX
15
...
Source
Grupo
x
Parameter
...
x
DF
2
1
Type II SS
162.0256063
486.2689932
Estimate
1.17822186
(3)
Mean Square
81.0128031
486.2689932
F Value
1.41
8.44
Standard
Error
t Value
Pr > |t|
0.40555935
2.91
0.0099
Onde:
(1) Traz as informaes do teste da hiptese H01: 1 = 2 = 3
(2) Traz as informaes do teste da hiptese H02: = 0
(3) Traz a estimativa do coeficiente angular
proc glm data=Ex15_3_3;
title 'Testar a hiptese H03';
class Grupo;
model y = grupo grupo*x / solution noint ss2;
contrast 'Betas iguais' grupo*x -2 1 1, grupo*x 0 1 -1;
run;
Pr > F
0.2722
0.0099
(1)
(2)
...
Contrast
Betas iguais
Parameter
...
x*Grupo
1
x*Grupo
2
x*Grupo
3
DF
2
Estimate
0.79027778
1.98513514 (5)
0.85786290
Contrast SS
98.85570672
Mean Square
49.42785336
F Value
0.84
Standard
Error
t Value
Pr > |t|
0.75548164
0.74520250
0.64362711
1.05
2.66
1.33
0.3121
0.0177
0.2025
Pr > F
0.4502
(4)
160
320
200
160
120
160
160
120
280
160
90
154
160
234
120
160
200
160
240
120
120
245
160
160
320
160
173
134
239
320
proc glm;
title 'Testa as hiptese H01 e H02';
class A C;
model y = A C A*C x / ss3 solution noint;
run;
Coeff Var
16.64051
DF
7
23
30
Sum of
Squares
1482703140
28873230
1511576370
Root MSE
1120.428
DF
1
2
2
1
Mean Square
211814734
1255358
F Value
168.73
Pr > F
<.0001
F Value
1.10
0.31
0.37
87.57
Pr > F
0.3061
0.7398
0.6938
<.0001
y Mean
6733.133
Type III SS
1375355.1
766750.1
932749.5
109932635.1
Mean Square
1375355.1
383375.0
466374.8
109932635.1
(1)
(2)
(3)
(4)
Parameter
...
x
Estimate
32.0726921
(5)
Standard
Error
t Value
Pr > |t|
3.427330
9.36
<.0001
...
Contrast
Fator A: Betas iguais
Parameter
...
x(A)
1
x(A)
2
DF
1
Contrast SS
1157140.937
Estimate
34.906580
28.251949
(7)
(7)
Mean Square
1157140.937
F Value
0.92
Standard
Error
t Value
Pr > |t|
4.531216
5.261352
7.70
5.37
<.0001
<.0001
Pr > F
0.3483
(6)
(6) Traz as informaes do teste da hiptese de homogeneidade dos coeficientes nagulares para o fator A.
(7) Traz as estimativas dos coeficientes dos coeficientes angulares (fator A).
DF
2
Contrast SS
9506034.164
Mean Square
4753017.082
F Value
5.15
Pr > F
0.0151
(8)
Parameter
...
x(C)
1
x(C)
2
x(C)
3
Estimate
23.210417
50.085129 (9)
31.669261
Standard
Error
t Value
Pr > |t|
4.900700
6.794143
4.361080
4.74
7.37
7.26
0.0001
<.0001
<.0001
(8) Traz as informaes do teste da hiptese de homogeneidade dos coeficientes nagulares para o fator C.
(9) Traz as estimativas dos coeficientes dos coeficientes angulares (fator C).