summaryrefslogtreecommitdiff
path: root/331/CH4/EX4.4/Example_4_4.sce
blob: 9022c373693429163caa211814783c43c1a74e9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
//Caption: Randomized Complete Block Design
//Example4.4
//Page86
clear;
clc;
Yij = [40,30,55,25,35;45,60,10,22,33;38,55,40,55,28;30,27,32,56,17;45,34,20,34,37];
disp(Yij,'Yij=')
[m,n] = size(Yij);
Y = sum(Yij(:,:));
disp(Y,'Y=')
Yi1 = sum(Yij(:,1));
disp(Yi1,'Yi1=')
Yi2 = sum(Yij(:,2));
disp(Yi2,'Yi2=')
Yi3 = sum(Yij(:,3));
disp(Yi3,'Yi3=')
Yi4 = sum(Yij(:,4));
disp(Yi4,'Yi4=')
Yi5 = sum(Yij(:,5));
disp(Yi5,'Yi5=')
Y1j = sum(Yij(1,:));
disp(Y1j,'Y1j=')
Y2j = sum(Yij(2,:));
disp(Y2j,'Y2j=')
Y3j = sum(Yij(3,:));
disp(Y3j,'Y3j=')
Y4j = sum(Yij(4,:));
disp(Y4j,'Y4j=')
Y5j = sum(Yij(5,:));
disp(Y5j,'Y5j=');
SS_total = sum(Yij(:,:).^2)-(Y^2)/(m*n);
disp(SS_total,'SS_total=')
SS_team = ((Y1j^2)/n)+((Y2j^2)/n)+((Y3j^2)/n)+((Y4j^2)/n)+((Y5j^2)/n)-(Y^2)/(m*n);
disp(SS_team,'SS_team_leader=')
SS_team_leader = ((Yi1^2)/m)+((Yi2^2)/m)+((Yi3^2)/m)+((Yi4^2)/m)+((Yi5^2)/m)-(Y^2)/(m*n);
disp(SS_team,'SS_team=')
SS_error = SS_total-SS_team_leader-SS_team;
Bet_Treat_DOF = n-1;
disp(Bet_Treat_DOF,'Degrees of freedom Between treatments=')
Bet_Blocks = m-1;
disp(Bet_Blocks,'Degrees of freedom Between Blocks=')
Error = m*n-n-m+1;
disp(Error,'Degrees of freedom With in treatments=')
MSS = [SS_team_leader/Bet_Treat_DOF,SS_team/Bet_Blocks,SS_error/Error];
disp(MSS,'Mean Sum of Squares =');
F_ratio1 = MSS(1)/MSS(3);
F_ratio2 = MSS(2)/MSS(3);
disp(F_ratio1,'Calculated F ratio1 for component treatment- team leader=')
disp(F_ratio2,'Calculated F ratio2 for component block=')
Ftable =  3.01;
disp(Ftable,'Tablw F ratio for the significance level =0.05 and degrees of freedom (4,16)=')
if (F_ratio1 <Ftable) then
    disp('Null Hypothesis should be accepted')
    disp('This means that there is no significant difference in terms of net worth between the team leaders')
else
    disp('Reject Null Hypothesis')
end
if (F_ratio2 <Ftable) then
    disp('Null Hypothesis should be accepted')
    disp('This means that there is no significant difference in terms of net worth between different teams')
else
    disp('Reject Null Hypothesis')
end
//Result
// Yij=   
// 
//    40.    30.    55.    25.    35.  
//    45.    60.    10.    22.    33.  
//    38.    55.    40.    55.    28.  
//    30.    27.    32.    56.    17.  
//    45.    34.    20.    34.    37.  
// 
// Y=   
// 
//    903.  
// 
// Yi1=   
// 
//    198.  
// 
// Yi2=   
// 
//    206.  
// 
// Yi3=   
// 
//    157.  
// 
// Yi4=   
// 
//    192.  
// 
// Yi5=   
// 
//    150.  
// 
// Y1j=   
// 
//    185.  
// 
// Y2j=   
// 
//    170.  
// 
// Y3j=   
// 
//    216.  
// 
// Y4j=   
// 
//    162.  
// 
// Y5j=   
// 
//    170.  
// 
// SS_total=   
// 
//    4118.64  
// 
// SS_team_leader=   
// 
//    368.64  
// 
// SS_team=   
// 
//    368.64  
// 
// Degrees of freedom Between treatments=   
// 
//    4.  
// 
// Degrees of freedom Between Blocks=   
// 
//    4.  
// 
// Degrees of freedom With in treatments=   
// 
//    16.  
// 
// Mean Sum of Squares =   
// 
//    128.56    92.16    202.235  
// 
// Calculated F ratio1 for component treatment- team leader=   
// 
//    0.6356961  
// 
// Calculated F ratio2 for component block=   
// 
//    0.4557075  
// 
// Tablw F ratio for the significance level =0.05 7 degrees of freedom (3,9)=   
// 
//    3.86  
// 
// Null Hypothesis should be accepted   
// 
// This means that there is no significant difference in terms of net worth between the team leaders   
// 
// Null Hypothesis should be accepted   
// 
// This means that there is no significant difference in terms of net worth between different teams   
//