//Caption: Randomized Complete Block Design //Example4.3 //Page82 clear; clc; Yij = [23,30,25,28;34,20,29,34;45,30,45,40;34,20,35,40]; 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=') 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=') SS_total = sum(Yij(:,:).^2)-(Y^2)/(m*n); disp(SS_total,'SS_total=') SS_Blocks = ((Y1j^2)/n)+((Y2j^2)/n)+((Y3j^2)/n)+((Y4j^2)/n)-(Y^2)/(m*n); disp(SS_Blocks,'SS_blocks=') SS_treatments = ((Yi1^2)/m)+((Yi2^2)/m)+((Yi3^2)/m)+((Yi4^2)/m)-(Y^2)/(m*n); disp(SS_treatments,'SS_treatments=') SS_error = SS_total-SS_treatments-SS_Blocks; disp(SS_error,'SS_error=') 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=') Within_Treat_DOF = m*n-n-m+1; disp(Within_Treat_DOF,'Degrees of freedom With in treatments=') MSS = [SS_treatments/Bet_Treat_DOF,SS_Blocks/Bet_Blocks,SS_error/Within_Treat_DOF]; 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=') disp(F_ratio2,'Calculated F ratio2 for component block=') Ftable = 3.86; disp(Ftable,'Tablw F ratio for the significance level =0.05 7 degrees of freedom (3,9)=') if (F_ratio1