diff options
Diffstat (limited to '291/CH10/EX10.3a/eg10_3a.sce')
-rwxr-xr-x | 291/CH10/EX10.3a/eg10_3a.sce | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/291/CH10/EX10.3a/eg10_3a.sce b/291/CH10/EX10.3a/eg10_3a.sce new file mode 100755 index 000000000..fd4239eb9 --- /dev/null +++ b/291/CH10/EX10.3a/eg10_3a.sce @@ -0,0 +1,30 @@ +Xij = [220 251 226 246 260; 244 235 232 242 225; 252 272 250 238 256];
+Xi = zeros(3,1);
+n= 5;
+m=3;
+for i=1:3
+ for j=1:5
+ Xi(i)= Xi(i) + Xij(i,j);
+ end
+end
+Xi = Xi/n;
+SSW= 0;
+for i=1:3
+ for j= 1:5
+ SSW = SSW + ((Xij(i,j)-Xi(i))^2)
+ end
+end
+sigma1 = SSW/((n*m)-m);
+Xdotdot = sum(Xi)/m;
+new = (Xi - Xdotdot)^2;
+SSb= n*sum(new);
+sigma2 = SSb/(m-1);
+TS = sigma2/sigma1;
+//disp(sigma1);
+//disp(sigma2);
+disp(TS, "Value of the test statistic is");
+pvalue = 1 - cdff("PQ", TS,m-1, ((n*m)-m) );
+disp(pvalue, "The p-value is")
+if(pvalue>0.05)
+disp( "Since the p-value is greater than .05, the null hypothesis that the mean mileage is the same for all 3 brands of gasoline cannot be rejected. ")
+end
\ No newline at end of file |