summaryrefslogtreecommitdiff
path: root/291/CH10
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /291/CH10
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '291/CH10')
-rwxr-xr-x291/CH10/EX10.3a/eg10_3a.sce30
-rwxr-xr-x291/CH10/EX10.3b/eg10_3b.sce23
-rwxr-xr-x291/CH10/EX10.3c/eg10_3c.sce33
-rwxr-xr-x291/CH10/EX10.4b/eg10_4b.sce25
-rwxr-xr-x291/CH10/EX10.5a/eg10_5a.sce40
5 files changed, 151 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
diff --git a/291/CH10/EX10.3b/eg10_3b.sce b/291/CH10/EX10.3b/eg10_3b.sce
new file mode 100755
index 000000000..0fb2d2eed
--- /dev/null
+++ b/291/CH10/EX10.3b/eg10_3b.sce
@@ -0,0 +1,23 @@
+Xijold = [220 251 226 246 260; 244 235 232 242 225; 252 272 250 238 256];
+Xij = Xijold - 220;
+m=3;
+n=5;
+Xidot = zeros(3,1);
+for i=1:m
+ for j=1:n
+ Xidot(i)=Xidot(i) + Xij(i,j);
+ end
+end
+Xidot = Xidot/n;
+Xdotdot = sum(Xidot)/m;
+SSb=0;
+for i=1:m
+ SSb = SSb + (Xidot(i)-Xdotdot)^2;
+end
+SSb = SSb*n;
+Xijsquared = Xij.^2;
+SSW = sum(Xijsquared) - (m*n*(Xdotdot^2)) - SSb;
+sigma1 = SSW/((n*m)-m);
+sigma2 = SSb/(m-1);
+TS = sigma2/sigma1;
+disp(TS, "Value of the test statistic is"); \ No newline at end of file
diff --git a/291/CH10/EX10.3c/eg10_3c.sce b/291/CH10/EX10.3c/eg10_3c.sce
new file mode 100755
index 000000000..1252a8125
--- /dev/null
+++ b/291/CH10/EX10.3c/eg10_3c.sce
@@ -0,0 +1,33 @@
+Xij = [3.2 3.4 3.3 3.5; 3.4 3.0 3.7 3.3; 2.8 2.6 3.0 2.7];
+Xi = zeros(3,1);
+n= 4;
+m=3;
+for i=1:3
+ for j=1:4
+ Xi(i)= Xi(i) + Xij(i,j);
+ end
+end
+Xi = Xi/n;
+SSW= 0;
+for i=1:3
+ for j= 1:4
+ 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")
+C = 3.95; //from table A5
+W = C*sqrt(SSW/(9*4));
+disp(W);
+disp(Xi(1)-Xi(2)+W ,"and ", Xi(1)-Xi(2)-W, "Mean1 - Mean2 lies between " );
+disp(Xi(1)-Xi(3)+W ,"and ", Xi(1)-Xi(3)-W, "Mean1 - Mean3 lies between " );
+disp(Xi(2)-Xi(3)+W ,"and ", Xi(2)-Xi(3)-W, "Mean2 - Mean3 lies between " ); \ No newline at end of file
diff --git a/291/CH10/EX10.4b/eg10_4b.sce b/291/CH10/EX10.4b/eg10_4b.sce
new file mode 100755
index 000000000..10372d044
--- /dev/null
+++ b/291/CH10/EX10.4b/eg10_4b.sce
@@ -0,0 +1,25 @@
+X=[75 73 60 70 86; 78 71 64 72 90; 80 69 62 70 85; 73 67 63 80 92 ];
+Xidot = zeros(4,1);
+for i=1:4
+ for j=1:5
+ Xidot(i)=Xidot(i) + X(i,j);
+ end
+end
+Xidot = Xidot/5;
+Xjdot = zeros(5,1);
+for j=1:5
+ for i=1:4
+ Xjdot(j)=Xjdot(j) + X(i,j);
+ end
+end
+Xjdot = Xjdot/4;
+Xdotdot = sum(Xidot)/4;
+//disp(Xdotdot)
+meanhat = Xdotdot;
+alphahat = Xidot - meanhat;
+betahat = Xjdot - meanhat;
+disp(meanhat, "The estimator of the mean is");
+disp("The alphas are-")
+disp(alphahat)
+disp("The betas are-")
+disp(betahat) \ No newline at end of file
diff --git a/291/CH10/EX10.5a/eg10_5a.sce b/291/CH10/EX10.5a/eg10_5a.sce
new file mode 100755
index 000000000..b0a9fc100
--- /dev/null
+++ b/291/CH10/EX10.5a/eg10_5a.sce
@@ -0,0 +1,40 @@
+X = [53 35 31 37 40 43; 36 34 17 21 30 18; 47 37 17 31 45 26; 55 31 17 23 43 37; 40 32 19 26 45 37; 52 42 20 27 26 32; 39 28 21 21 36 28; 40 32 21 21 36 35];
+m= 8;
+n = 6;
+Xidot = zeros(8,1);
+for i=1:8
+ for j=1:6
+ Xidot(i)=Xidot(i) + X(i,j);
+ end
+end
+Xidot = Xidot/6;
+Xjdot = zeros(6,1);
+for j=1:6
+ for i=1:8
+ Xjdot(j)=Xjdot(j) + X(i,j);
+ end
+end
+Xjdot = Xjdot/8;
+Xdotdot = sum(Xidot)/8;
+new = (Xidot - Xdotdot)^2;
+SSr = n*sum(new);
+new1 = (Xjdot - Xdotdot)^2;
+SSc = m*sum(new1);
+SSe = 0;
+for i=1:m
+ for j=1:n
+ SSe = SSe + (X(i,j)-Xidot(i)-Xjdot(j)+ Xdotdot)^2;
+ end
+end
+N =(m-1)*(n-1);
+TS1 = SSr*N/((m-1)*SSe);
+TS2 = SSc*N/((n-1)*SSe);
+pvaluec = 1- cdff("PQ", TS1, m-1, N);
+pvaluer = 1- cdff("PQ", TS2, n-1, N);
+//disp(pvaluer, pvaluec);
+//disp(TS1, TS2);
+disp(TS1, "The value of the F-statistic for testing that there is no row effect is");
+disp(pvaluec, "The p-value for testing that there is no row effect is");
+
+disp(TS2, "The value of the F-statistic for testing that there is no column effect is");
+disp(pvaluer, "The p-value for testing that there is no column effect is");