summaryrefslogtreecommitdiff
path: root/331
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /331
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 '331')
-rwxr-xr-x331/CH10/EX10.1/Example_10_1.sce75
-rwxr-xr-x331/CH10/EX10.10/Example_10_10.sce87
-rwxr-xr-x331/CH10/EX10.11/Example_10_11.sce27
-rwxr-xr-x331/CH10/EX10.2/Example_10_2.sce154
-rwxr-xr-x331/CH10/EX10.3/Example_10_3.sce36
-rwxr-xr-x331/CH10/EX10.4/Example_10_4.sce23
-rwxr-xr-x331/CH10/EX10.5/Example_10_5.sce56
-rwxr-xr-x331/CH10/EX10.6/Example_10_6.sce51
-rwxr-xr-x331/CH10/EX10.7/Example_10_7.sce21
-rwxr-xr-x331/CH10/EX10.8/Example_10_8.sce33
-rwxr-xr-x331/CH10/EX10.9/Example_10_9.sce28
-rwxr-xr-x331/CH11/EX11.1/Example_11_1.sce112
-rwxr-xr-x331/CH11/EX11.2/Example_11_2.sce300
-rwxr-xr-x331/CH3/EX3.1/Example_3_1.sce11
-rwxr-xr-x331/CH3/EX3.10/Example_3_10.sce23
-rwxr-xr-x331/CH3/EX3.11/Example_3_11.sce74
-rwxr-xr-x331/CH3/EX3.12/Example_3_12.sce31
-rwxr-xr-x331/CH3/EX3.13/Example_3_13.sce21
-rwxr-xr-x331/CH3/EX3.14/Example_3_14.sce96
-rwxr-xr-x331/CH3/EX3.15/Example_3_15.sce56
-rwxr-xr-x331/CH3/EX3.16/Example_3_16.sce34
-rwxr-xr-x331/CH3/EX3.17/Example_3_17.sce47
-rwxr-xr-x331/CH3/EX3.18/Example_3_18.sce59
-rwxr-xr-x331/CH3/EX3.19/Example_3_19.sce117
-rwxr-xr-x331/CH3/EX3.2/Example_3_2.sce84
-rwxr-xr-x331/CH3/EX3.3/Example_3_3.sce21
-rwxr-xr-x331/CH3/EX3.4/Example_3_4.sce20
-rwxr-xr-x331/CH3/EX3.5/Example_3_5.sce33
-rwxr-xr-x331/CH3/EX3.6/Example_3_6.sce21
-rwxr-xr-x331/CH3/EX3.7/Example_3_7.sce22
-rwxr-xr-x331/CH3/EX3.8/Example_3_8.sce49
-rwxr-xr-x331/CH3/EX3.9/Example_3_9.sce21
-rwxr-xr-x331/CH4/EX4.1/Example_4_1.sce116
-rwxr-xr-x331/CH4/EX4.2/Example_4_2.sce102
-rwxr-xr-x331/CH4/EX4.3/Example_4_3.sce157
-rwxr-xr-x331/CH4/EX4.4/Example_4_4.sce164
-rwxr-xr-x331/CH4/EX4.5/Example_4_5.sce233
-rwxr-xr-x331/CH6/EX6.1/Example_6_1.sce26
-rwxr-xr-x331/CH6/EX6.2/Example_6_2.sce32
-rwxr-xr-x331/CH6/EX6.3/Example_6_3.sce32
-rwxr-xr-x331/CH6/EX6.4/Example_6_4.sce37
-rwxr-xr-x331/CH6/EX6.5/Example_6_5.sce43
-rwxr-xr-x331/CH6/EX6.6/Example_6_6.sce15
-rwxr-xr-x331/CH6/EX6.7/Example_6_7.sce19
-rwxr-xr-x331/CH6/EX6.8/Example_6_8.sce19
-rwxr-xr-x331/CH6/EX6.9/Example_6_9.sce52
-rwxr-xr-x331/CH7/EX7.1/Example_7_1.sce23
-rwxr-xr-x331/CH7/EX7.10/Example_7_10.sce25
-rwxr-xr-x331/CH7/EX7.11/Example_7_11.sce18
-rwxr-xr-x331/CH7/EX7.12/Example_7_12.sce19
-rwxr-xr-x331/CH7/EX7.13/Example_7_13.sce21
-rwxr-xr-x331/CH7/EX7.14/Example_7_14.sce17
-rwxr-xr-x331/CH7/EX7.15/Example_7_15.sce17
-rwxr-xr-x331/CH7/EX7.2/Example_7_2.sce35
-rwxr-xr-x331/CH7/EX7.3/Example_7_3.sce16
-rwxr-xr-x331/CH7/EX7.4/Example_7_4.sce36
-rwxr-xr-x331/CH7/EX7.5/Example_7_5.sce31
-rwxr-xr-x331/CH7/EX7.6/Example_7_6.sce19
-rwxr-xr-x331/CH7/EX7.7/Example_7_7.sce16
-rwxr-xr-x331/CH7/EX7.8/Example_7_8.sce19
-rwxr-xr-x331/CH7/EX7.9/Example_7_9.sce16
-rwxr-xr-x331/CH8/EX8.1/Example_8_1.sce47
-rwxr-xr-x331/CH8/EX8.10/Example_8_10.sce58
-rwxr-xr-x331/CH8/EX8.11/Example_8_11.sce45
-rwxr-xr-x331/CH8/EX8.12/Example_8_12.sce47
-rwxr-xr-x331/CH8/EX8.13/Example_8_13.sce55
-rwxr-xr-x331/CH8/EX8.14/Example_8_14.sce56
-rwxr-xr-x331/CH8/EX8.15/Example_8_15.sce44
-rwxr-xr-x331/CH8/EX8.16/Example_8_16.sce58
-rwxr-xr-x331/CH8/EX8.17/Example_8_17.sce58
-rwxr-xr-x331/CH8/EX8.18/Example_8_18.sce47
-rwxr-xr-x331/CH8/EX8.19/Example_8_19.sce58
-rwxr-xr-x331/CH8/EX8.2/Example_8_2.sce49
-rwxr-xr-x331/CH8/EX8.20/Example_8_20.sce47
-rwxr-xr-x331/CH8/EX8.21/Example_8_21.sce51
-rwxr-xr-x331/CH8/EX8.22/Example_8_22.sce41
-rwxr-xr-x331/CH8/EX8.23/Example_8_23.sce58
-rwxr-xr-x331/CH8/EX8.24/Example_8_24.sce50
-rwxr-xr-x331/CH8/EX8.25/Example_8_25.sce36
-rwxr-xr-x331/CH8/EX8.26/Example_8_26.sce65
-rwxr-xr-x331/CH8/EX8.27/Example_8_27.sce63
-rwxr-xr-x331/CH8/EX8.28/Example_8_28.sce37
-rwxr-xr-x331/CH8/EX8.29/Example_8_29.sce47
-rwxr-xr-x331/CH8/EX8.3/Example_8_3.sce38
-rwxr-xr-x331/CH8/EX8.30/Example_8_30.sce47
-rwxr-xr-x331/CH8/EX8.31/Example_8_31.sce34
-rwxr-xr-x331/CH8/EX8.32/Example_8_32.sce47
-rwxr-xr-x331/CH8/EX8.33/Example_8_33.sce42
-rwxr-xr-x331/CH8/EX8.34/Example_8_34.sce33
-rwxr-xr-x331/CH8/EX8.35/Example_8_35.sce96
-rwxr-xr-x331/CH8/EX8.36/Example_8_36.sce95
-rwxr-xr-x331/CH8/EX8.37/Example_8_37.sce38
-rwxr-xr-x331/CH8/EX8.38/Example_8_38.sce60
-rwxr-xr-x331/CH8/EX8.4/Example_8_4.sce49
-rwxr-xr-x331/CH8/EX8.5/Example_8_5.sce53
-rwxr-xr-x331/CH8/EX8.6/Example_8_6.sce47
-rwxr-xr-x331/CH8/EX8.7/Example_8_7.sce56
-rwxr-xr-x331/CH8/EX8.8/Example_8_8.sce55
-rwxr-xr-x331/CH8/EX8.9/Example_8_9.sce57
-rwxr-xr-x331/CH9/EX9.1/Example_9_1.sce33
-rwxr-xr-x331/CH9/EX9.10/Example_9_10.sce58
-rwxr-xr-x331/CH9/EX9.11/Example_9_11.sce51
-rwxr-xr-x331/CH9/EX9.12/Example_9_12.sce31
-rwxr-xr-x331/CH9/EX9.13/Example_9_13.sce31
-rwxr-xr-x331/CH9/EX9.14/Example_9_14.sce40
-rwxr-xr-x331/CH9/EX9.15/Example_9_15.sce40
-rwxr-xr-x331/CH9/EX9.16/Example_9_16.sce41
-rwxr-xr-x331/CH9/EX9.17/Example_9_17.sce63
-rwxr-xr-x331/CH9/EX9.18/Example_9_18.sce77
-rwxr-xr-x331/CH9/EX9.19/Example_9_19.sce224
-rwxr-xr-x331/CH9/EX9.2/Example_9_2.sce32
-rwxr-xr-x331/CH9/EX9.20/Example_9_20.sce111
-rwxr-xr-x331/CH9/EX9.21/Example_9_21.sce85
-rwxr-xr-x331/CH9/EX9.22/Example_9_22.sce123
-rwxr-xr-x331/CH9/EX9.23/Example_9_23.sce168
-rwxr-xr-x331/CH9/EX9.3/Example_9_3.sce33
-rwxr-xr-x331/CH9/EX9.4/Example_9_4.sce40
-rwxr-xr-x331/CH9/EX9.5/Example_9_5.sce40
-rwxr-xr-x331/CH9/EX9.6/Example_9_6.sce40
-rwxr-xr-x331/CH9/EX9.7/Example_9_7.sce73
-rwxr-xr-x331/CH9/EX9.8/Example_9_8.sce89
-rwxr-xr-x331/CH9/EX9.9/Example_9_9.sce95
-rwxr-xr-x331/DEPENDENCIES/Add.sce6
-rwxr-xr-x331/DEPENDENCIES/Chi_test.sci12
-rwxr-xr-x331/DEPENDENCIES/F_test.sci12
-rwxr-xr-x331/DEPENDENCIES/Norm_Dis_Diff_Two_Mean.sci6
-rwxr-xr-x331/DEPENDENCIES/Students_t_Var_Unknown.sci9
-rwxr-xr-x331/DEPENDENCIES/nor_dist_stat_finite_po.sci3
-rwxr-xr-x331/DEPENDENCIES/nor_dist_stat_infini_po.sci3
-rwxr-xr-x331/DEPENDENCIES/nor_pop_unknown_large.sci3
-rwxr-xr-x331/DEPENDENCIES/stand_students_t_VarUnkn.sci7
-rwxr-xr-x331/DEPENDENCIES/stand_students_t_distri.sci9
-rwxr-xr-x331/DEPENDENCIES/standard_normal_zstat.sci13
-rwxr-xr-x331/DEPENDENCIES/students_t_distri.sci3
134 files changed, 6886 insertions, 0 deletions
diff --git a/331/CH10/EX10.1/Example_10_1.sce b/331/CH10/EX10.1/Example_10_1.sce
new file mode 100755
index 000000000..030f8e5bd
--- /dev/null
+++ b/331/CH10/EX10.1/Example_10_1.sce
@@ -0,0 +1,75 @@
+//Caption:Correlation Analysis
+//Correlation Coefficient for Ungrouped Data (karl Pearson's Coefficient of Correlation)
+//The combination of hypotheses too test the significance of 'r' is as shown below:
+//Ho: r =0 (The two variables are not associated)
+//H1: r # 0 (The two variables are associated)
+//Example10.1
+//Page368
+clear;
+clc;
+X = [10,12,14,16,18,20,22,24,26,28];//Annual Advertising expenditure
+Y = [20,30,37,50,56,78,89,100,120,110];//Annual sales
+n = length(X);
+Xmean = mean(X);
+Ymean = mean(Y);
+disp(Xmean,'Mean of X=')
+disp(Ymean,'Mean of Y=')
+//correlation coefficient using basic formula
+r=0;
+num=0;
+den1=0;
+den2=0;
+for i = 1:n
+ num=num+((X(i)-Xmean)*(Y(i)-Ymean))
+ den1 = den1+(X(i)-Xmean)^2;
+ den2 = den2+(Y(i)-Ymean)^2;
+end
+r = num/(sqrt(den1)*sqrt(den2));
+disp(r,'The correlaion coefficient between annual advertising expenditure and annual sales revenue r =')
+//correlation coefficient using Pearson's product moment formula
+sumxi = sum(X);
+sumyi = sum(Y);
+xiyi = X.*Y;
+sumxiyi = sum(xiyi);
+sumxi2 = sum(X.^2);
+sumyi2 = sum(Y.^2);
+r = (n*sumxiyi-sumxi*sumyi)/(sqrt(n*sumxi2-sumxi^2)*sqrt(n*sumyi2-sumyi^2));
+disp(r,'The correlation coefficient using Pearsons product moment formula r=')
+t = r/sqrt((1-r^2)/(n-2));
+disp(t,'The calculated t statistic to test the significance of r t=')
+alpha = 0.05;
+alpha = alpha/2;
+t_stand = 2.306;
+disp(t_stand,'The table t value at half of the significance level and 8 degrees of freedom=')
+if (t<t_stand) then
+ disp('Since the calculated t statistic is less than table t value, accept Null hypothesis')
+else
+ disp('Since the calculated t statistic is greater than table t value, reject Null hypothesis')
+end
+//Result
+//Mean of X=
+//
+// 19.
+//
+// Mean of Y=
+//
+// 69.
+//
+// The correlaion coefficient between annual advertising expenditure and annual sales revenue r =
+//
+// 0.9851764
+//
+// The correlation coefficient using Pearsons product moment formula r=
+//
+// 0.9851764
+//
+// The calculated t statistic to test the significance of r t=
+//
+// 16.243604
+//
+// The table t value at half of the significance level and 8 degrees of freedom=
+//
+// 2.306
+//
+// Since the calculated t statistic is greater than table t value, reject Null hypothesis
+ \ No newline at end of file
diff --git a/331/CH10/EX10.10/Example_10_10.sce b/331/CH10/EX10.10/Example_10_10.sce
new file mode 100755
index 000000000..b2c39d346
--- /dev/null
+++ b/331/CH10/EX10.10/Example_10_10.sce
@@ -0,0 +1,87 @@
+//Caption: Linear regression and Time series
+//Simple regression
+//Example10.10
+//Page391
+clear;
+clc;
+x = [10,15,20,25,30,35,40];//R&D expenditure
+X = x-25;
+y = [25,35,45,55,70,65,85];//Sales
+disp('Regression model to estimate the sales(Y) for a given level of R&D activity')
+[b,a,sig]=reglin(X,y);//Linear Regression
+disp(b,'Regression coefficient b=')
+disp(a,'Regression coefficient a=')
+Y = a+b*X;
+disp(Y,'Forecast of Y=')
+Error = y-Y;
+disp(Error,'Error y-Y=')
+SqrError = (y-Y).^2;
+disp(SqrError,'Squared Error=')
+MeanSqrErr = sum(SqrError)/length(x);
+disp(MeanSqrErr,'Mean Squared Error =')
+disp('Regession Model to estimate the R&D expenditure (X) for a desired sales (Y)')
+[b1,a1,sig] = reglin(y,x)
+disp(b1,'Regression coefficient b=')
+disp(a1,'Regression coefficient a=')
+X = -2.4416+0.5055*y;
+disp(X,'Forecast of X=')
+Error = x-X;
+disp(Error,'Error x-X=')
+SqrError = (x-X).^2;
+disp(SqrError,'Squared Error=')
+MeanSqrErr = sum(SqrError)/length(x);
+disp(MeanSqrErr,'Mean Squared Error =')
+//Result
+//
+// Regression model to estimate the sales(Y) for a given level of R&D activity
+//
+// Regression coefficient b=
+//
+// 1.8928571
+//
+// Regression coefficient a=
+//
+// 54.285714
+//
+// Forecast of Y=
+//
+// 25.892857 35.357143 44.821429 54.285714 63.75 73.214286 82.678571
+//
+// Error y-Y=
+//
+// - 0.8928571 - 0.3571429 0.1785714 0.7142857 6.25 - 8.2142857 2.3214286
+//
+// Squared Error=
+//
+// 0.7971939 0.1275510 0.0318878 0.5102041 39.0625 67.47449 5.3890306
+//
+// Mean Squared Error =
+//
+// 16.19898
+//
+// Regession Model to estimate the R&D expenditure (X) for a desired sales (Y)
+//
+// Regression coefficient b=
+//
+// 0.5054496
+//
+// Regression coefficient a=
+//
+// - 2.4386921
+//
+// Forecast of X=
+//
+// 10.1959 15.2509 20.3059 25.3609 32.9434 30.4159 40.5259
+//
+// Error x-X=
+//
+// - 0.1959 - 0.2509 - 0.3059 - 0.3609 - 2.9434 4.5841 - 0.5259
+//
+// Squared Error=
+//
+// 0.0383768 0.0629508 0.0935748 0.1302488 8.6636036 21.013973 0.2765708
+//
+// Mean Squared Error =
+//
+// 4.3256141
+// \ No newline at end of file
diff --git a/331/CH10/EX10.11/Example_10_11.sce b/331/CH10/EX10.11/Example_10_11.sce
new file mode 100755
index 000000000..cb75f880b
--- /dev/null
+++ b/331/CH10/EX10.11/Example_10_11.sce
@@ -0,0 +1,27 @@
+//Caption: Linear regression and Time series
+//Simple regression
+//Example10.11
+//Page393
+clear;
+clc;
+MeanX = 25;
+Meany = 150;
+StdX = 2;
+StdY = 8;
+r = 0.9;
+//Estimation of the value of Y when X =10
+X = 10;
+Y = Meany+r*(StdY/StdX)*(X-MeanX);
+disp(Y,'Estimated value of Y when X =10, Y=')
+//Estimation of the value of X when Y = 96
+Y = 96;
+X = MeanX+r*(StdX/StdY)*(Y-Meany);
+disp(X,'Estimated value of X when Y =96, X=')
+//Result
+//Estimated value of Y when X =10, Y=
+//
+// 96.
+//
+// Estimated value of X when Y =96, X=
+//
+// 12.85 \ No newline at end of file
diff --git a/331/CH10/EX10.2/Example_10_2.sce b/331/CH10/EX10.2/Example_10_2.sce
new file mode 100755
index 000000000..1437ee197
--- /dev/null
+++ b/331/CH10/EX10.2/Example_10_2.sce
@@ -0,0 +1,154 @@
+//Caption: Correlation for Grouped Data (Karl Pearson's Coefficient of Correlation)
+//Example10.2
+//Page372
+clear;
+clc;
+X = [9,11;11,13;13,15;15,17];//Rate of return
+Y = [2,4;4,6;6,8];//Equity (crores of Rs.)
+[m1,n1] = size(X);
+[m2,n2] = size(Y);
+for i = 1:m1
+ Xmid(i) = mean(X(i,:));
+end
+for i = 1:m2
+ Ymid(i) = mean(Y(i,:));
+end
+a = [2,5,1;5,7,2;3,7,8;1,3,6];
+disp(Xmid,'Mid-Xi=');
+disp(Ymid,'Mid-Yi=');
+disp(a,'aij=');
+for i = 1:length(Xmid)
+ for j = 1:length(Ymid)
+ fij(i,j) = a(i,j)*Xmid(i)*Ymid(j);
+ fj(j) = sum(a(:,j));
+ fjYj(j)= fj(j)*Ymid(j);
+ fjYj2(j) = fj(j)*(Ymid(j)^2);
+ end
+ fi(i)= sum(a(i,:));
+ fiXi(i) = fi(i)*Xmid(i);
+ fiXi2(i) = fi(i)*(Xmid(i)^2);
+ sumfij(i) = sum(fij(i,:));
+end
+N = sum(fj);
+disp(N,'N=')
+disp(fij,'fij=')
+disp(fj,'fj=')
+disp(fjYj,'fjYj=')
+disp(fjYj2,'fjYj2=')
+disp(fi,'fi=')
+disp(fiXi,'fiXi=')
+disp(fiXi2,'fiXi2=')
+disp(sumfij,'sigmafij=')
+sumfjYj = sum(fjYj);
+disp(sumfjYj,'fjYj=')
+sumfjYj2 = sum(fjYj2);
+disp(sumfjYj2,'fjYj2=')
+ssumfij = sum(sumfij);
+disp(ssumfij,'Sigmafij=')
+sumfiXi = sum(fiXi);
+disp(sumfiXi,'SigmafiXi=')
+sumfiXi2 = sum(fiXi2);
+disp(sumfiXi2,'SigmafiXi2=')
+rg = (N*ssumfij-sumfiXi*sumfjYj)/(sqrt(N*sumfiXi2-sumfiXi^2)*sqrt(N*sumfjYj2-sumfjYj^2));
+disp(rg,'The correlation coefficient rg =')
+//Result
+// Mid-Xi=
+//
+// 10.
+// 12.
+// 14.
+// 16.
+//
+// Mid-Yi=
+//
+// 3.
+// 5.
+// 7.
+//
+// aij=
+//
+// 2. 5. 1.
+// 5. 7. 2.
+// 3. 7. 8.
+// 1. 3. 6.
+//
+// N=
+//
+// 50.
+//
+// fij=
+//
+// 60. 250. 70.
+// 180. 420. 168.
+// 126. 490. 784.
+// 48. 240. 672.
+//
+// fj=
+//
+// 11.
+// 22.
+// 17.
+//
+// fjYj=
+//
+// 33.
+// 110.
+// 119.
+//
+// fjYj2=
+//
+// 99.
+// 550.
+// 833.
+//
+// fi=
+//
+// 8.
+// 14.
+// 18.
+// 10.
+//
+// fiXi=
+//
+// 80.
+// 168.
+// 252.
+// 160.
+//
+// fiXi2=
+//
+// 800.
+// 2016.
+// 3528.
+// 2560.
+//
+// sigmafij=
+//
+// 380.
+// 768.
+// 1400.
+// 960.
+//
+// fjYj=
+//
+// 262.
+//
+// fjYj2=
+//
+// 1482.
+//
+// Sigmafij=
+//
+// 3508.
+// SigmafiXi=
+//
+// 660.
+//
+// SigmafiXi2=
+//
+// 8904.
+//
+// The correlation coefficient rg =
+//
+// 0.3426722
+ \ No newline at end of file
diff --git a/331/CH10/EX10.3/Example_10_3.sce b/331/CH10/EX10.3/Example_10_3.sce
new file mode 100755
index 000000000..de461bd02
--- /dev/null
+++ b/331/CH10/EX10.3/Example_10_3.sce
@@ -0,0 +1,36 @@
+//Caption: Rank Correlation
+//Test of Significance of rank correlation coefficient
+//Example10.3
+//Page375
+X = [1,2,3,4,5,6,7,8,9,10];//rating by judge-1
+Y = [2,4,5,1,3,6,7,9,10,8];//rating by judge-2
+n = length(X);
+rs = 0;
+for i = 1:n
+ rs = rs+(X(i)-Y(i))^2;
+end
+rs = 1-6*(rs/(n*(n^2-1)));
+disp(rs,'The rank correlation coefficient is rs=');
+t = rs*sqrt((n-2)/(1-rs^2));
+disp(t,'The Calculated t statistic t=')
+t_stand = 2.306;
+disp(t_stand,'The table t value for 8 degrees of freedom and significance level = 0.025')
+if (t<t_stand) then
+ disp('Accept Null Hypothesis')
+else
+ disp('The caculated t statistic is > table t value, reject Null hypothesis')
+end
+//Result
+//The rank correlation coefficient is rs=
+//
+// 0.8303030
+//
+// The Calculated t statistic t=
+//
+// 4.2138888
+//
+// The table t value for 8 degrees of freedom and significance level = 0.025
+//
+// 2.306
+//
+// The caculated t statistic is > table t value, reject Null hypothesis \ No newline at end of file
diff --git a/331/CH10/EX10.4/Example_10_4.sce b/331/CH10/EX10.4/Example_10_4.sce
new file mode 100755
index 000000000..f0952e254
--- /dev/null
+++ b/331/CH10/EX10.4/Example_10_4.sce
@@ -0,0 +1,23 @@
+//Caption: Auto-correlation
+//Example10.4
+//Page377
+clear;
+clc;
+X = [20,30,50,60,80,90,100,120,140,160];//demand
+n = length(X); //number of years
+//Auto-correlation coefficient r1 for One year lag data
+[cov,Mean]=corr(X,2);
+r1 = cov(2)/cov(1);
+disp(r1,'Auto-correlation coefficient for one year lag data r1=')
+//Auto-correlation coefficient r1 for Two year lag data
+[cov,Mean]=corr(X,3);
+r2 = cov(3)/cov(1);
+disp(r2,'Auto-correlation coefficient for one year lag data r1=')
+//Result
+//Auto-correlation coefficient for one year lag data r1=
+//
+// 0.6818182
+//
+// Auto-correlation coefficient for one year lag data r1=
+//
+// 0.3766234
diff --git a/331/CH10/EX10.5/Example_10_5.sce b/331/CH10/EX10.5/Example_10_5.sce
new file mode 100755
index 000000000..5bc572925
--- /dev/null
+++ b/331/CH10/EX10.5/Example_10_5.sce
@@ -0,0 +1,56 @@
+//Caption: Forecasting
+//Simple Moving Average Method
+//Example10.5
+//Page381
+clear;
+clc;
+Dt = [24,30,27,24,39,45,42,51];//Demand Di
+n = length(Dt);//Month (t)
+//Three months moving average
+for i = 3:n
+ Mt(i-2) = mean(Dt([(i-2):i]));
+end
+disp(Mt,'Three Months moving average Mt=')
+for i = 1:length(Mt)-1
+ Ft(i) = Mt(i);
+ et(i) = Dt(i+3)-Ft(i);
+end
+disp(Ft,'Forecast Ft=')
+disp(et,'Error et=')
+MAD = sum(abs(et(:)))/length(et);
+disp(MAD,'Mean Absolute Deviation MAD=')
+MFE = sum(et(:))/length(et);
+disp(MFE,'Mean Forecast Error MFE=')
+//Result
+// Three Months moving average Mt=
+//
+// 27.
+// 27.
+// 30.
+// 36.
+// 42.
+// 46.
+//
+// Forecast Ft=
+//
+// 27.
+// 27.
+// 30.
+// 36.
+// 42.
+//
+// Error et=
+//
+// - 3.
+// 12.
+// 15.
+// 6.
+// 9.
+//
+// Mean Absolute Deviation MAD=
+//
+// 9.
+//
+// Mean Forecast Error MFE=
+//
+// 7.8
diff --git a/331/CH10/EX10.6/Example_10_6.sce b/331/CH10/EX10.6/Example_10_6.sce
new file mode 100755
index 000000000..29f4ebd59
--- /dev/null
+++ b/331/CH10/EX10.6/Example_10_6.sce
@@ -0,0 +1,51 @@
+//Caption:Weighted Moving Average Method
+//Example10.6
+//Page383
+clear;
+clc;
+Dt = [80,90,70,100,70,90];//Demand of a product
+t = length(Dt);// months
+W = [0.2,0.3,0.5];//weights
+//Three months weighted moving averages
+for i = 3:t
+ Wt(i-2) = W*Dt([(i-2):i])' ;
+ WtMA(i-2) = Wt(i-2)/sum(W)
+end
+disp(WtMA,'Three Months weighted moving average Mt=')
+for i = 1:length(Wt)-1
+ Ft(i) = WtMA(i);
+ et(i) = Dt(i+3)-Ft(i);
+end
+disp(Ft,'Forecast Ft=')
+disp(et,'Error et=')
+MAD = sum(abs(et(:)))/length(et);
+disp(MAD,'Mean Absolute Deviation MAD=')
+MFE = sum(et(:))/length(et);
+disp(MFE,'Mean Forecast Error MFE=')
+//Result
+//Three Months weighted moving average Mt=
+//
+// 78.
+// 89.
+// 79.
+// 86.
+//
+// Forecast Ft=
+//
+// 78.
+// 89.
+// 79.
+//
+// Error et=
+//
+// 22.
+// - 19.
+// 11.
+//
+// Mean Absolute Deviation MAD=
+//
+// 17.333333
+//
+// Mean Forecast Error MFE=
+//
+// 4.6666667 \ No newline at end of file
diff --git a/331/CH10/EX10.7/Example_10_7.sce b/331/CH10/EX10.7/Example_10_7.sce
new file mode 100755
index 000000000..a6c190386
--- /dev/null
+++ b/331/CH10/EX10.7/Example_10_7.sce
@@ -0,0 +1,21 @@
+//Caption:Simple (Single) Exponential Smoothing Method
+//Example10.7
+//Page385
+clear;
+clc;
+F1 = 600;//forecast of a product for the first week of march
+D1 = 550; //Demand of the first week
+D2 = 620; //Demand of the second week
+alpha = 0.2; //smoothing constant
+F2 = F1+alpha*(D1-F1);
+disp(F2,'Forecast for the second week of march F2=')
+F3 = F2+alpha*(D2-F2);
+disp(F3,'Forecast for the third week of march F3=')
+//Result
+//Forecast for the second week of march F2=
+//
+// 590.
+//
+// Forecast for the third week of march F3=
+//
+// 596. \ No newline at end of file
diff --git a/331/CH10/EX10.8/Example_10_8.sce b/331/CH10/EX10.8/Example_10_8.sce
new file mode 100755
index 000000000..7078a92ce
--- /dev/null
+++ b/331/CH10/EX10.8/Example_10_8.sce
@@ -0,0 +1,33 @@
+//Caption: Linear regression and Time series
+//Simple regression
+//Example10.8
+//Page388
+clear;
+clc;
+x = [1997,1998,1999,2000,2001,2002];//Year
+X = x-2000;
+y = [50,60,50,80,72,90];//Demand
+[b,a,sig]=reglin(X,y);//Linear Regression
+disp(b,'Regression coefficient b=')
+disp(a,'Regression coefficient a=')
+D = 2008;
+Y = a+b*(D-2000);
+disp(Y,'Demand for the year 2008 Y=')
+disp(Y*100000,'Demand in lakhs tons Y=')
+//Result
+//Regression coefficient b=
+//
+// 7.6
+//
+// Regression coefficient a=
+//
+// 70.8
+//
+// Demand for the year 2008 Y=
+//
+// 131.6
+//
+// Demand in lakhs tons Y=
+//
+// 13160000.
+// \ No newline at end of file
diff --git a/331/CH10/EX10.9/Example_10_9.sce b/331/CH10/EX10.9/Example_10_9.sce
new file mode 100755
index 000000000..fae2045bc
--- /dev/null
+++ b/331/CH10/EX10.9/Example_10_9.sce
@@ -0,0 +1,28 @@
+//Caption: Linear regression and Time series
+//Simple regression
+//Example10.9
+//Page389
+clear;
+clc;
+x = [1994,1995,1996,1997,1998,1999,2000,2001,2002];//Year
+X = x-1998;
+y = [10,12,15,27,33,38,44,49,60];//sales
+[b,a,sig]=reglin(X,y);//Linear Regression
+disp(b,'Regression coefficient b=')
+disp(a,'Regression coefficient a=')
+D = 2006;
+Y = a+b*(D-1998);
+disp(Y*100000,'Sales for the year 2006 in lakhs of tons Y=')
+
+//Result
+//Regression coefficient b=
+//
+// 6.3333333
+//
+// Regression coefficient a=
+//
+// 32.
+//
+// Sales for the year 2006 in lakhs of tons Y=
+//
+// 8266666.7 \ No newline at end of file
diff --git a/331/CH11/EX11.1/Example_11_1.sce b/331/CH11/EX11.1/Example_11_1.sce
new file mode 100755
index 000000000..9068ce2c5
--- /dev/null
+++ b/331/CH11/EX11.1/Example_11_1.sce
@@ -0,0 +1,112 @@
+//Caption:Discriminant Analysis
+//Two-group Discriminan Analysis
+//Example11.1
+//Page424
+clear;
+clc;
+X1_Below =[3,4,5,6,7,8,9];
+X1_Above = [10,11,12,13,14];
+X2_Below = [4,5,4,6,4,7,5];
+X2_Above = [7,4,5,6,8];
+X1_Below_Mean = sum(X1_Below)/length(X1_Below);
+X2_Below_Mean = sum(X2_Below)/length(X2_Below);
+X1_Above_Mean = sum(X1_Above)/length(X1_Above);
+X2_Above_Mean = sum(X2_Above)/length(X2_Above);
+disp(X1_Below_Mean,'Group1 X1 Below Mean=');
+disp(X2_Below_Mean,'Group1 X2 Below Mean=');
+disp(X1_Above_Mean,'Group2 X1 Above Mean=');
+disp(X2_Above_Mean,'Group1 X2 Above Mean=');
+a= 0.17229;
+b = -0.04973;
+S1bar = a*X1_Below_Mean+b*X2_Below_Mean;
+disp(S1bar,'Mean of discriminant scores of group1 S1bar=')
+S2bar = a*X1_Above_Mean+b*X2_Above_Mean;
+disp(S2bar,'Mean of discriminant scores of group2 S2bar=')
+for j = 1:length(X1_Below)
+ S_1(1,j)= 0.17229*X1_Below(j)-0.04973*X2_Below(j);//Discriminant score (S1j)
+ S1(j) = (S_1(1,j)-S1bar)^2
+end
+disp(S_1(1,:),'Discriminant score S1j=')
+disp(S1,'(S1j-S1bar)^2=')
+for j = 1:length(X1_Above)
+ S_2(2,j)= 0.17229*X1_Above(j)-0.04973*X2_Above(j);//Discriminant score (S2j)
+ S2(j) = (S_2(2,j)-S2bar)^2
+end
+disp(S_2(2,:),'Discriminant score S1j=')
+disp(S2,'(S2j-S2bar)^2=')
+X1_GrandMean = (sum(X1_Below)+sum(X1_Above))/(length(X1_Below)+length(X1_Above));
+X2_GrandMean = (sum(X2_Below)+sum(X2_Above))/(length(X1_Below)+length(X1_Above));
+S = 0.17229*X1_GrandMean-0.04973*X2_GrandMean;
+disp(S,'Y(Grand Mean)=')
+n1 = length(X1_Below);
+n2 = length(X1_Above);
+VBG = n1*(S1bar-S)^2+n2*(S2bar-S)^2;
+disp(VBG,'Sum of squares between groups VBG=')
+VWG = sum(S1)+sum(S2);
+disp(VWG,'Sum of squares within groups VWG=');
+K = VBG/VWG;
+disp(K,'The Discriminant ratio K=')
+m=2;
+disp(m,'No.of factors m =2')
+D = (n1+n2-2)*(a*(X1_Above_Mean-X1_Below_Mean)+b*(X2_Above_Mean-X2_Below_Mean))
+disp(D,'Mahalanobis Squared Distance D=')
+num = n1*n2*(n1+n2-m-1);
+den = m*(n1+n2)*(n1+n2-2);
+F = (num/den)*D;
+disp(F,'F Ratio F=')
+Ftable = 4.26;
+disp(Ftable,'The table value of F for(2,9) degrees of freedom=')
+if (F>Ftable)
+ disp('The calculated F value > table F value. Hence Reject Null Hypohesis')
+else
+ disp('Accept Null Hypothesis')
+end
+//Result
+
+// Group1 X1 Below Mean=
+// 6.
+// Group1 X2 Below Mean=
+// 5.
+// Group2 X1 Above Mean=
+// 12.
+// Group1 X2 Above Mean=
+// 6.
+// Mean of discriminant scores of group1 S1bar=
+// 0.78509
+// Mean of discriminant scores of group2 S2bar=
+// 1.7691
+// Discriminant score S1j=
+// 0.31795 0.44051 0.66253 0.73536 1.00711 1.03021 1.30196
+// (S1j-S1bar)^2=
+// 0.2182198
+// 0.1187354
+// 0.0150210
+// 0.0024731
+// 0.0492929
+// 0.0600838
+// 0.2671546
+// Discriminant score S1j=
+// 1.37479 1.69627 1.81883 1.94139 2.01422
+// S2j-S2bar)^2=
+// 0.1554804
+// 0.0053042
+// 0.0024731
+// 0.0296838
+// 0.0600838
+// Y(Grand Mean)=
+// 1.1950942
+// Sum of squares between groups VBG=
+// 2.8241374
+// Sum of squares within groups VWG=
+// 0.9840058
+// The Discriminant ratio K=
+// 2.8700414
+// No.of factors m =2
+// 2.
+// Mahalanobis Squared Distance D=
+// 9.8401
+// F Ratio F=
+// 12.915131
+// The table value of F for(2,9) degrees of freedom=
+// 4.26
+// The calculated F value > table F value. Hence Reject Null Hypohesis \ No newline at end of file
diff --git a/331/CH11/EX11.2/Example_11_2.sce b/331/CH11/EX11.2/Example_11_2.sce
new file mode 100755
index 000000000..d4baf58d9
--- /dev/null
+++ b/331/CH11/EX11.2/Example_11_2.sce
@@ -0,0 +1,300 @@
+//Caption: Factor Analysis
+//Centroid Method
+//Example11.2
+//Page439
+clear;
+clc;
+X1 = [6,4,4,1,4,4,3,7,5,5];// Fuel Efficiency
+X2 = [8,4,1,2,3,4,3,7,3,4];//Life of the two-wheeler
+X3 = [9,6,6,6,5,6,0,6,1,2];//Handling convenience
+X4 = [9,8,5,3,5,8,9,9,8,3];//Quality of original spare
+X5 = [1,2,1,2,2,2,1,9,1,1];//Breakdown rate
+X6 = [2,1,2,3,3,3,3,2,2,0];//Price
+n = 6;//number of variables
+m = length(X1);//number of sets of observations
+F = 3;//number of factors to be identified
+f = 1;//current factor number
+Xcorr1 = [1,0.742,0.168,0.496,0.484,-0.430;0.742,1,0.424,0.568,0.474,-0.204;0.168,0.424,1,0.050,0.238,0.092]
+Xcorr2 = [0.496,0.568,0.050,1,0.29,0.196;0.484,0.474,0.238,0.290,1,0.037;-0.430,-0.204,0.092,0.196,0.037,1];
+Xcorr = [Xcorr1;Xcorr2]
+Xcorr_ref = abs(Xcorr)
+disp(Xcorr_ref,'Correlation Coefficient Matrix=')
+for j = 1:n
+ S(j)= sum(Xcorr_ref(:,j))
+end
+disp(S,'column totals S=')
+T = sum(S);
+disp(T,'Grand total of column totals T=')
+Tsqrt = sqrt(T);
+for j = 1:n
+ L1(j)= S(j)/Tsqrt;
+ if j ==n then
+ L1(j)=-L1(j);
+ end
+end
+disp(L1,'Loading values of factor1 L1=')
+for i = 1:n
+ for j =1:n
+ P2(i,j)= L1(i)*L1(j);
+ R2(i,j) = Xcorr(i,j)-P2(i,j)
+ if (R2(i,j)<0) then
+ R2_ref(i,j)= -R2(i,j);
+ else
+ R2_ref(i,j)= R2(i,j);
+ end
+ end
+end
+disp(P2,'Cross-Product matrix P2=')
+disp(R2,'Residual matrix R2=')
+disp(R2_ref,'Reflected residual matrix R2=')
+for j = 1:n
+ S1(j)= sum(R2_ref(:,j))
+end
+disp(S1,'column totals S1=')
+T1 = sum(S1);
+disp(T1,'Grand total of column totals T1=')
+Tsqrt1 = sqrt(T1);
+for j = 1:n
+ L2(j)= S1(j)/Tsqrt1;
+ if S1(j)>1 then
+ L2(j)=-L2(j);
+ end
+end
+disp(L2,'Loading values of factor2 L2=')
+for i = 1:n
+ for j =1:n
+ P3(i,j)= L2(i)*L2(j);
+ R3(i,j) = R2(i,j)-P3(i,j)
+ if (R3(i,j)<0) then
+ R3_ref(i,j)= -R3(i,j);
+ else
+ R3_ref(i,j)= R3(i,j);
+ end
+ end
+end
+disp(P3,'Cross-Product matrix P3=')
+disp(R3,'Residual matrix R3=')
+disp(R3_ref,'Reflected residual matrix R3=')
+for j = 1:n
+ S2(j)= sum(R3_ref(:,j))
+end
+disp(S2,'column totals S2=')
+T2 = sum(S2);
+disp(T2,'Grand total of column totals T2=')
+Tsqrt2 = sqrt(T2);
+for j = 1:n
+ L3(j)= S2(j)/Tsqrt2;
+ if S2(j)>0.8 then
+ L3(j)=-L3(j);
+ end
+end
+disp(L3,'Loading values of factor3 L3=')
+for i = 1:n
+ for j = 1:F
+ h(i) = L1(i)^2+L2(i)^2+L3(i)^2;
+ end
+end
+disp(h,'Communality h^2 =')
+EigenValueL1 = sum(L1.^2);
+EigenValueL2 = sum(L2.^2);
+EigenValueL3 = sum(L3.^2);
+EigenValueh = sum(h);
+disp(EigenValueL1,'Eigen Value of L1 =')
+disp(EigenValueL2,'Eigen Value of L2 =')
+disp(EigenValueL3,'Eigen Value of L3 =')
+disp(EigenValueh,'Eigen Value of h =')
+disp([EigenValueL1/n,EigenValueL2/n,EigenValueL3/n],'Proportion of total variance=')
+disp([EigenValueL1/EigenValueh,EigenValueL2/EigenValueh,EigenValueL3/EigenValueh],'Proportion of common variance=')
+disp(round(EigenValueL1*100/n),'The proportion of total variance of the factor-1=')
+disp(round(EigenValueL2*100/n),'The proportion of total variance of the factor-1=')
+disp(round(EigenValueL3*100/n),'The proportion of total variance of the factor-1=')
+disp(round(EigenValueL1*100/EigenValueh),'The proportion of common variance=')
+disp(round(EigenValueL2*100/EigenValueh),'The proportion of common variance=')
+disp(round(EigenValueL3*100/EigenValueh),'The proportion of common variance=')
+//Result
+
+// Correlation Coefficient Matrix=
+//
+// 1. 0.742 0.168 0.496 0.484 0.43
+// 0.742 1. 0.424 0.568 0.474 0.204
+// 0.168 0.424 1. 0.05 0.238 0.092
+// 0.496 0.568 0.05 1. 0.29 0.196
+// 0.484 0.474 0.238 0.29 1. 0.037
+// 0.43 0.204 0.092 0.196 0.037 1.
+//
+// column totals S=
+//
+// 3.32
+// 3.412
+// 1.972
+// 2.6
+// 2.523
+// 1.959
+//
+// Grand total of column totals T=
+//
+// 15.786
+//
+// Loading values of factor1 L1=
+//
+// 0.8356069
+// 0.8587623
+// 0.4963304
+// 0.6543910
+// 0.6350109
+// - 0.4930584
+//
+// Cross-Product matrix P2=
+//
+// 0.6982389 0.7175877 0.4147371 0.5468136 0.5306195 - 0.4120030
+// 0.7175877 0.7374727 0.4262298 0.5619663 0.5453235 - 0.4234200
+// 0.4147371 0.4262298 0.2463438 0.3247941 0.3151752 - 0.2447199
+// 0.5468136 0.5619663 0.3247941 0.4282275 0.4155454 - 0.3226530
+// 0.5306195 0.5453235 0.3151752 0.4155454 0.4032389 - 0.3130975
+// - 0.4120030 - 0.4234200 - 0.2447199 - 0.3226530 - 0.3130975 0.2431066
+//
+// Residual matrix R2=
+//
+// 0.3017611 0.0244123 - 0.2467371 - 0.0508136 - 0.0466195 - 0.0179970
+// 0.0244123 0.2625273 - 0.0022298 0.0060337 - 0.0713235 0.2194200
+// - 0.2467371 - 0.0022298 0.7536562 - 0.2747941 - 0.0771752 0.3367199
+// - 0.0508136 0.0060337 - 0.2747941 0.5717725 - 0.1255454 0.5186530
+// - 0.0466195 - 0.0713235 - 0.0771752 - 0.1255454 0.5967611 0.3500975
+// - 0.0179970 0.2194200 0.3367199 0.5186530 0.3500975 0.7568934
+//
+// Reflected residual matrix R2=
+//
+// 0.3017611 0.0244123 0.2467371 0.0508136 0.0466195 0.0179970
+// 0.0244123 0.2625273 0.0022298 0.0060337 0.0713235 0.2194200
+// 0.2467371 0.0022298 0.7536562 0.2747941 0.0771752 0.3367199
+// 0.0508136 0.0060337 0.2747941 0.5717725 0.1255454 0.5186530
+// 0.0466195 0.0713235 0.0771752 0.1255454 0.5967611 0.3500975
+// 0.0179970 0.2194200 0.3367199 0.5186530 0.3500975 0.7568934
+//
+// column totals S1=
+//
+// 0.6883406
+// 0.5859465
+// 1.6913123
+// 1.5476123
+// 1.2675222
+// 2.1997807
+//
+// Grand total of column totals T1=
+//
+// 7.9805146
+//
+// Loading values of factor2 L2=
+//
+// 0.2436621
+// 0.2074161
+// - 0.5986988
+// - 0.5478312
+// - 0.4486835
+// - 0.7786888
+//
+// Cross-Product matrix P3=
+//
+// 0.0593712 0.0505394 - 0.1458802 - 0.1334857 - 0.1093272 - 0.1897369
+// 0.0505394 0.0430215 - 0.1241798 - 0.1136290 - 0.0930642 - 0.1615126
+// - 0.1458802 - 0.1241798 0.3584402 0.3279858 0.2686263 0.4662000
+// - 0.1334857 - 0.1136290 0.3279858 0.3001190 0.2458028 0.4265900
+// - 0.1093272 - 0.0930642 0.2686263 0.2458028 0.2013169 0.3493849
+// - 0.1897369 - 0.1615126 0.4662000 0.4265900 0.3493849 0.6063563
+//
+// Residual matrix R3=
+//
+// 0.2423899 - 0.0261272 - 0.1008569 0.0826720 0.0627076 0.1717400
+// - 0.0261272 0.2195058 0.1219500 0.1196627 0.0217408 0.3809326
+// - 0.1008569 0.1219500 0.3952159 - 0.6027800 - 0.3458015 - 0.1294801
+// 0.0826720 0.1196627 - 0.6027800 0.2716535 - 0.3713482 0.0920630
+// 0.0627076 0.0217408 - 0.3458015 - 0.3713482 0.3954442 0.0007126
+// 0.1717400 0.3809326 - 0.1294801 0.0920630 0.0007126 0.1505371
+//
+// Reflected residual matrix R3=
+//
+// 0.2423899 0.0261272 0.1008569 0.0826720 0.0627076 0.1717400
+// 0.0261272 0.2195058 0.1219500 0.1196627 0.0217408 0.3809326
+// 0.1008569 0.1219500 0.3952159 0.6027800 0.3458015 0.1294801
+// 0.0826720 0.1196627 0.6027800 0.2716535 0.3713482 0.0920630
+// 0.0627076 0.0217408 0.3458015 0.3713482 0.3954442 0.0007126
+// 0.1717400 0.3809326 0.1294801 0.0920630 0.0007126 0.1505371
+//
+// column totals S2=
+//
+// 0.6864936
+// 0.8899191
+// 1.6960844
+// 1.5401794
+// 1.1977549
+// 0.9254655
+//
+// Grand total of column totals T2=
+//
+// 6.935897
+//
+// Loading values of factor3 L3=
+//
+// 0.2606665
+// - 0.3379086
+// - 0.6440153
+// - 0.5848170
+// - 0.4547960
+// - 0.3514058
+//
+// Communality h^2 =
+//
+// 0.8255572
+// 0.8946764
+// 1.0195397
+// 1.0703575
+// 0.8113952
+// 0.9729489
+//
+// Eigen Value of L1 =
+//
+// 2.7566285
+//
+// Eigen Value of L2 =
+//
+// 1.568625
+//
+// Eigen Value of L3 =
+//
+// 1.2692212
+//
+// Eigen Value of h =
+//
+// 5.5944748
+//
+// Proportion of total variance=
+//
+// 0.4594381 0.2614375 0.2115369
+//
+// Proportion of common variance=
+//
+// 0.4927413 0.2803883 0.2268705
+//
+// The proportion of total variance of the factor-1=
+//
+// 46.
+//
+// The proportion of total variance of the factor-1=
+//
+// 26.
+//
+// The proportion of total variance of the factor-1=
+//
+// 21.
+//
+// The proportion of common variance=
+//
+// 49.
+//
+// The proportion of common variance=
+//
+// 28.
+//
+// The proportion of common variance=
+//
+// 23. \ No newline at end of file
diff --git a/331/CH3/EX3.1/Example_3_1.sce b/331/CH3/EX3.1/Example_3_1.sce
new file mode 100755
index 000000000..e866b59ff
--- /dev/null
+++ b/331/CH3/EX3.1/Example_3_1.sce
@@ -0,0 +1,11 @@
+//Caption: Program to determine the Arithmetic Mean
+//Example 3.1
+//Page 40
+clc;
+x = input('Monthly Salaries of Employees');
+n = length(x); //Number of Observations
+X = sum(x)/n;
+disp(X,'Arithmetic mean of salaries of the employees =')
+//Result
+//Monthly Salaries of Employees [12000,14500,8500,13500,13500,17500,11500];
+//Arithmetic mean of salaries of the employees = 13000 \ No newline at end of file
diff --git a/331/CH3/EX3.10/Example_3_10.sce b/331/CH3/EX3.10/Example_3_10.sce
new file mode 100755
index 000000000..6049dc109
--- /dev/null
+++ b/331/CH3/EX3.10/Example_3_10.sce
@@ -0,0 +1,23 @@
+//Caption: Mode of grouped data
+//Example3.10
+//Page47
+clear;
+clc;
+X = [0,2;2,4;4,6;6,8;8,10;10,12;12,14;14,16;16,18];
+f = [10,15,20,30,8,5,4,3,5];
+[Maxf,i]= max(f);
+L = X(i,1); //Lower Limit of the Modal class
+C = diff(X(i,:)); //Width of the class interval
+f1 = abs(f(i)-f(i-1));//Absolute difference between freq. of the modal class and
+//that of its immediately preceding class
+f2 = abs(f(i)-f(i+1));//Absolute difference beween freq. of the modal class and
+//that of its immediately succeeding class
+Mode = L+((f1/(f1+f2))*C);
+disp(Mode,'Mode of the annual revenues of the firms is =')
+disp('crores')
+//Result
+//Mode of the annual revenues of the firms is =
+//
+// 6.625
+//
+// crores \ No newline at end of file
diff --git a/331/CH3/EX3.11/Example_3_11.sce b/331/CH3/EX3.11/Example_3_11.sce
new file mode 100755
index 000000000..3363c479d
--- /dev/null
+++ b/331/CH3/EX3.11/Example_3_11.sce
@@ -0,0 +1,74 @@
+//Caption:Relationship between Mean, Median and Mode
+//Example3.11
+//Page48
+clear;
+clc;
+X = [0,2;2,4;4,6;6,8;8,10;10,12;12,14;14,16;16,18];
+f = [10,15,20,30,8,5,4,3,5];
+cum_f = 0;
+for i = 1:length(f)
+ cum_f = cum_f+f(i);
+ sigmaf(i) = cum_f;
+end
+N = cum_f; //total number of salesman
+cen = N/2;
+for i = 1:length(f)
+ if ((sigmaf(i)< cen) &(cen< sigmaf(i+1))) then
+ L = X(i+1,1);
+ Fre = f(i+1);
+ F = sigmaf(i)
+ C = diff(X(i+1,:));
+ end
+end
+disp(L,'Lower limit of the median class L =')
+disp(Fre,'Frequency of the Median class f =')
+disp(F,'Cumulative frequency of the previous class F=')
+disp(C,'Width of the class interval C=')
+Median = L+(((N/2)-F)*C/Fre);
+disp(Median,'Median of the travelling allowance of the salesman is Rs =')
+disp('Crores')
+[Maxf,i]= max(f);
+f1 = abs(f(i)-f(i-1));//Absolute difference between freq. of the modal class and
+//that of its immediately preceding class
+f2 = abs(f(i)-f(i+1));//Absolute difference beween freq. of the modal class and
+//that of its immediately succeeding class
+Mode = L+((f1/(f1+f2))*C);
+disp(Mode,'Mode of the annual revenues of the firms is =')
+disp('crores')
+Mean = (3*Median-Mode)/2;
+disp(Mean,'Mean of the annual revenue of the firm is =')
+disp('crores')
+//Result
+//Lower limit of the median class L =
+//
+// 6.
+//
+// Frequency of the Median class f =
+//
+// 30.
+//
+// Cumulative frequency of the previous class F=
+//
+// 45.
+//
+// Width of the class interval C=
+//
+// 2.
+//
+// Median of the travelling allowance of the salesman is Rs =
+//
+// 6.3333333
+//
+// Crores
+//
+// Mode of the annual revenues of the firms is =
+//
+// 6.625
+//
+// crores
+//
+// Mean of the annual revenue of the firm is =
+//
+// 6.1875
+//
+// crores \ No newline at end of file
diff --git a/331/CH3/EX3.12/Example_3_12.sce b/331/CH3/EX3.12/Example_3_12.sce
new file mode 100755
index 000000000..6d639f22d
--- /dev/null
+++ b/331/CH3/EX3.12/Example_3_12.sce
@@ -0,0 +1,31 @@
+//Caption: Geometric Mean
+//Example3.12
+//Page50
+clear;
+clc;
+GrowthRate = input('Growth Rate in percentage =');
+X = 100+GrowthRate; //Demand of the product
+N = length(X)
+Geometric_Mean = 1;
+for i = 1:N
+ Geometric_Mean = Geometric_Mean*X(i);
+end
+Geometric_Mean = Geometric_Mean^(1/N);
+R = Geometric_Mean-100;
+disp('Year period is =',N,'The average growth rate of demand during')
+disp(R,'R = ')
+disp('percentage')
+//Result
+//Growth Rate in percentage = [20,30,35,40];
+//
+// The average growth rate of demand during
+//
+// 4.
+//
+// Year period is =
+//
+// R =
+//
+// 31.037802
+//
+// percentage \ No newline at end of file
diff --git a/331/CH3/EX3.13/Example_3_13.sce b/331/CH3/EX3.13/Example_3_13.sce
new file mode 100755
index 000000000..3172fd8bf
--- /dev/null
+++ b/331/CH3/EX3.13/Example_3_13.sce
@@ -0,0 +1,21 @@
+//Caption: Harmonic Mean
+//Example3.13
+//Page51
+clear;
+clc;
+X =input('Speed of exercise of patient in a week in km/Hr =');
+n = length(X);
+den = 0;
+for i = 1:n
+ den = (1/X(i))+den;
+end
+HM = n/den; //Harmonic Mean
+disp('km/Hr',HM,'Average speed of patient in one week exercise is =')
+//Result
+//Speed of exercise of patient in a week in km/Hr =[3,4,4.5,5,3.5,4.75,4.25]
+//
+// Average speed of patient in one week exercise is =
+//
+// 4.0297272
+//
+// km/Hr \ No newline at end of file
diff --git a/331/CH3/EX3.14/Example_3_14.sce b/331/CH3/EX3.14/Example_3_14.sce
new file mode 100755
index 000000000..834ce3084
--- /dev/null
+++ b/331/CH3/EX3.14/Example_3_14.sce
@@ -0,0 +1,96 @@
+//Caption: Quartile Deviation
+//Example3.14
+//Page53
+clear;
+clc;
+X = [0,10;10,20;20,30;30,40;40,50;50,60;60,70;70,80;80,90;90,100];
+f = [5,8,10,15,20,10,7,4,3,6];
+cum_f = 0;
+for i = 1:length(f)
+ cum_f = cum_f+f(i);
+ sigmaf(i) = cum_f;
+end
+N = cum_f; //total number of salesman
+cen1 = N/4;
+cen2 = 3*N/4;
+for i = 1:length(f)
+ if ((sigmaf(i)< cen1) &(cen1< sigmaf(i+1))) then
+ L1 = X(i+1,1);
+ f1 = f(i+1);
+ F1 = sigmaf(i)
+ C = diff(X(i+1,:));
+ end
+ if ((sigmaf(i)< cen2) &(cen2< sigmaf(i+1))) then
+ L3 = X(i+1,1);
+ f3 = f(i+1);
+ F3 = sigmaf(i)
+ C = diff(X(i+1,:));
+ end
+end
+disp(L1,'Lower limit of the first quartile class L1 =')
+disp(f1,'Frequency of the first quartile class f1 =')
+disp(F1,'Cumulative frequency of the previous class w.r.to the first quartile class F=')
+disp(C,'Width of the class interval C=')
+Q1 = L1+(((N/4)-F1)*C/f1);
+disp(Q1,'Fist Quartile Q1=')
+disp(L3,'Lower limit of the third quartile class L1 =')
+disp(f3,'Frequency of the third quartile class f1 =')
+disp(F3,'Cumulative frequency of the previous class w.r.to the third quartile class F=')
+disp(C,'Width of the class interval C=')
+Q3 = L3+(((3*N/4)-F3)*C/f3);
+disp(Q3,'Third Quartile Q3=')
+QD = (Q3-Q1)/2; //Quartile Deviation
+disp('in Lakhs',QD,'Quarile Deviation QD =')
+Coeff_QD = (Q3-Q1)/(Q3+Q1);
+disp(Coeff_QD,'Coefficient of Quartile Deviation =')
+//Result
+//
+// Lower limit of the first quartile class L1 =
+//
+// 20.
+//
+// Frequency of the first quartile class f1 =
+//
+// 10.
+//
+// Cumulative frequency of the previous class w.r.to the first quartile class F=
+//
+// 13.
+//
+// Width of the class interval C=
+//
+// 10.
+//
+// Fist Quartile Q1=
+//
+// 29.
+//
+// Lower limit of the third quartile class L1 =
+//
+// 50.
+//
+// Frequency of the third quartile class f1 =
+//
+// 10.
+//
+// Cumulative frequency of the previous class w.r.to the third quartile class F=
+//
+// 58.
+//
+// Width of the class interval C=
+//
+// 10.
+//
+// Third Quartile Q3=
+//
+// 58.
+//
+// Quarile Deviation QD =
+//
+// 14.5
+//
+// in Lakhs
+//
+// Coefficient of Quartile Deviation =
+//
+// 0.3333333 \ No newline at end of file
diff --git a/331/CH3/EX3.15/Example_3_15.sce b/331/CH3/EX3.15/Example_3_15.sce
new file mode 100755
index 000000000..c63921953
--- /dev/null
+++ b/331/CH3/EX3.15/Example_3_15.sce
@@ -0,0 +1,56 @@
+//Caption: Average Deviation and Coefficient of AD
+//Example3.15
+//Page54
+clear;
+clc;
+X = [50,100;100,150;150,200;200,250;250,300;300,350;350,400;400,450;450,500]//No. of Shares applied for
+f = [2500,1500,1300,1100,900,750,675,525,450]//No. of Applications
+[m,n] = size(X);
+N = sum(f);
+C = diff(X(1,:));
+mid = ceil(m/2);
+//Mean value
+A = X(mid,1)+(C/2);
+Sig_f = cumsum(f); //Cumulative frequency
+for i =1:m
+ Xi(i)= sum(X(i,:))/2; //mid point
+ d(i) = (Xi(i)-A)/C;
+ fd(i) = f(i)*d(i);
+end
+Xmean = A+((sum(fd)/N)*C);
+disp(Xmean,'The Arithmetic Mean of the Xmean=')
+//Median Value
+cen = N/2;
+for i = 1:m
+ if ((Sig_f(i)< cen) &(cen<Sig_f(i+1))) then
+ L = X(i+1,1);
+ Fre = f(i+1);
+ F = Sig_f(i)
+ C = diff(X(i+1,:));
+ end
+end
+disp(L,'Lower limit of the median class L =')
+disp(Fre,'Frequency of the Median class f =')
+disp(F,'Cumulative frequency of the previous class F=')
+disp(C,'Width of the class interval C=')
+Median = L+(((N/2)-F)*C/Fre);
+disp(Median,'Median of the No. of Shares applied for =')
+//Average Deviation
+AD = 0;
+for i = 1:m
+ AD = AD+abs(f(i)*(Xi(i)-Xmean));
+end
+AD = AD/N;
+disp(AD,'Average Deviation AD=')
+//Coefficient of Average Deviation
+Coeff_AD = AD/Xmean;
+disp(Coeff_AD,'Coefficient of Average Deviation =')
+//Result
+//The Arithmetic Mean of the Xmean= 209.40722
+//Lower limit of the median class L = 150.
+//Frequency of the Median class f = 1300.
+//Cumulative frequency of the previous class F= 4000.
+//Width of the class interval C= 50.
+//Median of the No. of Shares applied for = 182.69231
+//Average Deviation AD= 104.60995
+//Coefficient of Average Deviation = 0.4995527 \ No newline at end of file
diff --git a/331/CH3/EX3.16/Example_3_16.sce b/331/CH3/EX3.16/Example_3_16.sce
new file mode 100755
index 000000000..6becb8375
--- /dev/null
+++ b/331/CH3/EX3.16/Example_3_16.sce
@@ -0,0 +1,34 @@
+//Caption: Standard Deviation for grouped data
+//Example3.16
+//Page58
+clear;
+clc;
+X = [50,60;60,70;70,80;80,90;90,100];//Share price in rupees
+f = [20,30,45,55,50]; //No. of sessions
+[m,n] = size(X);
+cum_f = 0;
+for i = 1:m
+ Xi(i)= sum(X(i,:))/2; //Mid-point value
+ cum_f = cum_f+f(i);
+end
+mid = (length(Xi)+1)/2;
+A = Xi(mid); //assumed mean
+C = diff(X(1,:)); //width of the class interval
+N = cum_f; //total frequency
+for i = 1:m
+ d(i) = (Xi(i)-A)/C;
+ fd(i)= f(i)*d(i);
+ fd2(i) = f(i)*(d(i)^2);
+end
+Sigma = sqrt((sum(fd2)/N)-((sum(fd)/N)^2))*C; //Standard deviation
+Xmean = A+(sum(fd)*C/N); //Mean value
+disp(Sigma,'Standard Deviation Std=');
+disp(Xmean,'Mean of the Share price Xmean=');
+//Result
+//Standard Deviation Std=
+//
+// 12.823319
+//
+// Mean of the Share price Xmean=
+//
+// 79.25 \ No newline at end of file
diff --git a/331/CH3/EX3.17/Example_3_17.sce b/331/CH3/EX3.17/Example_3_17.sce
new file mode 100755
index 000000000..b6aecf340
--- /dev/null
+++ b/331/CH3/EX3.17/Example_3_17.sce
@@ -0,0 +1,47 @@
+//Caption: Coefficient of variation
+//Example3.17
+//Page59
+clear;
+clc;
+Busi_A = [80,85,70,100,115];
+Busi_B = [100,70,90,80,150];
+N = length(Busi_A);
+XA = sum(Busi_A)/N;
+XB = sum(Busi_B)/N;
+VarA = 0;
+VarB = 0;
+for i = 1:N
+ VarA = VarA+(Busi_A(i)-XA)^2;
+ VarB = VarB+(Busi_B(i)-XB)^2;
+end
+VarA = VarA/N;
+VarB = VarB/N;
+StdA = sqrt(VarA);
+StdB = sqrt(VarB);
+CovA = (StdA/XA)*100;
+CovB = (StdB/XB)*100;
+disp(CovA,'Coefficient of variation of A CVA =');
+disp(CovB,'Coefficient of variation of B CVB=');
+if (CovA<CovB) then
+ disp('Since the coefficient of variation of the Business-A is less than')
+ disp('that of the Business-B, the cash flow of business-A is more consistent')
+ disp('when compared to that of the business-B')
+else
+ disp('Since the coefficient of variation of the Business-A is greater than')
+ disp('that of the Business-B, the cash flow of business-A is not consistent')
+ disp('when compared to that of the business-B')
+end
+//Result
+//coefficient of variation of A CVA =
+//
+// 17.568209
+//
+// Coefficient of variation of B CVB=
+//
+// 28.425282
+//
+// Since the coefficient of variation of the Business-A is less than
+//
+// that of the Business-B, the cash flow of business-A is more consistent
+//
+// when compared to that of the business-B \ No newline at end of file
diff --git a/331/CH3/EX3.18/Example_3_18.sce b/331/CH3/EX3.18/Example_3_18.sce
new file mode 100755
index 000000000..2dd19aeda
--- /dev/null
+++ b/331/CH3/EX3.18/Example_3_18.sce
@@ -0,0 +1,59 @@
+//Caption: Measure of Skewness
+//Karl Pearson's coefficient of skewness
+//Example3.18
+//Page61
+clear;
+clc;
+X = [0,4;4,8;8,12;12,16;16,20;20,24;24,28;28,32]; //Absenteeism in days
+f = [10,76,100,150,24,36,14,2]; //No. of employees
+[m,n] = size(X);
+for i = 1:m
+ Xi(i) = sum(X(i,:))/2; //Mid point
+end
+if (modulo(m,2)==1) then //to check even or odd
+ mid = m/2;
+else
+ mid = (m+1)/2;
+end
+A = Xi(mid); //assumed mean
+N = sum(f); //total frequency
+C = diff(X(1,:)); //class interval
+for i = 1:m
+ d(i) = (Xi(i)-A)/C;
+ fd(i)= f(i)*d(i);
+ fd2(i) = f(i)*(d(i)^2);
+end
+Xmean = A+(sum(fd)*C/N); //Mean value
+[m1,n1] = max(f); //maximum frequency
+L = X(n1,1); //Lower limit of the modal class
+f1 = abs(f(n1)-f(n1-1)); //Abs difference between freq. of modal class & its
+//immediately preceding class
+f2 = abs(f(n1)-f(n1+1)); //Abs difference between freq. of modal class & its
+//immediately succeeding class
+Mode = L+((f1/(f1+f2))*C);//Mode
+Std = sqrt((sum(fd2)/N)-(sum(fd)/N)^2)*C;//standard deviation
+CS = (Xmean-Mode)/Std; //coefficient of skewness
+disp(Xmean,'Mean Value =')
+disp(Mode,'Mode value =')
+disp(CS,'coefficient of skewness = ')
+//Result
+if (CS<0) then
+ disp('Since the coefficient of skewness is negative, the distribution is')
+ disp('skewed to the left & extent of distortion is very small')
+end
+//Result
+//Mean Value =
+//
+// 12.679612
+//
+// Mode value =
+//
+// 13.136364
+//
+// coefficient of skewness =
+//
+// - 0.0832508
+//
+// Since the coefficient of skewness is negative, the distribution is
+//
+// skewed to the left & extent of distortion is very small \ No newline at end of file
diff --git a/331/CH3/EX3.19/Example_3_19.sce b/331/CH3/EX3.19/Example_3_19.sce
new file mode 100755
index 000000000..afcd649a3
--- /dev/null
+++ b/331/CH3/EX3.19/Example_3_19.sce
@@ -0,0 +1,117 @@
+//Cpation: Bowley's Measure of Skewness
+//Example3.19
+//Page63
+clear;
+clc;
+X = [0,4;4,8;8,12;12,16;16,20;20,24;24,28;28,32];//Machine breakdown time (hrs)
+f = [26,50,70,80,100,60,50,24]; //No. of machines
+cum_f = cumsum(f);//cumulative frequencies
+N = sum(f); //total frequency
+C = diff(X(1,:)); //class interval
+cen1 = N/4;
+cen2 = N/2;
+cen3 = 3*N/4;
+for i = 1:length(f)
+ if ((cum_f(i)< cen1) &(cen1< cum_f(i+1))) then
+ L1 = X(i+1,1);
+ f1 = f(i+1);
+ F1 = cum_f(i)
+ C = diff(X(i+1,:));
+ end
+ if ((cum_f(i)< cen2) &(cen2< cum_f(i+1))) then
+ L2 = X(i+1,1);
+ f2 = f(i+1);
+ F2 = cum_f(i)
+ end
+ if ((cum_f(i)< cen3) &(cen3< cum_f(i+1))) then
+ L3 = X(i+1,1);
+ f3 = f(i+1);
+ F3 = cum_f(i)
+ C = diff(X(i+1,:));
+ end
+end
+disp(L1,'Lower limit of the first quartile class L1 =')
+disp(f1,'Frequency of the first quartile class f1 =')
+disp(F1,'Cumulative frequency of the previous class w.r.to the first quartile class F1=')
+disp(C,'Width of the class interval C=')
+Q1 = L1+(((N/4)-F1)*C/f1);
+disp(Q1,'Fist Quartile Q1=')
+disp(L2,'Lower limit of the second quartile class L2 =')
+disp(f2,'Frequency of the second quartile class f2 =')
+disp(F2,'Cumulative frequency of the previous class w.r.to the second quartile class F2=')
+disp(C,'Width of the class interval C=')
+Q2 = L2+(((N/2)-F2)*C/f2);
+disp(Q2,'Fist Quartile Q1=')
+disp(L3,'Lower limit of the third quartile class L3 =')
+disp(f3,'Frequency of the third quartile class f3 =')
+disp(F3,'Cumulative frequency of the previous class w.r.to the third quartile class F3=')
+disp(C,'Width of the class interval C=')
+Q3 = L3+(((3*N/4)-F3)*C/f3);
+disp(Q3,'Third Quartile Q3=')
+CS = (Q3+Q1-2*Q2)/(Q3-Q1)
+disp(CS,'Bowleys coefficient of skewness CS=')
+//Result
+//
+// Lower limit of the first quartile class L1 =
+//
+// 8.
+//
+// Frequency of the first quartile class f1 =
+//
+// 70.
+//
+// Cumulative frequency of the previous class w.r.to the first quartile class F1=
+//
+// 76.
+//
+// Width of the class interval C=
+//
+// 4.
+//
+// Fist Quartile Q1=
+//
+// 10.228571
+//
+// Lower limit of the second quartile class L2 =
+//
+// 16.
+//
+// Frequency of the second quartile class f2 =
+//
+// 100.
+//
+// Cumulative frequency of the previous class w.r.to the second quartile class F2=
+//
+// 226.
+//
+// Width of the class interval C=
+//
+// 4.
+//
+// Fist Quartile Q1=
+//
+// 16.16
+//
+// Lower limit of the third quartile class L3 =
+//
+// 20.
+//
+// Frequency of the third quartile class f3 =
+//
+// 60.
+//
+// Cumulative frequency of the previous class w.r.to the third quartile class F3=
+//
+// 326.
+//
+// Width of the class interval C=
+//
+// 4.
+//
+// Third Quartile Q3=
+//
+// 21.266667
+//
+// Bowleys coefficient of skewness CS=
+//
+// - 0.0747196 \ No newline at end of file
diff --git a/331/CH3/EX3.2/Example_3_2.sce b/331/CH3/EX3.2/Example_3_2.sce
new file mode 100755
index 000000000..7fcd55834
--- /dev/null
+++ b/331/CH3/EX3.2/Example_3_2.sce
@@ -0,0 +1,84 @@
+//Caption: Arithmetic Mean of grouped Data
+//Example 3.2
+//Page 40
+clear;
+clc;
+x = input('Mothly Salary Range =');
+f = input('Number of Employees =');
+[m,n]=size(x);
+for i = 1:m
+ x_mid(i) = sum(x(i,:))/2;
+ fx(i) = f(i)*x_mid(i);
+end
+n = sum(f);//total number of employeess
+sigma_fx = sum(fx); //
+X = sigma_fx/n;
+f = f';
+disp('________________________________________________________')
+disp(x,'x=')
+disp(x_mid,'Mid-point of class interval xi = ')
+disp(f,'Frequency =')
+disp(fx,'fi x x mid value=')
+disp('________________________________________________________')
+disp(n,'Total number of employees n =')
+disp(X,'Arithmetic Mean of monthly salaries X =')
+//Result
+
+//Mothly Salary Range =[8000,12000;12000,16000;16000,20000;20000,24000;24000,28000;28000,32000;32000,36000;36000,40000]
+//Number of Employees = [400,350,325,250,200,150,75,25]
+//
+// ________________________________________________________
+//
+// x=
+//
+// 8000. 12000.
+// 12000. 16000.
+// 16000. 20000.
+// 20000. 24000.
+// 24000. 28000.
+// 28000. 32000.
+// 32000. 36000.
+// 36000. 40000.
+//
+// Mid-point of class interval xi =
+//
+// 10000.
+// 14000.
+// 18000.
+// 22000.
+// 26000.
+// 30000.
+// 34000.
+// 38000.
+//
+// Frequency =
+//
+// 400.
+// 350.
+// 325.
+// 250.
+// 200.
+// 150.
+// 75.
+// 25.
+//
+// fi x x mid value=
+//
+// 4000000.
+// 4900000.
+// 5850000.
+// 5500000.
+// 5200000.
+// 4500000.
+// 2550000.
+// 950000.
+//
+// ________________________________________________________
+//
+// Total number of employees n =
+//
+// 1775.
+//
+// Arithmetic Mean of monthly salaries X =
+//
+// 18845.07 \ No newline at end of file
diff --git a/331/CH3/EX3.3/Example_3_3.sce b/331/CH3/EX3.3/Example_3_3.sce
new file mode 100755
index 000000000..fd62f606a
--- /dev/null
+++ b/331/CH3/EX3.3/Example_3_3.sce
@@ -0,0 +1,21 @@
+//Caption: Shortcut method for Arithmetic Mean of grouped data
+//Example 3.3
+//Page 41
+clc;
+x = input('Minimum & Maximum Age of Employees=');
+f = input('Number of Employees=');
+[m,n] = size(x);
+N = sum(f);
+C = diff(x(1,:));
+A = 38; //Assumed Mean
+for i =1:m
+ X(i)= sum(x(i,:))/2;
+ d(i) = (X(i)-A)/C;
+ fd(i) = f(i)*d(i);
+end
+Xmean = A+((sum(fd)/N)*C);
+disp(Xmean,'The Arithmetic Mean of the age of the Employees Xmean=')
+//Result
+//Minimum & Maximum Age of Employees= [20,24;24,28;28,32;32,36;36,40;40,44;44,48;48,52;52,56;56,60]
+//Number of Employees=[40,35,35,25,30,40,50,45,35,30]
+//The Arithmetic Mean of the age of the Employees Xmean= 40.246575 \ No newline at end of file
diff --git a/331/CH3/EX3.4/Example_3_4.sce b/331/CH3/EX3.4/Example_3_4.sce
new file mode 100755
index 000000000..1a9499148
--- /dev/null
+++ b/331/CH3/EX3.4/Example_3_4.sce
@@ -0,0 +1,20 @@
+//Caption: Weighted Arithmetic mean of ungrouped data
+//Example3.4
+//page43
+clear;
+clc;
+X = input('Enter the demand in units =');
+w = input('Corresponding Weights=');
+n = length(X);
+num =0;
+den =0;
+for i = 1:n
+ num = num+w(i)*X(i);
+ den = den+w(i);
+end
+Xw = num/den;
+disp(Xw,'The Estimated demand for the Year 2003 is Xw=');
+//Result
+//Enter the demand in units = [400,500,450]
+//Corresponding Weights= [1,2,3]
+//The Estimated demand for the Year 2003 is Xw= 458.33333 \ No newline at end of file
diff --git a/331/CH3/EX3.5/Example_3_5.sce b/331/CH3/EX3.5/Example_3_5.sce
new file mode 100755
index 000000000..2f32c0905
--- /dev/null
+++ b/331/CH3/EX3.5/Example_3_5.sce
@@ -0,0 +1,33 @@
+//Caption: Weighted Arithmetic mean of Grouped data: Grading scheme
+//Example3.5
+//Page43
+clear;
+clc;
+//Numerical of grade
+A = 5;
+C = 3;
+D = 2;
+E = 1;
+X = [A,C,D,E,A]; //Numerical of grade
+Grade = ['A','C','D','E','A'];
+w = [2,1,3,2,1]; //Weigth assigned
+n = length(X);
+num =0;
+den =0;
+for i = 1:n
+ num = num+X(i)*w(i);
+ den = den+w(i);
+end
+Xw = num/den;
+disp(Xw,'The weighted Score in the given subject of the given student is Xw=')
+for i = 1:n
+ if (X(i) == round(Xw)) then
+ disp(Grade(i),'And the corresponding grade is =');
+ end
+end
+//Result
+//The weighted Score in the given subject of the given student is Xw=
+//
+// 2.8888889
+//
+// And the corresponding grade is = C \ No newline at end of file
diff --git a/331/CH3/EX3.6/Example_3_6.sce b/331/CH3/EX3.6/Example_3_6.sce
new file mode 100755
index 000000000..3372aeefa
--- /dev/null
+++ b/331/CH3/EX3.6/Example_3_6.sce
@@ -0,0 +1,21 @@
+//Caption: Medain of ungrouped data
+//Example3.6
+//Page45
+clear;
+clc;
+X = [100000,150000,300000,75000,175000];
+X_Ascend = gsort(X,'g','i');
+disp(X_Ascend)
+n = length(X);
+if (modulo(n,2)==1) then
+ median_X = X((n-1)/2);
+else
+ median_X = (X(n/2)+X((n+1)/2))/2;
+end
+disp(median_X,'Median Value of sales Median_X = ');
+//Result
+// 75000. 100000. 150000. 175000. 300000.
+//
+// Median Value of sales Median_X =
+//
+// 150000. \ No newline at end of file
diff --git a/331/CH3/EX3.7/Example_3_7.sce b/331/CH3/EX3.7/Example_3_7.sce
new file mode 100755
index 000000000..d9e0aac79
--- /dev/null
+++ b/331/CH3/EX3.7/Example_3_7.sce
@@ -0,0 +1,22 @@
+//Caption: Median of Ungrouped data
+//Example3.7
+//Page45
+clear;
+clc;
+X = [100000,150000,300000,175000,300000,400000];
+X_Ascend = gsort(X,'g','i');
+disp(X_Ascend)
+n = length(X);
+if (modulo(n,2)==1) then
+ median_X = X((n-1)/2);
+else
+ median_X = (X(n/2)+X((n+2)/2))/2;
+end
+disp(median_X,'Median Value of sales Median_X = ');
+//Result
+//
+// 100000. 150000. 175000. 300000. 300000. 400000.
+//
+// Median Value of sales Median_X =
+//
+// 237500. \ No newline at end of file
diff --git a/331/CH3/EX3.8/Example_3_8.sce b/331/CH3/EX3.8/Example_3_8.sce
new file mode 100755
index 000000000..c6196e5a1
--- /dev/null
+++ b/331/CH3/EX3.8/Example_3_8.sce
@@ -0,0 +1,49 @@
+//Caption: Median of grouped data
+//Example3.8
+//Page45
+clear;
+clc;
+X = [0,8;8,10;10,12;12,14;14,16;16,18;18,20;20,22;22,24];
+f = [5,10,15,20,35,40,45,20,15,11];
+cum_f = 0;
+for i = 1:length(f)
+ cum_f = cum_f+f(i);
+ sigmaf(i) = cum_f;
+end
+N = cum_f; //total number of salesman
+cen = N/2;
+for i = 1:length(f)
+ if ((sigmaf(i)< cen) &(cen< sigmaf(i+1))) then
+ L = X(i+1,1);
+ Fre = f(i+1);
+ F = sigmaf(i)
+ C = diff(X(i+1,:));
+ end
+end
+disp(L,'Lower limit of the median class L =')
+disp(Fre,'Frequency of the Median class f =')
+disp(F,'Cumulative frequency of the previous class F=')
+disp(C,'Width of the class interval C=')
+Median = L+(((N/2)-F)*C/Fre);
+disp(Median*1000,'Median of the travelling allowance of the salesman is Rs =')
+//Result
+//
+// Lower limit of the median class L =
+//
+// 16.
+//
+// Frequency of the Median class f =
+//
+// 40.
+//
+// Cumulative frequency of the previous class F=
+//
+// 85.
+//
+// Width of the class interval C=
+//
+// 2.
+//
+// Median of the travelling allowance of the salesman is Rs =
+//
+// 17150. \ No newline at end of file
diff --git a/331/CH3/EX3.9/Example_3_9.sce b/331/CH3/EX3.9/Example_3_9.sce
new file mode 100755
index 000000000..ec6abb533
--- /dev/null
+++ b/331/CH3/EX3.9/Example_3_9.sce
@@ -0,0 +1,21 @@
+//Caption: Mode of ungrouped data
+//Example3.9
+//Page47
+clear;
+clc;
+X = input('Number of Defects =');
+f = input('Number of samples =');
+[Mode,i]= max(f);
+disp(X(i),'The mode of No. of Defects =');
+disp(f(i),'because it has maximum frequency of =')
+//Result
+//Number of Defects =[5,8,9,10,12,15,17]
+//Number of samples =[1,1,2,1,3,1,1]
+//
+// The mode of No. of Defects =
+//
+// 12.
+//
+// because it has maximum frequency of =
+//
+// 3. \ No newline at end of file
diff --git a/331/CH4/EX4.1/Example_4_1.sce b/331/CH4/EX4.1/Example_4_1.sce
new file mode 100755
index 000000000..dddb9037a
--- /dev/null
+++ b/331/CH4/EX4.1/Example_4_1.sce
@@ -0,0 +1,116 @@
+//Caption: Completely Randomized Design
+//Example4.1
+//Page75
+clear;
+clc;
+A1 = 23;
+A2 = 34;
+A3 = 45;
+A4 = 34;
+B1 = 30;
+B2 = 20;
+B3 = 30;
+B4 = 20;
+C1 = 35;
+C2 = 29;
+C3 = 25;
+C4 = 45;
+D1 = 28;
+D2 = 40;
+D3 = 40;
+D4 = 34;
+Yij = [A1,B1,C1,D1;A2,B2,C2,D2;A3,B3,C3,D3;A4,B4,C4,D4];
+disp(Yij,'Yij=')
+[m,n] = size(Yij);
+Y = sum(Yij(:,:));
+disp(Y,'Y=')
+Y1 = sum(Yij(:,1));
+disp(Y1,'Y1=')
+Y2 = sum(Yij(:,2));
+disp(Y2,'Y2=')
+Y3 = sum(Yij(:,3));
+disp(Y3,'Y3=')
+Y4 = sum(Yij(:,4));
+disp(Y4,'Y4=')
+SS_total = sum(Yij(:,:).^2)-(Y^2)/(m*n);
+disp(SS_total,'SS_total=')
+SS_treatments = ((Y1^2)/m)+((Y2^2)/m)+((Y3^2)/m)+((Y4^2)/m)-(Y^2)/(m*n);
+disp(SS_treatments,'SS_treatments=')
+SS_error = SS_total-SS_treatments;
+disp(SS_error,'SS_error=')
+Bet_Treat_DOF = m-1;
+disp(Bet_Treat_DOF,'Degrees of freedom Between treatments=')
+Within_Treat_DOF = m*n-m;
+disp(Within_Treat_DOF,'Degrees of freedom With in treatments=')
+MSS = [SS_treatments/Bet_Treat_DOF,SS_error/Within_Treat_DOF];
+disp(MSS,'Mean Sum of Squares =');
+F_ratio = MSS(1)/MSS(2);
+disp(F_ratio,'Calculated F ratio =')
+Ftable = 3.49;
+disp(Ftable,'Tablw F ratio for the significance level =0.05 7 degrees of freedom (3,12)=')
+if (F_ratio<Ftable) then
+ disp('Null Hypothesis should be accepted')
+else
+ disp('Reject Null Hypothesis')
+end
+//Result
+//Yij=
+//
+// 23. 30. 35. 28.
+// 34. 20. 29. 40.
+// 45. 30. 25. 40.
+// 34. 20. 45. 34.
+//
+// Y=
+//
+// 512.
+//
+// Y1=
+//
+// 136.
+//
+// Y2=
+//
+// 100.
+//
+// Y3=
+//
+// 134.
+//
+// Y4=
+//
+// 142.
+//
+// SS_total=
+//
+// 938.
+//
+// SS_treatments=
+//
+// 270.
+//
+// SS_error=
+//
+// 668.
+//
+// Degrees of freedom Between treatments=
+//
+// 3.
+//
+// Degrees of freedom With in treatments=
+//
+// 12.
+//
+// Mean Sum of Squares =
+//
+// 90. 55.666667
+//
+// Calculated F ratio =
+//
+// 1.6167665
+//
+// Tablw F ratio for the significance level =0.05 7 degrees of freedom (3,12)=
+//
+// 3.49
+//
+// Null Hypothesis should be accepted \ No newline at end of file
diff --git a/331/CH4/EX4.2/Example_4_2.sce b/331/CH4/EX4.2/Example_4_2.sce
new file mode 100755
index 000000000..ccc9f22eb
--- /dev/null
+++ b/331/CH4/EX4.2/Example_4_2.sce
@@ -0,0 +1,102 @@
+//Caption: Completely Randomized Design
+//Example4.2
+//Page78
+clear;
+clc;
+Yij = [80,70,65,90;90,60,50,89;96,55,58,85;85,85,55,95;70,90,40,80];
+disp(Yij,'Yij=')
+[m,n] = size(Yij);
+Y = sum(Yij(:,:));
+disp(Y,'Y=')
+Y1 = sum(Yij(:,1));
+disp(Y1,'Y1=')
+Y2 = sum(Yij(:,2));
+disp(Y2,'Y2=')
+Y3 = sum(Yij(:,3));
+disp(Y3,'Y3=')
+Y4 = sum(Yij(:,4));
+disp(Y4,'Y4=')
+SS_total = sum(Yij(:,:).^2)-(Y^2)/(m*n);
+disp(SS_total,'SS_total=')
+SS_treatments = ((Y1^2)/m)+((Y2^2)/m)+((Y3^2)/m)+((Y4^2)/m)-(Y^2)/(m*n);
+disp(SS_treatments,'SS_treatments=')
+SS_error = SS_total-SS_treatments;
+disp(SS_error,'SS_error=')
+Bet_Treat_DOF = n-1;
+disp(Bet_Treat_DOF,'Degrees of freedom Between treatments=')
+Within_Treat_DOF = m*n-n;
+disp(Within_Treat_DOF,'Degrees of freedom With in treatments=')
+MSS = [SS_treatments/Bet_Treat_DOF,SS_error/Within_Treat_DOF];
+disp(MSS,'Mean Sum of Squares =');
+F_ratio = MSS(1)/MSS(2);
+disp(F_ratio,'Calculated F ratio =')
+Ftable = 3.24;
+disp(Ftable,'Tablw F ratio for the significance level =0.05 7 degrees of freedom (3,16)=')
+if (F_ratio<Ftable) then
+ disp('Null Hypothesis should be accepted')
+else
+ disp('Reject Null Hypothesis')
+end
+//Result
+//Yij=
+//
+// 80. 70. 65. 90.
+// 90. 60. 50. 89.
+// 96. 55. 58. 85.
+// 85. 85. 55. 95.
+// 70. 90. 40. 80.
+//
+// Y=
+//
+// 1488.
+//
+// Y1=
+//
+// 421.
+//
+// Y2=
+//
+// 360.
+//
+// Y3=
+//
+// 268.
+//
+// Y4=
+//
+// 439.
+//
+// SS_total=
+//
+// 5368.8
+//
+// SS_treatments=
+//
+// 3570.
+//
+// SS_error=
+//
+// 1798.8
+//
+// Degrees of freedom Between treatments=
+//
+// 3.
+//
+// Degrees of freedom With in treatments=
+//
+// 16.
+//
+// Mean Sum of Squares =
+//
+// 1190. 112.425
+//
+// Calculated F ratio =
+//
+// 10.584834
+//
+// Tablw F ratio for the significance level =0.05 7 degrees of freedom (3,16)=
+//
+// 3.24
+//
+// Reject Null Hypothesis
+ \ No newline at end of file
diff --git a/331/CH4/EX4.3/Example_4_3.sce b/331/CH4/EX4.3/Example_4_3.sce
new file mode 100755
index 000000000..fc8fe8960
--- /dev/null
+++ b/331/CH4/EX4.3/Example_4_3.sce
@@ -0,0 +1,157 @@
+//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 <Ftable) then
+ disp('Null Hypothesis should be accepted')
+ disp('There is no significant difference in terms of weekly sales made between the graduates of different business schools')
+else
+ disp('Reject Null Hypothesis')
+end
+if (F_ratio2 <Ftable) then
+ disp('Null Hypothesis should be accepted')
+ disp('There is no significant difference in terms of weekly sales made between different sections of the showroom')
+else
+ disp('Reject Null Hypothesis')
+ disp('There is significant difference in terms of weekly sales made between different sections of the showroom')
+end
+//Result
+//Yij=
+//
+// 23. 30. 25. 28.
+// 34. 20. 29. 34.
+// 45. 30. 45. 40.
+// 34. 20. 35. 40.
+//
+// Y=
+//
+// 512.
+//
+// Yi1=
+//
+// 136.
+//
+// Yi2=
+//
+// 100.
+//
+// Yi3=
+//
+// 134.
+//
+// Yi4=
+//
+// 142.
+//
+// Y1j=
+//
+// 106.
+//
+// Y2j=
+//
+// 117.
+//
+// Y3j=
+//
+// 160.
+//
+// Y4j=
+//
+// 129.
+//
+// SS_total=
+//
+// 938.
+//
+// SS_blocks=
+//
+// 407.5
+//
+// SS_treatments=
+//
+// 270.
+//
+// SS_error=
+//
+// 260.5
+//
+// Degrees of freedom Between treatments=
+//
+// 3.
+//
+// Degrees of freedom Between Blocks=
+//
+// 3.
+//
+// Degrees of freedom With in treatments=
+//
+// 9.
+//
+// Mean Sum of Squares =
+//
+// 90. 135.83333 28.944444
+//
+// Calculated F ratio1 for component treatment=
+//
+// 3.109405
+//
+// Calculated F ratio2 for component block=
+//
+// 4.6928983
+//
+// Tablw F ratio for the significance level =0.05 7 degrees of freedom (3,9)=
+//
+// 3.86
+//
+// Null Hypothesis should be accepted
+//
+// There is no significant difference in terms of weekly sales made between the graduates of different business schools
+//
+// Reject Null Hypothesis
+//
+// There is significant difference in terms of weekly sales made between different sections of the showroom
+// \ No newline at end of file
diff --git a/331/CH4/EX4.4/Example_4_4.sce b/331/CH4/EX4.4/Example_4_4.sce
new file mode 100755
index 000000000..9022c3736
--- /dev/null
+++ b/331/CH4/EX4.4/Example_4_4.sce
@@ -0,0 +1,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
+// \ No newline at end of file
diff --git a/331/CH4/EX4.5/Example_4_5.sce b/331/CH4/EX4.5/Example_4_5.sce
new file mode 100755
index 000000000..7243137ac
--- /dev/null
+++ b/331/CH4/EX4.5/Example_4_5.sce
@@ -0,0 +1,233 @@
+//Caption: Latin Square Design
+//Example4.5
+//Page89
+clear;
+clc;
+A1 =23;
+A2 =34;
+A3 = 45;
+A4 = 34;
+B1 = 30;
+B2 = 20;
+B3 = 30;
+B4 = 20;
+C1 = 35;
+C2 = 29;
+C3 = 25;
+C4 = 45;
+D1 = 28;
+D2 = 40;
+D3 = 40;
+D4 = 34;
+Yij = [23,40,30,35;20,45,34,40;25,45,34,20;28,30,29,34];
+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_section = ((Y1j^2)/n)+((Y2j^2)/n)+((Y3j^2)/n)+((Y4j^2)/n)-(Y^2)/(m*n);
+disp(SS_section,'SS_section=')
+SS_period = ((Yi1^2)/m)+((Yi2^2)/m)+((Yi3^2)/m)+((Yi4^2)/m)-(Y^2)/(m*n);
+disp(SS_period,'SS_period=')
+Yij = [A1,A2,A3,A4;B1,B2,B3,B4;C1,C2,C3,C4;D1,D2,D3,D4];
+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_treatments = ((Y1j^2)/n)+((Y2j^2)/n)+((Y3j^2)/n)+((Y4j^2)/n)-(Y^2)/(m*n);
+disp(SS_treatments,'SS_treatments=')
+SS_error = SS_total-SS_section-SS_treatments-SS_period;
+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=')
+Error = 6;
+disp(Error,'Degrees of freedom With in treatments=')
+MSS = [SS_treatments/3,SS_section/3,SS_period/3,SS_error/Error];
+disp(MSS,'Mean Sum of Squares =');
+F_ratio1 = MSS(1)/MSS(4);
+F_ratio2 = MSS(2)/MSS(4);
+F_ratio3 = MSS(3)/MSS(4);
+disp(F_ratio1,'Calculated F ratio1 for component treatment- business school=')
+disp(F_ratio2,'Calculated F ratio2 for component rows-section=')
+disp(F_ratio3,'Calculated F ratio3 for component columns-period=')
+Ftable = 4.76;
+disp(Ftable,'Tablw F ratio for the significance level =0.05 and degrees of freedom (3,6)=')
+disp('Component-treatment (business school):')
+if (F_ratio1 >Ftable) then
+ disp('Null Hypothesis should be rejected')
+ disp('This means that there is significant difference in terms of weekly sales made between the graduates of')
+ disp('different business schools')
+else
+ disp('Accept Null Hypothesis')
+end
+disp('Component-rows(section):')
+if (F_ratio2 <Ftable) then
+ disp('Null Hypothesis should be accepted')
+ disp('This means that there is no significant difference in terms of weekly sales made between different sections')
+ disp('of the showroom')
+else
+ disp('Reject Null Hypothesis')
+end
+disp('Component-columns (period):')
+if (F_ratio3 <Ftable) then
+ disp('Null Hypothesis should be rejected')
+ disp('This means there is significant difference in terms of weekly sales made between different weeks(period)')
+ disp('of the showroom')
+else
+ disp('Accept Null Hypothesis')
+end
+//Result
+//Yij=
+//
+// 23. 40. 30. 35.
+// 20. 45. 34. 40.
+// 25. 45. 34. 20.
+// 28. 30. 29. 34.
+//
+// Y=
+//
+// 512.
+//
+// Yi1=
+//
+// 96.
+//
+// Yi2=
+//
+// 160.
+//
+// Yi3=
+//
+// 127.
+//
+// Yi4=
+//
+// 129.
+//
+// Y1j=
+//
+// 128.
+//
+// Y2j=
+//
+// 139.
+//
+// Y3j=
+//
+// 124.
+//
+// Y4j=
+//
+// 121.
+//
+// SS_total=
+//
+// 938.
+//
+// SS_section=
+//
+// 46.5
+//
+// SS_period=
+//
+// 512.5
+//
+// Y1j=
+//
+// 136.
+//
+// Y2j=
+//
+// 100.
+//
+// Y3j=
+//
+// 134.
+//
+// Y4j=
+//
+// 142.
+//
+// SS_treatments=
+//
+// 270.
+//
+// SS_error=
+//
+// 109.
+//
+// Degrees of freedom Between treatments=
+//
+// 3.
+//
+// Degrees of freedom Between Blocks=
+//
+// 3.
+//
+// Degrees of freedom With in treatments=
+//
+// 6.
+//
+// Mean Sum of Squares =
+//
+// 90. 15.5 170.83333 18.166667
+//
+// Calculated F ratio1 for component treatment- business school=
+//
+// 4.9541284
+//
+// Calculated F ratio2 for component rows-section=
+//
+// 0.8532110
+//
+// Calculated F ratio3 for component columns-period=
+//
+// 9.4036697
+//
+// Tablw F ratio for the significance level =0.05 and degrees of freedom (3,6)=
+//
+// 4.76
+//
+// Component-treatment (business school):
+//
+// Null Hypothesis should be rejected
+//
+// This means that there is significant difference in terms of weekly sales made between the graduates of
+//
+// different business schools
+//
+// Component-rows(section):
+//
+// Null Hypothesis should be accepted
+//
+// This means that there is no significant difference in terms of weekly sales made between different sections
+//
+// of the showroom
+//
+// Component-columns (period):
+//
+// Accept Null Hypothesis
+// \ No newline at end of file
diff --git a/331/CH6/EX6.1/Example_6_1.sce b/331/CH6/EX6.1/Example_6_1.sce
new file mode 100755
index 000000000..69ff814d0
--- /dev/null
+++ b/331/CH6/EX6.1/Example_6_1.sce
@@ -0,0 +1,26 @@
+//Caption:Probability of occurrence of 'A' given that 'B' has occurred
+//P(A/B)
+//Example6.1
+//Page 171
+clear;
+clc;
+//A be the event that an employee's monthly salary is more than Rs.15,000
+//B be the event that the employee is a regular taker of Alpha Brand Tea
+n = 200; //total number of employee's
+A_intersec_B = 20; //Alpha Brand tesa takers both in A and B
+P_AinterB = A_intersec_B/n;//Probability that Alpha brand tea takers both in A&B
+B = 120; //Number of Alpha Brand tea takers
+P_B = B/n; // Probility of number of Alpha brand tea takers
+P_AB = P_AinterB/P_B;
+disp(P_AinterB,'Probability that Alpha brand tea takers both in A&B P(A intersection B)=')
+disp(P_B,'Probility of number of Alpha brand tea takers P(B)=')
+disp('The probability that employee is having monthly salary more than')
+disp(P_AB,'Rs.15,000, if the employee is a regular taker of Alpha brand Tea P(A/B)=')
+//Result
+//Probability that Alpha brand tea takers both in A&B P(A intersection B)=
+// 0.1
+//Probility of number of Alpha brand tea takers P(B)=
+// 0.6
+//The probability that employee is having monthly salary more than
+//Rs.15,000, if the employee is a regular taker of Alpha brand Tea P(A/B)=
+// 0.1666667 \ No newline at end of file
diff --git a/331/CH6/EX6.2/Example_6_2.sce b/331/CH6/EX6.2/Example_6_2.sce
new file mode 100755
index 000000000..7bf68a7bf
--- /dev/null
+++ b/331/CH6/EX6.2/Example_6_2.sce
@@ -0,0 +1,32 @@
+//Caption: Cumulative distribution of the binomial distribution
+//F(X,n,p)
+//Example6.2
+//Page 176
+clear;
+clc;
+//(a). Probability of 0 head
+X1 = 0;// 0 head
+n = 10; //number of trials
+Pr = 0.5; //Probability of success in each binomial trial
+Ompr = 1-Pr; //Probability of failure in each binomial trial
+[P1,Q1]=cdfbin("PQ",X1,n,Pr,Ompr);
+disp(P1,'Probability of zero head P(X=0,10,0.5)=')
+//(b). Probability of 3 head
+X2 =3;// 3 head
+P2 = (factorial(n)/(factorial(X2)*factorial(n-X2)))*(Pr^X2)*(Ompr^(n-X2));
+disp(P2,'Probability of three heads P(X=3,10,0.5)=')
+//(c). at most 2 heads
+X3 = 2;
+[P3,Q3]=cdfbin("PQ",X3,n,Pr,Ompr);
+disp(P3,'Probability of atmost 2 heads P(X<=2,10,0.5)=')
+//(d). at least 3 heads
+disp(1-P3,'Probability of atleat 3 heads P(X>=3,10,0.5)=')
+//Result
+//Probability of zero head P(X=0,10,0.5)=
+// 0.0009766
+//Probability of three heads P(X=3,10,0.5)=
+// 0.1171875
+//Probability of atmost 2 heads P(X<=2,10,0.5)=
+// 0.0546875
+//Probability of atleat 3 heads P(X>=3,10,0.5)=
+// 0.9453125 \ No newline at end of file
diff --git a/331/CH6/EX6.3/Example_6_3.sce b/331/CH6/EX6.3/Example_6_3.sce
new file mode 100755
index 000000000..484271d17
--- /dev/null
+++ b/331/CH6/EX6.3/Example_6_3.sce
@@ -0,0 +1,32 @@
+//Caption: Cumulative distribution of the binomial distribution
+//F(X,n,p)
+//Example6.3
+//Page176
+clear;
+clc;
+//(a). Probability of nil project in time
+X1 = 0;// nil project
+n = 5; //number of trials
+Pr = 0.9; //Probability of success in each binomial trial
+Ompr = 1-Pr; //Probability of failure in each binomial trial
+[P1,Q1]=cdfbin("PQ",X1,n,Pr,Ompr);
+disp(P1,'Probability of zero head P(X=0,10,0.5)=')
+//(b). two projects in time
+X2 = 2;// two projects
+P2 = (factorial(n)/(factorial(X2)*factorial(n-X2)))*(Pr^X2)*(Ompr^(n-X2));
+disp(P2,'Probability of three heads P(X=2,10,0.5)=')
+//(c). at most one project in time
+X3 = 1;
+[P3,Q3]=cdfbin("PQ",X3,n,Pr,Ompr);
+disp(P3,'Probability of atmost 2 heads P(X<=1,10,0.5)=')
+//(d). at least two projects in time
+disp(1-P3,'Probability of atleat 3 heads P(X>=2,10,0.5)=')
+//Result
+//Probability of zero head P(X=0,10,0.5)=
+// 0.00001
+//Probability of three heads P(X=2,10,0.5)=
+// 0.0081
+//Probability of atmost 2 heads P(X<=1,10,0.5)=
+// 0.00046
+//Probability of atleat 3 heads P(X>=2,10,0.5)=
+// 0.99954 \ No newline at end of file
diff --git a/331/CH6/EX6.4/Example_6_4.sce b/331/CH6/EX6.4/Example_6_4.sce
new file mode 100755
index 000000000..590ea07a7
--- /dev/null
+++ b/331/CH6/EX6.4/Example_6_4.sce
@@ -0,0 +1,37 @@
+//Caption: Poisson distribution
+//Example6.4
+//Page179
+clear;
+clc;
+//(a): Exactly 0 customer will arrive in 10 minutes interval
+X1= 0; //no. of customer
+Mean = 4;//mean arrival rate of 4 per 10 minutes
+[P1,Q1]=cdfpoi("PQ",X1,Mean)
+disp(P1,'Exactly 0 customer will arrive P(X=0,4) is =')
+//(b): Exactly 2 customers will arrive in 10 minutes interval
+X2 =2; //no. of customer
+P2 = exp(-Mean)*(Mean^X2)/(factorial(2))
+disp(P2,'Exactly 2 customer will arrive P(X=2,4) is =')
+//(c): at most 2 customers will arrive in 10 minutes interval
+[P3,Q3]=cdfpoi("PQ",X2,Mean)
+disp(P3,'Atmost 2 customer will arrive P(X<=2,4) is =')
+//(d): at least 3 customers will arrive in 10 minutes interval
+X3 =3;
+P4 = 1-P3
+disp(P4,'At least 3 customer will arrive P(X>=3,4) is=')
+//Result
+//Exactly 0 customer will arrive P(X=0,4) is =
+//
+// 0.0183156
+//
+// Exactly 2 customer will arrive P(X=2,4) is =
+//
+// 0.1465251
+//
+// Atmost 2 customer will arrive P(X<=2,4) is =
+//
+// 0.2381033
+//
+// At least 3 customer will arrive P(X>=3,4) is=
+//
+// 0.7618967 \ No newline at end of file
diff --git a/331/CH6/EX6.5/Example_6_5.sce b/331/CH6/EX6.5/Example_6_5.sce
new file mode 100755
index 000000000..03644c512
--- /dev/null
+++ b/331/CH6/EX6.5/Example_6_5.sce
@@ -0,0 +1,43 @@
+//Caption: Poisson Distribution
+//Example6.5
+//Page179
+clear;
+clc;
+//(a): Probability no piece in the sample is defective
+X1= 0; //nil defective
+p= 0.04;//probability that an inspected piece will be defective
+n = 25; //number of sample units
+Mean = n*p;//mean of the poisson distribution
+[P1,Q1]=cdfpoi("PQ",X1,Mean)
+disp(P1,'No piece will be defective P(X=0,1) is =')
+
+//(b): Probability 3 pieces in the sample will be defective
+X2 = 3; //3 pieces in the sample will be defective
+P2 = exp(-Mean)*(Mean^X2)/(factorial(X2))
+disp(P2,'Probability 3 pieces will be defective P(X=3,1) is =')
+
+//(c): at most 2 pieces will be defective
+X3 = 2;
+[P3,Q3]=cdfpoi("PQ",X3,Mean)
+disp(P3,'Atmost 2 pieces will be defective P(X<=2,1) is =')
+
+//(d): at least 3 pieces will be defective
+P4 = 1-P3
+disp(P4,'At least 3 pieces will be defective P(X>=3,1) is=')
+//Result
+//
+// No piece will be defective P(X=0,1) is =
+//
+// 0.3678794
+//
+// Probability 3 pieces will be defective P(X=3,1) is =
+//
+// 0.0613132
+//
+// Atmost 2 pieces will be defective P(X<=2,1) is =
+//
+// 0.9196986
+//
+// At least 3 pieces will be defective P(X>=3,1) is=
+//
+// 0.0803014
diff --git a/331/CH6/EX6.6/Example_6_6.sce b/331/CH6/EX6.6/Example_6_6.sce
new file mode 100755
index 000000000..59f5cdf8c
--- /dev/null
+++ b/331/CH6/EX6.6/Example_6_6.sce
@@ -0,0 +1,15 @@
+//Caption: Uniform Distribution
+//Example6.6
+//Page181
+clear;
+clc;
+a = 230; // lower limit
+b = 450; //upper limit
+P = (1/(b-a)); //uniform distribution of daily demand for packed meals
+Demand = 0.8; //service level of satisfying the demand of the canteen
+Q = (1/P)*Demand+a;
+disp(Q,'The demand of the product which can be satisfied w.r.to the given service level is=')
+//Result
+//The demand of the product which can be satisfied w.r.to the given service level is=
+//
+// 406. \ No newline at end of file
diff --git a/331/CH6/EX6.7/Example_6_7.sce b/331/CH6/EX6.7/Example_6_7.sce
new file mode 100755
index 000000000..40c491fed
--- /dev/null
+++ b/331/CH6/EX6.7/Example_6_7.sce
@@ -0,0 +1,19 @@
+//Caption: Exponential Distribution
+//Example6.7
+//Page183
+clear;
+clc;
+//Example6.7(a): The probability that the service time of the terminal Less than 0.5 hr
+Mean = 30; //Service rate of the terminal per day
+Mean = Mean/24; //Service rate of the terminal per hour
+X1 = 0.5;
+F = 1-exp(-Mean*X1);
+disp(F,'The cumulative probability distribution P(X<=0.5) is =');
+//Example6.7(b): The probability that the service time of the terminal greate than 0.75 hr
+X2 = 0.75;
+F = 1-exp(-Mean*X2);
+disp(1-F,'The cumulative probility distribution P(X>=0.75) is =' );
+//Result
+//The cumulative probability distribution P(X<=0.5) is = 0.4647386
+//
+//The cumulative probility distribution P(X>=0.75) is = 0.3916056 \ No newline at end of file
diff --git a/331/CH6/EX6.8/Example_6_8.sce b/331/CH6/EX6.8/Example_6_8.sce
new file mode 100755
index 000000000..7af820d90
--- /dev/null
+++ b/331/CH6/EX6.8/Example_6_8.sce
@@ -0,0 +1,19 @@
+//Caption: Exponential Distribution
+//Example6.8
+//Page183
+clear;
+clc;
+//Example6.8(a): The probability that the execution time of programs < 4 minutes
+T = 5; //Average execution time of the programs
+X1 = 4;
+F = 1-exp(-X1/T);
+disp(F,'The probability that the execution time of programs < 4 minutes P(X<=4) is =');
+//Example6.8(b): The probability that the execution time of programs > 6 minutes
+X2 =6;
+F = 1-exp(-X2/T);
+disp(1-F,'The probability that the execution time of programs > 6 minutes P(X>=6) is =');
+//Result
+//The probability that the execution time of programs < 4 minutes P(X<=4) is =
+// 0.5506710
+//The probability that the execution time of programs > 6 minutes P(X>=6) is =
+// 0.3011942 \ No newline at end of file
diff --git a/331/CH6/EX6.9/Example_6_9.sce b/331/CH6/EX6.9/Example_6_9.sce
new file mode 100755
index 000000000..0c708db7a
--- /dev/null
+++ b/331/CH6/EX6.9/Example_6_9.sce
@@ -0,0 +1,52 @@
+//Caption: Normal Distribution
+//Example6.9
+//Page185
+clear;
+clc;
+//Example6.9(a):Probability that the monthly income < Rs.11,000
+X = 11000;
+Mean = 10000;
+Std = 2000;
+n = 200; //sample number of respondents
+[P,Q]=cdfnor("PQ",X,Mean,Std)//Cumulative normal distribution
+disp(P,'The probability that the monthly income is < Rs.11,000 is =')
+disp(n*P,'The number of respondents having income is less than Rs.11,000 =')
+
+//Example6.9(b): Probability that the monthly income > Rs.12,000
+X = 12000;
+[P,Q]=cdfnor("PQ",X,Mean,Std)//Cumulative normal distribution
+disp(Q,'The probability that the monthly income is > Rs12,000 is =')
+disp(n*Q,'The number of respondents having income is greater than Rs.12,000 =')
+
+//Example6.9(c): Probability that the monthly income is in between Rs.7,000 and
+//Rs.11,200
+X1 = 11200;
+X2 = 7000;
+[P1,Q1]=cdfnor("PQ",X1,Mean,Std);
+[P2,Q2]=cdfnor("PQ",X2,Mean,Std);
+disp(P1-P2,'The probability that the monthly income in between Rs.7,000 & Rs.11,200 is =');
+disp(n*(P1-P2),'The number of respondents having income in between Rs.7,000 & Rs.11,200 is =')
+//Result
+//The probability that the monthly income is < Rs.11,000 is =
+//
+// 0.6914625
+//
+// The number of respondents having income is less than Rs.11,000 =
+//
+// 138.29249
+//
+// The probability that the monthly income is > Rs12,000 is =
+//
+// 0.1586553
+//
+// The number of respondents having income is greater than Rs.12,000 =
+//
+// 31.731051
+//
+// The probability that the monthly income in between Rs.7,000 & Rs.11,200 is =
+//
+// 0.6589397
+//
+// The number of respondents having income in between Rs.7,000 & Rs.11,200 is =
+//
+// 131.78794 \ No newline at end of file
diff --git a/331/CH7/EX7.1/Example_7_1.sce b/331/CH7/EX7.1/Example_7_1.sce
new file mode 100755
index 000000000..059338c4e
--- /dev/null
+++ b/331/CH7/EX7.1/Example_7_1.sce
@@ -0,0 +1,23 @@
+//Caption: Proportional Stratified Sampling
+//Example7.1
+//Page 197
+clear;
+clc;
+N = 200; //Total number of engineering colleges in the university
+N1 = 20; //Number of government engineering colleges
+N2 = 50; //Number of aided engineering colleges
+N3 = 130;//Number of self-financing engineering colleges
+n = 20; //Total sample size
+n1 = (n/N)*N1;
+disp(n1,'The number of colleges to be sampled from government category n1=');
+n2 = (n/N)*N2;
+disp(n2,'The number of colleges to be sampled from aided category n2=');
+n3 = (n/N)*N3;
+disp(n3,'The number of colleges to be sampled from self-financing category n3=');
+//Result
+//The number of colleges to be sampled from government category n1=
+// 2.
+//The number of colleges to be sampled from aided category n2=
+// 5.
+//The number of colleges to be sampled from self-financing category n3=
+// 13. \ No newline at end of file
diff --git a/331/CH7/EX7.10/Example_7_10.sce b/331/CH7/EX7.10/Example_7_10.sce
new file mode 100755
index 000000000..e44eb679a
--- /dev/null
+++ b/331/CH7/EX7.10/Example_7_10.sce
@@ -0,0 +1,25 @@
+//Caption:Sampling Distribution of Proportion
+//Example7.10
+//Page213
+clear;
+clc;
+p = 0.52;//52% of the employees will have enhanced skill
+q = 1-p;
+n = 49;// sample number of employees
+X = 24/49; //out of 49 only 24 of them are having enhanced skill
+disp(X,'Sample Mean=')
+Var = p*q/n; //variance
+disp(Var,'Variance is var(X/n)=')
+Std = sqrt(Var); //standard deviation
+disp(Std,'Standard Deviation =')
+[P,Q]=cdfnor("PQ",X,p,Std);
+disp(Q,'The probability that tha sample of employees have enhanced their skill is = ')
+//Result
+//Sample Mean=
+// 0.4897959
+//Variance is var(X/n)=
+// 0.0050939
+//Standard Deviation =
+// 0.0713714
+//The probability that tha sample of employees have enhanced their skill is =
+// 0.6639238 \ No newline at end of file
diff --git a/331/CH7/EX7.11/Example_7_11.sce b/331/CH7/EX7.11/Example_7_11.sce
new file mode 100755
index 000000000..8f5c57dbe
--- /dev/null
+++ b/331/CH7/EX7.11/Example_7_11.sce
@@ -0,0 +1,18 @@
+//Caption: Confidence Interval Estimation (when Sample Size is Large)
+//Example7.11
+//Page215
+clc;
+Var = 81; //variance of diameter of shafts produced
+Std = sqrt(Var); //standard deviation
+X = 30;//mean diameter
+n = 36;//number of random samples
+Alpha = 0.05; //significance level
+Alpha = Alpha/2;
+StdError = Std/sqrt(n);//standard error
+Zstat = standard_normal_zstat(Alpha);//standard normal z statistic
+CI = [X-Zstat*StdError,X+Zstat*StdError];
+disp(CI,'Confidence level range in mm =')
+//Result
+//Confidence level range in mm =
+//
+// 27.06 32.94 \ No newline at end of file
diff --git a/331/CH7/EX7.12/Example_7_12.sce b/331/CH7/EX7.12/Example_7_12.sce
new file mode 100755
index 000000000..1884c257b
--- /dev/null
+++ b/331/CH7/EX7.12/Example_7_12.sce
@@ -0,0 +1,19 @@
+//Caption: Confidence Interval Estimation (when Sample Size is Small)
+//Example7.12
+//Page216
+clear;
+clc;
+X = 20;// mean diameter of the shafts in mm
+Var = 9;// variance of the safts in mm
+Std = sqrt(Var);//standard deviation
+n = 16;// number of samples
+alpha = 0.05;//confidence level
+alpha = alpha/2;
+talpha = 2.1311;//students t dstribution
+StdErr = Std/sqrt(n);
+CI = [X-talpha*StdErr,X+talpha*StdErr]
+disp(CI,'The Confidenc Interval u =')
+//Result
+//The Confidenc Interval u =
+//
+// 18.401675 21.598325 \ No newline at end of file
diff --git a/331/CH7/EX7.13/Example_7_13.sce b/331/CH7/EX7.13/Example_7_13.sce
new file mode 100755
index 000000000..6b26e36d3
--- /dev/null
+++ b/331/CH7/EX7.13/Example_7_13.sce
@@ -0,0 +1,21 @@
+//Caption: Confidence Interval for Proportion
+//Example7.13
+//Page217
+
+clc;
+p = 0.40;// 40% of retailers enhance weekly sales
+q = 1-p;
+n = 64;// number of samples
+//pbar: proportion of success
+pbar = 32/n;//32 out of 64 are having enhanced sales after displaying advertisement
+Var = (p*q)/n; //variance
+Std = sqrt(Var);
+alpha = 0.1;
+alpha = alpha/2;
+z = standard_normal_zstat(alpha);
+CI = [pbar-z*Std,pbar+z*Std];
+disp(CI,'Confidence Interval of Proportion CI=')
+//Result
+//Confidence Interval of Proportion CI=
+//
+// 0.3995709 0.6004291 \ No newline at end of file
diff --git a/331/CH7/EX7.14/Example_7_14.sce b/331/CH7/EX7.14/Example_7_14.sce
new file mode 100755
index 000000000..3e7f9f3ca
--- /dev/null
+++ b/331/CH7/EX7.14/Example_7_14.sce
@@ -0,0 +1,17 @@
+//Caption: Sample Size for Determining Sample Mean
+//Example7.14
+//Page219
+
+clc;
+Var = 64;// variance of axial length of pistons in mm
+Std = sqrt(Var);
+D = 2;// deviation from mean length in mm
+alpha = 0.05;//significance level
+alpha = alpha/2;
+z = standard_normal_zstat(alpha)
+n = (z*Std/D)^2;
+disp(ceil(n),'Sample Size n =')
+//Result
+//Sample Size n =
+//
+// 62. \ No newline at end of file
diff --git a/331/CH7/EX7.15/Example_7_15.sce b/331/CH7/EX7.15/Example_7_15.sce
new file mode 100755
index 000000000..1a802c4bf
--- /dev/null
+++ b/331/CH7/EX7.15/Example_7_15.sce
@@ -0,0 +1,17 @@
+//Caption: Sample Size for Determining Sample Proportion
+//Example7.15
+//Page220
+clc;
+p =0.35;//35% of branches have enhanced yearly collection of deposits
+q = 1-p;
+D = 0.06;// deviation of mean sample size
+Conf_Level = 0.90; //confidence level = 90%
+alpha = 0.1; //Significance level
+alpha = alpha/2;
+z = standard_normal_zstat(alpha)
+n = ((z^2)*p*q)/(D^2);
+disp(ceil(n),'Sample Size n =')
+//Result
+//Sample Size n =
+//
+// 170 \ No newline at end of file
diff --git a/331/CH7/EX7.2/Example_7_2.sce b/331/CH7/EX7.2/Example_7_2.sce
new file mode 100755
index 000000000..7ad37b812
--- /dev/null
+++ b/331/CH7/EX7.2/Example_7_2.sce
@@ -0,0 +1,35 @@
+//Caption:Dispropotional Stratified Sampling
+//Example7.2
+//Page198
+clear;
+clc;
+N = 1200; //Size of the population
+N1 = 500; //Size of the stratum 1
+N2 = 400; //Size of the stratum 2
+N3 = 300; //Size of the stratum 3
+Sig1 = 49;//variance of the stratum 1
+Sig2 = 16;//variance of the stratum 2
+Sig3 = 4;//variance of the stratum 3
+Std1 = sqrt(Sig1);
+Std2 = sqrt(Sig2);
+Std3 = sqrt(Sig3);
+n = 90; //Sample size
+//Stratum 1=> Locations of schools in rural areas
+//Stratum 2=> Locations of schools in semi-urban areas
+//Stratum 3=> Locaions of schools in urban areas
+q1 = N1/N; //ratio of the stratum 1 with that of the population
+q2 = N2/N; //ratio of the stratum 2 with that of the population
+q3 = N3/N; //ratio of the stratum 3 with that of the population
+n1 = (q1*Std1*n)/(q1*Std1+q2*Std2+q3*Std3);//no.of sampling units of stratum 1
+n2 = (q2*Std2*n)/(q1*Std1+q2*Std2+q3*Std3);//no.of sampling units of stratum 2
+n3 = (q3*Std3*n)/(q1*Std1+q2*Std2+q3*Std3);//no.of sampling units of stratum 3
+disp(floor(n1),' Number of sampling units of stratum 1, n1 =')
+disp(floor(n2),' Number of sampling units of stratum 1, n2 =')
+disp(ceil(n3),' Number of sampling units of stratum 1, n3 =')
+//Result
+//Number of sampling units of stratum 1, n1 =
+// 55.
+//Number of sampling units of stratum 1, n2 =
+// 25.
+//Number of sampling units of stratum 1, n3 =
+// 10. \ No newline at end of file
diff --git a/331/CH7/EX7.3/Example_7_3.sce b/331/CH7/EX7.3/Example_7_3.sce
new file mode 100755
index 000000000..a8a17c2f8
--- /dev/null
+++ b/331/CH7/EX7.3/Example_7_3.sce
@@ -0,0 +1,16 @@
+//Caption:Sampling Distribution of mean (When the population is infinite)
+//When the population variance is known
+//Example7.3
+//Page202
+clear;
+clc;
+n = 49;//Sample size
+u = 4;//population mean in rupees Lakhs
+Sig = 1;// populaion variance in rupees Lakh
+Std = sqrt(Sig);
+X = 4.25;//Sample Mean
+[P,Q]=cdfnor("PQ",X,u,Std/sqrt(n))
+disp(Q,'The Probaility that the sample mean greater than 4.25 lakhs is P(X>=4.25)=')
+//Result
+//The Probaility that the sample mean greater than 4.25 lakhs is P(X>=4.25)=
+// 0.0400592 \ No newline at end of file
diff --git a/331/CH7/EX7.4/Example_7_4.sce b/331/CH7/EX7.4/Example_7_4.sce
new file mode 100755
index 000000000..0dfc971f1
--- /dev/null
+++ b/331/CH7/EX7.4/Example_7_4.sce
@@ -0,0 +1,36 @@
+//Caption: Sampling Distribution of Mean (when the population is Finite)
+//Example7.4
+//Page204
+clear;
+clc;
+n = 36;//Sample Size
+N = 1000;//Population Size
+u = 40;// Population Mean
+Sig = 121;//Population variance in years
+Std = sqrt(Sig);//Population standard deviation in years
+S = (Std/sqrt(n))*sqrt((N-n)/(N-1));//Standard deviation when the population is finite
+//(a). Sample Mean lesser than 45
+X1 = 45;
+[P1,Q1]=cdfnor("PQ",X1,u,S);
+disp(P1,'The probability that the sample mean is lesser than 45 is P(X<=45)=')
+//(b). Sample Mean greater than 42
+X2= 42;
+[P2,Q2]=cdfnor("PQ",X2,u,Std/sqrt(n))
+disp(Q2,'The probability that the sample mean is greater than 42 is P(X>=42)=')
+//(c). Sample mean is inbetween 40 and 42
+X3 = 40;
+[P3,Q3]=cdfnor("PQ",X3,u,Std/sqrt(n))
+P4 = P2-P3;
+disp(P4,'The probability that the sample mean is in between 40 and 42 is P(40<=X<=42)=')
+//Result
+//The probability that the sample mean is lesser than 45 is P(X<=45)=
+//
+// 0.9972513
+//
+// The probability that the sample mean is greater than 42 is P(X>=42)=
+//
+// 0.1376564
+//
+// The probability that the sample mean is in between 40 and 42 is P(40<=X<=42)=
+//
+// 0.3623436 \ No newline at end of file
diff --git a/331/CH7/EX7.5/Example_7_5.sce b/331/CH7/EX7.5/Example_7_5.sce
new file mode 100755
index 000000000..0166c2d2a
--- /dev/null
+++ b/331/CH7/EX7.5/Example_7_5.sce
@@ -0,0 +1,31 @@
+//Caption: Centrel Limit Theorem
+//Example7.5
+//Page205
+clear;
+clc;
+n = 36; //Sample Size
+u = 100; //Population Mean
+Sig = 121;//Population variance
+Std = sqrt(Sig);//Population standard deviation
+S = Std/sqrt(n);
+//(a). Probability that the sample mean greater than 105 trips
+X1 = 105;
+[P1,Q1]=cdfnor("PQ",X1,u,S);
+disp(Q1,'The Probability that the Sample Mean will be more than 105 is P(X>=105)=')
+//(b). Probability that the sample mean less than 102 trips
+X2 = 102;
+[P2,Q2]=cdfnor("PQ",X2,u,S);
+disp(P2,'The Probability that the Sample Mean will be less than 102 is P(X<=102)=')
+//(c). Probability that the sample mean in between 101 trips and 103 trips
+X3 = 101;
+X4 = 103;
+[P3,Q3]=cdfnor("PQ",X3,u,S);
+[P4,Q4]=cdfnor("PQ",X4,u,S);
+disp(P4-P3,'The Probability that the Sample Mean in between 101 trips and 103 trips is P(101<=X<=103)=')
+//Result
+//The Probability that the Sample Mean will be more than 105 is P(X>=105)=
+// 0.0031930
+//The Probability that the Sample Mean will be less than 102 is P(X<=102)=
+// 0.8623436
+//The Probability that the Sample Mean in between 101 trips and 103 trips is P(101<=X<=103)=
+// 0.2418387 \ No newline at end of file
diff --git a/331/CH7/EX7.6/Example_7_6.sce b/331/CH7/EX7.6/Example_7_6.sce
new file mode 100755
index 000000000..e2c81e788
--- /dev/null
+++ b/331/CH7/EX7.6/Example_7_6.sce
@@ -0,0 +1,19 @@
+//Caption: Sampling Distribution of Mean when Population Variance is Unknown
+//(Student's t-distribution)
+//Example7.6
+//Page208
+n = 10;//Sample Mean
+u = 94;//Mean annual sales of the population in lakhs
+Sig = 81; //Variance of mean annual sales of the sample in lakhs
+S = sqrt(Sig);//Standard deviation of the mean annual sales of the sample
+Df = n-1;//degrees of freedom
+X = 98;//mean annual sales of the sample
+t = (X-u)/(S/sqrt(n));
+[P,Q]=cdft("PQ",t,Df)
+disp(P,'The probability that the mean annual sales of the sample is less than P(X<=98)=')
+disp(Q,'The probability that the mean annual sales of the sample is less than P(X>=98)=')
+//Result
+//The probability that the mean annual sales of the sample is less than P(X<=98)=
+// 0.9032736
+//The probability that the mean annual sales of the sample is less than P(X>=98)=
+// 0.0967264 \ No newline at end of file
diff --git a/331/CH7/EX7.7/Example_7_7.sce b/331/CH7/EX7.7/Example_7_7.sce
new file mode 100755
index 000000000..bad21ac0f
--- /dev/null
+++ b/331/CH7/EX7.7/Example_7_7.sce
@@ -0,0 +1,16 @@
+//Caption:Chi-square Distribution[Sampling Distributions of Variance]
+//Example7.7
+//Page210
+clear;
+clc;
+n =20; //sample size
+Sig = 81;//variance of mean annual sales of the population in Lakhs
+S2 = 125;//Variance of mean annual sales of the population in Lakhs
+Df = n-1; //degrees of freedom
+X = ((n-1)*S2)/Sig;
+[P,Q]=cdfchi("PQ",X,Df)
+disp(Q,'The probability that the chi-square variable is > calculated chi-square statistic is =')
+//Result
+//The probability that the chi-square variable is > calculated chi-square statistic is =
+// 0.0611010
+// \ No newline at end of file
diff --git a/331/CH7/EX7.8/Example_7_8.sce b/331/CH7/EX7.8/Example_7_8.sce
new file mode 100755
index 000000000..fbf7b71d2
--- /dev/null
+++ b/331/CH7/EX7.8/Example_7_8.sce
@@ -0,0 +1,19 @@
+//Caption:F-distribution [Sampling Distributions of Variance]
+//Different Variance
+//Example7.8
+//Page211
+clear;
+clc;
+n1 = 8;//Size of the first sample
+n2 = 20;// Size of the second sample
+Sig1 = 100;//variance of the first sample
+Sig2 = 40;//variance of the second sample
+F = Sig1/Sig2;
+Dfn = n1-1;
+Dfd = n2-1;
+[P,Q]=cdff("PQ",F,Dfn,Dfd)
+disp(Q,'The probability that tha F ratio is more than the calculated F statistic=')
+//Result
+//The probability that the F ratio is more than the calculated F statistic=
+// 0.0531477
+ \ No newline at end of file
diff --git a/331/CH7/EX7.9/Example_7_9.sce b/331/CH7/EX7.9/Example_7_9.sce
new file mode 100755
index 000000000..9eb589cb7
--- /dev/null
+++ b/331/CH7/EX7.9/Example_7_9.sce
@@ -0,0 +1,16 @@
+//Caption:F-distribution [Sampling Distributions of Variance]
+//Same Variance
+//Example7.9
+//Page211
+clear;
+clc;
+n1 = 21;//Size of the first sample
+n2 = 20;// Size of the second sample
+F = 3; //variance of the first sample 3 times more than variance of second sample
+Dfn = n1-1;
+Dfd = n2-1;
+[P,Q]=cdff("PQ",F,Dfn,Dfd)
+disp(Q,'The probability that the variance of the first sample > 3 times that of the second sample is =')
+//Result
+//The probability that the variance of the first sample > 3 times that of the second sample is =
+// 0.0100558 \ No newline at end of file
diff --git a/331/CH8/EX8.1/Example_8_1.sce b/331/CH8/EX8.1/Example_8_1.sce
new file mode 100755
index 000000000..e026c47f8
--- /dev/null
+++ b/331/CH8/EX8.1/Example_8_1.sce
@@ -0,0 +1,47 @@
+//One-tailed Tests Concerning Single Mean
+//(When the variance of the Population is Known and the Population is infinite)
+//Example8.1
+//Page230
+//Test1: Ho:u<=k; H1:u>k
+clc;
+u = input('Enter the Population Mean');
+Sigma2 = input('Enter the Populaion variance');
+std = sqrt(Sigma2); //standard deviation
+n = input('Enter the Sample Size');
+X = input('Enter the Sample Mean');
+alpha = input('Enter the significance level');
+Test = input('Enter the Type of test')
+//Calculation of Z statistic
+Zx = nor_dist_stat_infini_po(X,u,std,n)
+disp(Zx,'calculated Normal Z-statistic =')
+Z_alpha = standard_normal_zstat(alpha)
+disp(Z_alpha,'Standard Normal Stastistic=')
+if (Test==1) then
+ if (Zx < Z_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif (Zx > Z_alpha)then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if (Zx > Z_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif (Zx < Z_alpha)then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the Population Mean 10
+//Enter the Populaion variance 16
+//Enter the Sample Size 36
+//Enter the Sample Mean 10.5
+//Enter the significance level 0.05
+//Enter the Type of test 1
+//calculated Normal Z-statistic = 0.75
+//Standard Normal Stastistic= 1.64
+// It falls in the Acceptance Region
+// Then Null Hypothesis Ho should be Accepted
+// \ No newline at end of file
diff --git a/331/CH8/EX8.10/Example_8_10.sce b/331/CH8/EX8.10/Example_8_10.sce
new file mode 100755
index 000000000..36d08a996
--- /dev/null
+++ b/331/CH8/EX8.10/Example_8_10.sce
@@ -0,0 +1,58 @@
+//One-tailed Tests Concerning Single Mean
+//(When the variance of the Population is UnKnown and the Sample size is Large)
+//Example8.10
+//Page246
+//Test2: Ho:u>=k; H1:u<k
+
+clc;
+N = input('Enter the Population size');
+u = input('Enter the Population Mean');
+Sigma2 = input('Enter the Sample variance');
+std = sqrt(Sigma2); //standard deviation
+n = input('Enter the Sample Size');
+X = input('Enter the Sample Mean');
+alpha = input('Enter the significance level');
+Test = input('Enter the Type of test')
+//Calculation of Z statistic
+Zx = nor_dist_stat_finite_po(X,u,std,n,N)
+disp(Zx,'calculated Normal Z-statistic =')
+Z_alpha = standard_normal_zstat(alpha)
+disp(Z_alpha,'Standard Normal Stastistic=')
+if (Test==1) then
+ if(Zx < Z_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Zx > Z_alpha) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if(Zx>-Z_alpha)
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Zx<-Z_alpha)
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the Population size 900
+//Enter the Population Mean 6
+//Enter the Sample variance 1.44
+//Enter the Sample Size 100
+//Enter the Sample Mean 5.7
+//Enter the significance level 0.01
+//Enter the Type of test 2
+//
+// calculated Normal Z-statistic =
+//
+// - 2.6501769
+//
+// Standard Normal Stastistic=
+//
+// 2.33
+//
+// It falls in the Rejection Region
+//
+// Then Null Hypothesis Ho should be Rejected
+// \ No newline at end of file
diff --git a/331/CH8/EX8.11/Example_8_11.sce b/331/CH8/EX8.11/Example_8_11.sce
new file mode 100755
index 000000000..cef8df76d
--- /dev/null
+++ b/331/CH8/EX8.11/Example_8_11.sce
@@ -0,0 +1,45 @@
+//Two-tailed Tests Concerning Single Mean
+//(When the variance of the Population is UnKnown and the Sample Size is Large)
+//Example8.11
+//Page248
+//Test: Ho:u=k; H1:u#k
+
+
+clc;
+u = input('Enter the Population Mean');
+Sigma2 = input('Enter the Sample variance');
+std = sqrt(Sigma2); //standard deviation
+n = input('Enter the Sample Size');
+X = input('Enter the Sample Mean');
+alpha = input('Enter the significance level');
+alpha = alpha/2;
+//Calculation of Z statistic
+Zx = nor_pop_unknown_large(X,u,std,n)
+disp(Zx,'calculated Normal Z-statistic =')
+Z_alpha = standard_normal_zstat(alpha)
+disp(Z_alpha,'Standard Normal Stastistic=')
+if ((-Z_alpha < Zx) &(Zx< Z_alpha)) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+else
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+end
+//Result
+//Enter the Population Mean 10
+//Enter the Sample variance 0.64
+//Enter the Sample Size 64
+//Enter the Sample Mean 9.8
+//Enter the significance level 0.05
+//
+// calculated Normal Z-statistic =
+//
+// - 2.
+//
+// Standard Normal Stastistic=
+//
+// 1.96
+//
+// It falls in the Rejection Region
+//
+// Then Null Hypothesis Ho should be Rejected \ No newline at end of file
diff --git a/331/CH8/EX8.12/Example_8_12.sce b/331/CH8/EX8.12/Example_8_12.sce
new file mode 100755
index 000000000..a8b5b28e4
--- /dev/null
+++ b/331/CH8/EX8.12/Example_8_12.sce
@@ -0,0 +1,47 @@
+//Two-tailed Tests Concerning Single Mean
+//(When the variance of the Population is UnKnown and the Sample Size is Large)
+//Example8.12
+//Page250
+//Test: Ho:u=k; H1:u#k
+
+
+clc;
+N = input('Enter the Population size');
+u = input('Enter the Population Mean');
+Sigma2 = input('Enter the Sample variance');
+std = sqrt(Sigma2); //standard deviation
+n = input('Enter the Sample Size');
+X = input('Enter the Sample Mean');
+alpha = input('Enter the significance level');
+alpha = alpha/2;
+//Calculation of Z statistic
+Zx = nor_dist_stat_finite_po(X,u,std,n,N)
+disp(Zx,'calculated Normal Z-statistic =')
+Z_alpha = standard_normal_zstat(alpha)
+disp(Z_alpha,'Standard Normal Stastistic=')
+if ((-Z_alpha < Zx) &(Zx< Z_alpha)) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+else
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+end
+//Result
+//Enter the Population size 1000
+//Enter the Population Mean 10
+//Enter the Sample variance 0.64
+//Enter the Sample Size 64
+//Enter the Sample Mean 9.8
+//Enter the significance level 0.05
+//
+// calculated Normal Z-statistic =
+//
+// - 2.0662117
+//
+// Standard Normal Stastistic=
+//
+// 1.96
+//
+// It falls in the Rejection Region
+//
+// Then Null Hypothesis Ho should be Rejected \ No newline at end of file
diff --git a/331/CH8/EX8.13/Example_8_13.sce b/331/CH8/EX8.13/Example_8_13.sce
new file mode 100755
index 000000000..321473aad
--- /dev/null
+++ b/331/CH8/EX8.13/Example_8_13.sce
@@ -0,0 +1,55 @@
+//One-tailed Tests Concerning Single Mean(when the variance of the Population is
+// Unknown and the Sample Size is Small)
+//Example8.13
+//page252
+//Test1: Ho:u<=k; H1:u>k
+clc;
+
+u = input('Enter the Population Mean');
+Sigma2 = input('Enter the Sample variance');
+std = sqrt(Sigma2); //standard deviation
+n = input('Enter the Sample Size');
+X = input('Enter the Sample Mean');
+alpha = input('Enter the significance level');
+Test = input('Enter the Type of test')
+//Calculation of students t distribution
+t = students_t_distri(X,u,std,n)
+disp(t,'calculated students t distribution =')
+t_alpha = stand_students_t_distri(alpha)
+disp(t_alpha,'Standard students t distribution=')
+if (Test==1) then
+ if(t < t_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(t > t_alpha) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if(t>-t_alpha)
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(t<-t_alpha)
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the Population Mean 60
+//Enter the Sample variance 25
+//Enter the Sample Size 16
+//Enter the Sample Mean 63
+//Enter the significance level 0.01
+//Enter the Type of test 1
+//
+// calculated students t distribution =
+//
+// 2.4
+//
+// Standard students t distribution=
+//
+// 2.602
+//
+// It falls in the Acceptance Region
+//
+// Then Null Hypothesis Ho should be Accepted \ No newline at end of file
diff --git a/331/CH8/EX8.14/Example_8_14.sce b/331/CH8/EX8.14/Example_8_14.sce
new file mode 100755
index 000000000..9c4f35e4e
--- /dev/null
+++ b/331/CH8/EX8.14/Example_8_14.sce
@@ -0,0 +1,56 @@
+//One-tailed Tests Concerning Single Mean(when the variance of the Population is
+// Unknown and the Sample Size is Small)
+//Example8.14
+//page253
+//Test2: Ho:u>=k; H1:u<k
+clc;
+
+u = input('Enter the Population Mean');
+Sigma2 = input('Enter the Sample variance');
+std = sqrt(Sigma2); //standard deviation
+n = input('Enter the Sample Size');
+X = input('Enter the Sample Mean');
+alpha = input('Enter the significance level');
+Test = input('Enter the Type of test')
+//Calculation of students t distribution
+t = students_t_distri(X,u,std,n)
+disp(t,'calculated students t distribution =')
+t_alpha = stand_students_t_distri(alpha)
+disp(t_alpha,'Standard students t distribution=')
+if (Test==1) then
+ if(t < t_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(t > t_alpha) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if(t>-t_alpha)
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(t<-t_alpha)
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the Population Mean 100
+//Enter the Sample variance 64
+//Enter the Sample Size 25
+//Enter the Sample Mean 97
+//Enter the significance level 0.05
+//Enter the Type of test 2
+//
+// calculated students t distribution =
+//
+// - 1.875
+//
+// Standard students t distribution=
+//
+// 1.711
+//
+// It falls in the Rejection Region
+//
+// Then Null Hypothesis Ho should be Rejected
+// \ No newline at end of file
diff --git a/331/CH8/EX8.15/Example_8_15.sce b/331/CH8/EX8.15/Example_8_15.sce
new file mode 100755
index 000000000..f448f086c
--- /dev/null
+++ b/331/CH8/EX8.15/Example_8_15.sce
@@ -0,0 +1,44 @@
+//Two-tailed Tests Concerning Single Mean(when the variance of the Population is
+// Unknown and the Sample Size is Small)
+//Example8.15
+//page254
+// Ho:u=k; H1:u#k
+clc;
+
+u = input('Enter the Population Mean');
+Sigma2 = input('Enter the Sample variance');
+std = sqrt(Sigma2); //standard deviation
+n = input('Enter the Sample Size');
+X = input('Enter the Sample Mean');
+alpha = input('Enter the significance level');
+alpha = alpha/2;
+//Calculation of students t distribution
+t = students_t_distri(X,u,std,n)
+disp(t,'calculated students t distribution =')
+t_alpha = stand_students_t_distri(alpha)
+disp(t_alpha,'Standard students t distribution=')
+if ((-t_alpha < t) &(t<t_alpha)) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+else
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+end
+//Result
+//Enter the Population Mean 150
+//Enter the Sample variance 100
+//Enter the Sample Size 25
+//Enter the Sample Mean 145
+//Enter the significance level 0.05
+//
+// calculated students t distribution =
+//
+// - 2.5
+//
+// Standard students t distribution=
+//
+// 2.064
+//
+// It falls in the Rejection Region
+//
+// Then Null Hypothesis Ho should be Rejected \ No newline at end of file
diff --git a/331/CH8/EX8.16/Example_8_16.sce b/331/CH8/EX8.16/Example_8_16.sce
new file mode 100755
index 000000000..e8bdbce51
--- /dev/null
+++ b/331/CH8/EX8.16/Example_8_16.sce
@@ -0,0 +1,58 @@
+//One-tailed Tests Concerning Difference between Two Means
+//(When the variances of the Populations are Known)
+//Example8.16
+//page256
+//Test 1: Ho:u1<=u2 or u1-u2<=0
+// H1: u1>u2 or u1-u2>0
+clc;
+Sigma1 = input('Enter the variance of population1')
+Sigma2 = input('Enter the varinace of population2')
+n1 = input('Enter the sample size taken from population1')
+n2 = input('Enter the sample size taken from population2')
+X1 = input('Enter the mean of the sample1')
+X2 = input('Enter the mean of the sample2')
+alpha = input('Enter the significance level')
+Test = input('Enter the Type of test')
+//Calculation of Z statistic
+Z_X1_X2 = Norm_Dis_Diff_Two_Mean(X1,X2,Sigma1,Sigma2,n1,n2)
+disp(Z_X1_X2,'calculated Normal Z-statistic =')
+Z_alpha = standard_normal_zstat(alpha)
+disp(Z_alpha,'Standard Normal Stastistic=')
+if (Test==1) then
+ if(Z_X1_X2 < Z_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Z_X1_X2 > Z_alpha) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if(Z_X1_X2 >-Z_alpha)
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Z_X1_X2<-Z_alpha)
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the variance of population1 9
+//Enter the varinace of population2 4
+//Enter the sample size taken from population1 49
+//Enter the sample size taken from population2 64
+//Enter the mean of the sample1 7
+//Enter the mean of the sample2 6
+//Enter the significance level 0.05
+//Enter the Type of test 1
+//
+// calculated Normal Z-statistic =
+//
+// 2.0154841
+//
+// Standard Normal Stastistic=
+//
+// 1.64
+//
+// It falls in the Rejection Region
+//
+// Then Null Hypothesis Ho should be Rejected \ No newline at end of file
diff --git a/331/CH8/EX8.17/Example_8_17.sce b/331/CH8/EX8.17/Example_8_17.sce
new file mode 100755
index 000000000..f44cdf6a8
--- /dev/null
+++ b/331/CH8/EX8.17/Example_8_17.sce
@@ -0,0 +1,58 @@
+//One-tailed Tests Concerning Difference between Two Means
+//(When the variances of the Populations are Known)
+//Example8.17
+//page258
+//Test 2: Ho:u1>=u2 or u1-u2>=0
+// H1: u1<u2 or u1-u2<0
+clc;
+Sigma1 = input('Enter the variance of population1')
+Sigma2 = input('Enter the varinace of population2')
+n1 = input('Enter the sample size taken from population1')
+n2 = input('Enter the sample size taken from population2')
+X1 = input('Enter the mean of the sample1')
+X2 = input('Enter the mean of the sample2')
+alpha = input('Enter the significance level')
+Test = input('Enter the Type of test')
+//Calculation of Z statistic
+Z_X1_X2 = Norm_Dis_Diff_Two_Mean(X1,X2,Sigma1,Sigma2,n1,n2)
+disp(Z_X1_X2,'calculated Normal Z-statistic =')
+Z_alpha = standard_normal_zstat(alpha)
+disp(Z_alpha,'Standard Normal Stastistic=')
+if (Test==1) then
+ if(Z_X1_X2 < Z_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Z_X1_X2 > Z_alpha) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if(Z_X1_X2 >-Z_alpha)
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Z_X1_X2<-Z_alpha)
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the variance of population1 9
+//Enter the varinace of population2 36
+//Enter the sample size taken from population1 64
+//Enter the sample size taken from population2 81
+//Enter the mean of the sample1 50
+//Enter the mean of the sample2 51
+//Enter the significance level 0.05
+//Enter the Type of test 2
+//
+// calculated Normal Z-statistic =
+//
+// - 1.3073633
+//
+// Standard Normal Stastistic=
+//
+// 1.64
+//
+// It falls in the Acceptance Region
+//
+// Then Null Hypothesis Ho should be Accepted \ No newline at end of file
diff --git a/331/CH8/EX8.18/Example_8_18.sce b/331/CH8/EX8.18/Example_8_18.sce
new file mode 100755
index 000000000..77f3c6e67
--- /dev/null
+++ b/331/CH8/EX8.18/Example_8_18.sce
@@ -0,0 +1,47 @@
+//Two-tailed Tests Concerning Difference between Two Means
+//(When the variances of the Populations are Known)
+//Example8.18
+//page260
+//Test : Ho:u1 =u2 or u1-u2=0
+// H1: u1#u2 or u1-u2#0
+clc;
+Sigma1 = input('Enter the variance of population1')
+Sigma2 = input('Enter the varinace of population2')
+n1 = input('Enter the sample size taken from population1')
+n2 = input('Enter the sample size taken from population2')
+X1 = input('Enter the mean of the sample1')
+X2 = input('Enter the mean of the sample2')
+alpha = input('Enter the significance level')
+alpha = alpha/2;
+//Calculation of Z statistic
+Z_X1_X2 = Norm_Dis_Diff_Two_Mean(X1,X2,Sigma1,Sigma2,n1,n2)
+disp(Z_X1_X2,'calculated Normal Z-statistic =')
+Z_alpha = standard_normal_zstat(alpha)
+disp(Z_alpha,'Standard Normal Stastistic=')
+if ((-Z_alpha < Z_X1_X2) &(Z_X1_X2< Z_alpha)) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+else
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+end
+//Result
+//Enter the variance of population1 5
+//Enter the varinace of population2 9
+//Enter the sample size taken from population1 64
+//Enter the sample size taken from population2 81
+//Enter the mean of the sample1 60
+//Enter the mean of the sample2 61
+//Enter the significance level 0.01
+//
+// calculated Normal Z-statistic =
+//
+// - 2.2987831
+//
+// Standard Normal Stastistic=
+//
+// 2.57
+//
+// It falls in the Acceptance Region
+//
+// Then Null Hypothesis Ho should be Accepted \ No newline at end of file
diff --git a/331/CH8/EX8.19/Example_8_19.sce b/331/CH8/EX8.19/Example_8_19.sce
new file mode 100755
index 000000000..d3eb93d59
--- /dev/null
+++ b/331/CH8/EX8.19/Example_8_19.sce
@@ -0,0 +1,58 @@
+//One-tailed Tests Concerning Difference between Two Means
+//(When the variances of the Populations are UnKnown and the Sample Sizes are Large)
+//Example8.19
+//page262
+//Test 1 : Ho:u1<=u2 or u1-u2<=0
+// H1: u1>u2 or u1-u2>0
+clc;
+Sigma1 = input('Enter the variance of population1')
+Sigma2 = input('Enter the varinace of population2')
+n1 = input('Enter the sample size taken from population1')
+n2 = input('Enter the sample size taken from population2')
+X1 = input('Enter the mean of the sample1')
+X2 = input('Enter the mean of the sample2')
+alpha = input('Enter the significance level')
+Test = input('Enter the Type of test')
+//Calculation of Z statistic
+Z_X1_X2 = Norm_Dis_Diff_Two_Mean(X1,X2,Sigma1,Sigma2,n1,n2)
+disp(Z_X1_X2,'calculated Normal Z-statistic =')
+Z_alpha = standard_normal_zstat(alpha)
+disp(Z_alpha,'Standard Normal Stastistic=')
+if (Test==1) then
+ if(Z_X1_X2 < Z_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Z_X1_X2 > Z_alpha) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if(Z_X1_X2 >-Z_alpha)
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Z_X1_X2<-Z_alpha)
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the variance of population1 9
+//Enter the varinace of population2 25
+//Enter the sample size taken from population1 81
+//Enter the sample size taken from population2 64
+//Enter the mean of the sample1 70
+//Enter the mean of the sample2 68
+//Enter the significance level 0.05
+//Enter the Type of test 1
+//
+//calculated Normal Z-statistic =
+//
+// 2.8235294
+//
+//Standard Normal Stastistic=
+//
+// 1.64
+//
+//It falls in the Rejection Region
+//
+//Then Null Hypothesis Ho should be Rejected \ No newline at end of file
diff --git a/331/CH8/EX8.2/Example_8_2.sce b/331/CH8/EX8.2/Example_8_2.sce
new file mode 100755
index 000000000..5ba91d3e7
--- /dev/null
+++ b/331/CH8/EX8.2/Example_8_2.sce
@@ -0,0 +1,49 @@
+//One-tailed Tests Concerning Single Mean
+//(When the variance of the Population is Known and the Population is infinite)
+//Example8.2
+//Page233
+//Test2: Ho:u>=k; H1:u<k
+clear
+clc;
+u = input('Enter the Population Mean');
+Sigma2 = input('Enter the Populaion variance');
+std = sqrt(Sigma2); //standard deviation
+n = input('Enter the Sample Size');
+X = input('Enter the Sample Mean');
+alpha = input('Enter the significance level');
+Test = input('Enter the Type of test')
+//Calculation of Z statistic
+Zx = normal_distribution_stat(X,u,std,n)
+disp(Zx,'calculated Normal Z-statistic =')
+Z_alpha = standard_normal_zstat(alpha)
+disp(Z_alpha,'Standard Normal Stastistic=')
+if (Test==1) then
+ if (Zx < Z_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif (Zx > Z_alpha)then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if (Zx >- Z_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif (Zx <- Z_alpha) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the Population Mean 12
+//Enter the Populaion variance 16
+//Enter the Sample Size 36
+//Enter the Sample Mean 10.5
+//Enter the significance level 0.05
+//Enter the Type of test 2
+//
+// calculated Normal Z-statistic = - 2.25
+//
+// Standard Normal Stastistic= 1.64
+// // It falls in the Rejection Region
+// // Then Null Hypothesis Ho should be Rejected
diff --git a/331/CH8/EX8.20/Example_8_20.sce b/331/CH8/EX8.20/Example_8_20.sce
new file mode 100755
index 000000000..1c7d77c2d
--- /dev/null
+++ b/331/CH8/EX8.20/Example_8_20.sce
@@ -0,0 +1,47 @@
+//Two-tailed Test Concerning Difference between Two Means
+//(When the variances of the Populations are UnKnown and the Sample Sizes are Large)
+//Example8.20
+//page265
+//Test : Ho:u1=u2 or u1-u2=0
+// H1: u1#u2 or u1-u2#0
+clc;
+Sigma1 = input('Enter the variance of population1')
+Sigma2 = input('Enter the varinace of population2')
+n1 = input('Enter the sample size taken from population1')
+n2 = input('Enter the sample size taken from population2')
+X1 = input('Enter the mean of the sample1')
+X2 = input('Enter the mean of the sample2')
+alpha = input('Enter the significance level')
+alpha = alpha/2;
+//Calculation of Z statistic
+Z_X1_X2 = Norm_Dis_Diff_Two_Mean(X1,X2,Sigma1,Sigma2,n1,n2)
+disp(Z_X1_X2,'calculated Normal Z-statistic =')
+Z_alpha = standard_normal_zstat(alpha)
+disp(Z_alpha,'Standard Normal Stastistic=')
+if ((-Z_alpha < Z_X1_X2) &(Z_X1_X2< Z_alpha)) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+else
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+end
+//Result
+//Enter the variance of population1 9
+//Enter the varinace of population2 36
+//Enter the sample size taken from population1 50
+//Enter the sample size taken from population2 80
+//Enter the mean of the sample1 21
+//Enter the mean of the sample2 23
+//Enter the significance level 0.01
+//
+// calculated Normal Z-statistic =
+//
+// - 2.5197632
+//
+// Standard Normal Stastistic=
+//
+// 2.57
+//
+// It falls in the Acceptance Region
+//
+// Then Null Hypothesis Ho should be Accepted \ No newline at end of file
diff --git a/331/CH8/EX8.21/Example_8_21.sce b/331/CH8/EX8.21/Example_8_21.sce
new file mode 100755
index 000000000..dc0edd194
--- /dev/null
+++ b/331/CH8/EX8.21/Example_8_21.sce
@@ -0,0 +1,51 @@
+//One-tailed Tests Concerning Difference between Two Means
+//(When the variances of the Populations are UnKnown and the Sample Sizes are Small)
+//Example8.21
+//page267
+//Test 2 : Ho:u1>=u2 or u1-u2>=0
+// H1: u1<u2 or u1-u2<0
+clc;
+Sigma1 = input('Enter the variance of population1')
+Sigma2 = input('Enter the varinace of population2')
+n1 = input('Enter the sample size taken from population1')
+n2 = input('Enter the sample size taken from population2')
+X1 = input('Enter the mean of the sample1')
+X2 = input('Enter the mean of the sample2')
+alpha = input('Enter the significance level')
+Test = input('Enter the Type of test')
+//Calculation of Z statistic
+t_X1_X2 = Students_t_Var_Unknown(X1,X2,Sigma1,Sigma2,n1,n2)
+disp(t_X1_X2,'calculated Normal Z-statistic =')
+t_alpha = stand_students_t_VarUnkn(alpha)
+disp(t_alpha,'Standard Normal Stastistic=')
+if (Test==1) then
+ if(t_X1_X2 < t_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(t_X1_X2 > t_alpha) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if(t_X1_X2 >-t_alpha)
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(t_X1_X2<-t_alpha)
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the varinace of population2 16
+//Enter the sample size taken from population1 16
+//Enter the sample size taken from population2 25
+//Enter the mean of the sample1 58
+//Enter the mean of the sample2 60
+//Enter the significance level 0.01
+//Enter the Type of test 2
+//Sp= 11.384615
+//Sigma= 1.0802421
+//calculated Normal Z-statistic = - 1.8514368
+//Standard Normal Stastistic= 2.326
+//It falls in the Acceptance Region
+//Then Null Hypothesis Ho should be Accepted \ No newline at end of file
diff --git a/331/CH8/EX8.22/Example_8_22.sce b/331/CH8/EX8.22/Example_8_22.sce
new file mode 100755
index 000000000..75ae128e1
--- /dev/null
+++ b/331/CH8/EX8.22/Example_8_22.sce
@@ -0,0 +1,41 @@
+//Two-tailed Test Concerning Difference between Two Means
+//(When the variances of the Populations are UnKnown and the Sample Sizes are Large)
+//Example8.22
+//page265
+//Test : Ho:u1=u2 or u1-u2=0
+// H1: u1#u2 or u1-u2#0
+clc;
+Sigma1 = input('Enter the variance of population1')
+Sigma2 = input('Enter the varinace of population2')
+n1 = input('Enter the sample size taken from population1')
+n2 = input('Enter the sample size taken from population2')
+X1 = input('Enter the mean of the sample1')
+X2 = input('Enter the mean of the sample2')
+alpha = input('Enter the significance level')
+alpha = alpha/2;
+//Calculation of Z statistic
+Z_X1_X2 = Students_t_Var_Unknown(X1,X2,Sigma1,Sigma2,n1,n2)
+disp(Z_X1_X2,'calculated Normal Z-statistic =')
+Z_alpha = stand_students_t_VarUnkn(alpha)
+disp(Z_alpha,'Standard Normal Stastistic=')
+if ((-Z_alpha < Z_X1_X2) &(Z_X1_X2< Z_alpha)) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+else
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+end
+//Result
+//Enter the variance of population1 2.5
+//Enter the varinace of population2 4
+//Enter the sample size taken from population1 16
+//Enter the sample size taken from population2 20
+//Enter the mean of the sample1 38.5
+//Enter the mean of the sample2 40
+//Enter the significance level 0.1
+//Sp= 3.3382353
+//Sigma= 0.6128225
+//calculated Normal Z-statistic = - 2.4476906
+//Standard Normal Stastistic= 1.645
+//It falls in the Rejection Region
+//Then Null Hypothesis Ho should be Rejected \ No newline at end of file
diff --git a/331/CH8/EX8.23/Example_8_23.sce b/331/CH8/EX8.23/Example_8_23.sce
new file mode 100755
index 000000000..a7500a67f
--- /dev/null
+++ b/331/CH8/EX8.23/Example_8_23.sce
@@ -0,0 +1,58 @@
+//Caption:Test of Hypotheses concerning Proportions
+//One-tailed Tests Concerning Single Proportion
+//Test 1: Ho:p<=k and H1:p>k
+//Example8.23
+//Page271
+
+clc;
+p = 0.85; //85% of the assemblies coming out of the assembly line will be free from
+//missing components
+q = 1-p;
+n = 50; //sample size
+pbar = 44/n; //44 assemblies are free from missing components
+alpha = 0.05; //significance level
+Std = sqrt(p*q/n);
+Test = input('Enter the type of test=')
+z_stand = standard_normal_zstat(alpha);
+disp(z_stand,'The standard normal z statistic=')
+zp = (pbar-p)/Std;
+disp(zp,'The calculated value z statistic =')
+if (Test==1) then
+ if(zp < z_stand) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(zp > z_stand) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if(zp >-z_stand)
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(zp <-z_stand)
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the type of test=1
+//
+// The standard normal z statistic=
+//
+// 1.64
+//
+// The calculated value z statistic =
+//
+// 0.5940885
+//
+// It falls in the Acceptance Region
+//
+// Then Null Hypothesis Ho should be Accepted
+//
+//-->p
+// p = 0.85
+//
+//-->pbar
+// pbar =0.88
+// -->Std
+// Std = 0.0504975 \ No newline at end of file
diff --git a/331/CH8/EX8.24/Example_8_24.sce b/331/CH8/EX8.24/Example_8_24.sce
new file mode 100755
index 000000000..00d6ca399
--- /dev/null
+++ b/331/CH8/EX8.24/Example_8_24.sce
@@ -0,0 +1,50 @@
+//Caption:Test of Hypotheses concerning Proportions
+//One-tailed Tests Concerning Single Proportion
+//Test 2: Ho:p>=k and H1:p<k
+//Example8.24
+//Page272
+//Test 2: Ho:p>=k; H1:p<k
+clc;
+p = 0.15; //15% employees attended duty for less than the total number of working days
+q = 1-p;
+n = 120; //sample size
+pbar = 17/n; //17 attended duty for less than the total number of working days
+alpha = 0.05; //significance level
+Std = sqrt(p*q/n);
+Test = input('Enter the type of test=')
+z_stand = standard_normal_zstat(alpha);
+disp(z_stand,'The standard normal z statistic=')
+zp = (pbar-p)/Std;
+disp(zp,'The calculated value z statistic =')
+if (Test==1) then
+ if(zp < z_stand) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(zp > z_stand) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if(zp >-z_stand)
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(zp <-z_stand)
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//The standard normal z statistic=
+// 1.64
+//The calculated value z statistic =
+// - 0.255655
+//It falls in the Acceptance Region
+//Then Null Hypothesis Ho should be Accepted
+//-->p
+// p = 0.15
+//-->pbar
+// pbar = 0.1416667
+//-->Std
+// Std = 0.0325960
+//-->zp
+// zp = - 0.255655 \ No newline at end of file
diff --git a/331/CH8/EX8.25/Example_8_25.sce b/331/CH8/EX8.25/Example_8_25.sce
new file mode 100755
index 000000000..5fbea4a50
--- /dev/null
+++ b/331/CH8/EX8.25/Example_8_25.sce
@@ -0,0 +1,36 @@
+//Caption:Test of Hypotheses concerning Proportions
+//Two-tailed Test Concerning Single Proportion
+//Example8.25
+//Page274
+//Ho: p =k ; H1:p#k
+clc;
+p = 0.90; //90% of cases cured by new drugs
+q = 1-p;
+n = 80; //sample size
+pbar = 68/n; //68 out of 80 patients are cured (sample proportion)
+alpha = 0.05; //significance level
+alpha = alpha/2;
+Std = sqrt(p*q/n);
+z_stand = standard_normal_zstat(alpha);
+disp(z_stand,'The standard normal z statistic=')
+zp = (pbar-p)/Std;
+disp(zp,'The calculated value z statistic =')
+if ((-z_stand < zp) &(zp< z_stand)) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+else
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+end
+//Result
+//The standard normal z statistic=
+//
+// 1.96
+//
+// The calculated value z statistic =
+//
+// - 1.490712
+//
+// It falls in the Acceptance Region
+//
+// Then Null Hypothesis Ho should be Accepted \ No newline at end of file
diff --git a/331/CH8/EX8.26/Example_8_26.sce b/331/CH8/EX8.26/Example_8_26.sce
new file mode 100755
index 000000000..0a325f540
--- /dev/null
+++ b/331/CH8/EX8.26/Example_8_26.sce
@@ -0,0 +1,65 @@
+//Caption:One-tailed Tests Concerning Difference between Two Proportions
+//Test 1: Ho: p1-p2<=0 and H1: p1-p2>0
+//Example8.26
+//Page277
+
+clc;
+n1= 120; //sample size of the vendor-1
+n2 = 100; //sample size of the vendor-2
+N1 = 15;//number of defective pieces in the sample-1
+N2 = 11;//number of defective pieces in the sample-2
+p1 = N1/n1; // proportion w.r.to vendor-1
+p2 = N2/n2; // proportion w.r.to vendor-2
+Stdp1_p2 = sqrt(((p1*(1-p1))/n1)+((p2*(1-p2))/n2))
+alpha = 0.05;
+Test = input('Enter the type of test=')
+Zp1_p2 = ((p1-p2)-(0))/Stdp1_p2; //calculated normal statistic for (p1-p2)
+disp(Zp1_p2,'The calculated normal statistic for (p1-p2)=')
+z_Stand = standard_normal_zstat(alpha);//standard normal statistic for (p1-p2)
+disp(z_Stand,'The Standard normal statistic for (p1-p2)=')
+if (Test==1) then
+ if(Zp1_p2 < z_Stand) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Zp1_p2 > z_Stand) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if(Zp1_p2 >-z_Stand)
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Zp1_p2<-z_Stand)
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the type of test=1
+//
+// The calculated normal statistic for (p1-p2)=
+//
+// 0.3449910
+//
+// The Standard normal statistic for (p1-p2)=
+//
+// 1.64
+//
+// It falls in the Acceptance Region
+//
+// Then Null Hypothesis Ho should be Accepted
+//
+//-->p1
+// p1 =
+//
+// 0.125
+//
+//-->p2
+// p2 =
+//
+// 0.11
+//
+//-->Stdp1_p2
+// Stdp1_p2 =
+//
+// 0.0434794 \ No newline at end of file
diff --git a/331/CH8/EX8.27/Example_8_27.sce b/331/CH8/EX8.27/Example_8_27.sce
new file mode 100755
index 000000000..a7c5d18d5
--- /dev/null
+++ b/331/CH8/EX8.27/Example_8_27.sce
@@ -0,0 +1,63 @@
+//Caption:One-tailed Tests Concerning Difference between Two Proportions
+//Test 2: Ho: p1-p2>=0 and H1: p1-p2<0
+//Example8.27
+//Page278
+
+clc;
+n1= 110; //sample size of the retail shop-1
+n2 = 130; //sample size of the retail shop-2
+N1 = 90;//number of days on which sales exceeded the targetted sales in retail shop-1
+N2 = 112;//number of days on which sales exceeded the targetted sales in retail shop-2
+p1 = N1/n1; // proportion w.r.to shop-1
+p2 = N2/n2; // proportion w.r.to shop-2
+Stdp1_p2 = sqrt(((p1*(1-p1))/n1)+((p2*(1-p2))/n2))
+alpha = 0.1;
+Test = input('Enter the type of test=')
+Zp1_p2 = ((p1-p2)-(0))/Stdp1_p2; //calculated normal statistic for (p1-p2)
+disp(Zp1_p2,'The calculated normal statistic for (p1-p2)=')
+z_Stand = standard_normal_zstat(alpha);//standard normal statistic for (p1-p2)
+disp(z_Stand,'The Standard normal statistic for (p1-p2)=')
+if (Test==1) then
+ if(Zp1_p2 < z_Stand) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Zp1_p2 > z_Stand) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if(Zp1_p2 >-z_Stand)
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Zp1_p2<-z_Stand)
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//The calculated normal statistic for (p1-p2)=
+//
+// - 0.9100065
+//
+// The Standard normal statistic for (p1-p2)=
+//
+// 1.28
+//
+// It falls in the Acceptance Region
+//
+// Then Null Hypothesis Ho should be Accepted
+//
+//-->p1
+// p1 =
+//
+// 0.8181818
+//
+//-->p2
+// p2 =
+//
+// 0.8615385
+//
+//-->Stdp1_p2
+// Stdp1_p2 =
+//
+// 0.0476443 \ No newline at end of file
diff --git a/331/CH8/EX8.28/Example_8_28.sce b/331/CH8/EX8.28/Example_8_28.sce
new file mode 100755
index 000000000..25ddb1eda
--- /dev/null
+++ b/331/CH8/EX8.28/Example_8_28.sce
@@ -0,0 +1,37 @@
+//Caption:Two-tailed Test Concerning the Difference between Two Proportions
+//Example8.28
+//Page281
+
+clc;
+n1= 150; //sample size w.r.to City-Y
+n2 = 160; //sample size w.r.to City-X
+N1 = 135;//number of credit card holders in City-X
+N2 = 133;//number of creedit card holders in City-Y
+p1 = N1/n1; // proportion w.r.to City-X
+p2 = N2/n2; // proportion w.r.to City-Y
+Stdp1_p2 = sqrt(((p1*(1-p1))/n1)+((p2*(1-p2))/n2))
+alpha = 0.1;
+alpha = alpha/2;
+Zp1_p2 = ((p1-p2)-(0))/Stdp1_p2; //calculated normal statistic for (p1-p2)
+disp(Zp1_p2,'The calculated normal statistic for (p1-p2)=')
+z_Stand = standard_normal_zstat(alpha);//standard normal statistic for (p1-p2)
+disp(z_Stand,'The Standard normal statistic for (p1-p2)=')
+if ((-z_Stand < Zp1_p2) &(Zp1_p2 < z_Stand)) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+else
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+end
+//Result
+//The calculated normal statistic for (p1-p2)=
+//
+// 1.7890614
+//
+// The Standard normal statistic for (p1-p2)=
+//
+// 1.64
+//
+// It falls in the Rejection Region
+//
+// Then Null Hypothesis Ho should be Rejected \ No newline at end of file
diff --git a/331/CH8/EX8.29/Example_8_29.sce b/331/CH8/EX8.29/Example_8_29.sce
new file mode 100755
index 000000000..ddbdc5978
--- /dev/null
+++ b/331/CH8/EX8.29/Example_8_29.sce
@@ -0,0 +1,47 @@
+//Caption: Tests of Hypotheses Concerning variances
+//One-tailed Chi-square Tests Concerning Single Population Variance
+//Test 1: Ho: Var <= k and H1: Var >k
+//Example8.29
+//Page283
+
+clc;
+Var = 1.44; //popualtion variance of the diameter in mm
+n = 12;// sample size
+S2 = 1.96;//sample variance of the diameter in mm
+Alpha = 0.05;
+Test = input('Enter the type of test=')
+Xchi = ((n-1)*S2)/Var;//chi-square statistic to test the variance
+Xchi_stand = Chi_test(Alpha,Test)
+disp(Xchi,'The calculated Value chi-square value =')
+disp(Xchi_stand,'The table value of chi-square test =')
+if (Test==1) then
+ if(Xchi< Xchi_stand) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Xchi > Xchi_stand) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if(Xchi >Xchi_stand)
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Xchi<Xchi_stand)
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the type of test=1
+//
+// The calculated Value chi-square value =
+//
+// 14.972222
+//
+// The table value of chi-square test =
+//
+// 19.675
+//
+// It falls in the Acceptance Region
+//
+// Then Null Hypothesis Ho should be Accepted \ No newline at end of file
diff --git a/331/CH8/EX8.3/Example_8_3.sce b/331/CH8/EX8.3/Example_8_3.sce
new file mode 100755
index 000000000..c53ad87f1
--- /dev/null
+++ b/331/CH8/EX8.3/Example_8_3.sce
@@ -0,0 +1,38 @@
+//Two-tailed Tests Concerning Single Mean
+//(When the variance of the Population is Known and the Population is infinite)
+//Example8.3
+//Page234
+//Test: Ho:u=k; H1:u#k
+
+clc;
+u = input('Enter the Population Mean');
+Sigma2 = input('Enter the Populaion variance');
+std = sqrt(Sigma2); //standard deviation
+n = input('Enter the Sample Size');
+X = input('Enter the Sample Mean');
+alpha = input('Enter the significance level');
+alpha = alpha/2;
+//Calculation of Z statistic
+Zx = normal_distribution_stat(X,u,std,n)
+disp(Zx,'calculated Normal Z-statistic =')
+Z_alpha = standard_normal_zstat(alpha)
+disp(Z_alpha,'Standard Normal Stastistic=')
+if ((-Z_alpha < Zx) &(Zx< Z_alpha)) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+else
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+end
+
+//Result
+//Enter the Population Mean 50
+//Enter the Populaion variance 100
+//Enter the Sample Size 64
+//Enter the Sample Mean 52
+//Enter the significance level 0.01
+//
+//calculated Normal Z-statistic = 1.6
+//Standard Normal Stastistic= 2.57
+//It falls in the Acceptance Region
+//Then Null Hypothesis Ho should be Accepted \ No newline at end of file
diff --git a/331/CH8/EX8.30/Example_8_30.sce b/331/CH8/EX8.30/Example_8_30.sce
new file mode 100755
index 000000000..cd5f18695
--- /dev/null
+++ b/331/CH8/EX8.30/Example_8_30.sce
@@ -0,0 +1,47 @@
+//Caption: Tests of Hypotheses Concerning variances
+//Two tailed Chi-square Tests Concerning Single Population Variance
+//Test 2: Ho: Var >= k and H1: Var <k
+//Example8.30
+//Page284
+
+clc;
+Var = 0.64; //popualtion variance of the weight of the cement bags in Kg
+n = 8;// sample size
+S2 = 0.36;//sample variance of the weight of the cement bags in Kg
+Alpha = 0.01;
+Test = input('Enter the type of test=')
+Xchi = ((n-1)*S2)/Var;//chi-square statistic to test the variance
+Xchi_stand = Chi_test(Alpha,Test)
+disp(Xchi,'The calculated Value chi-square value =')
+disp(Xchi_stand,'The table value of chi-square test =')
+if (Test==1) then
+ if(Xchi< Xchi_stand) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Xchi > Xchi_stand) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if(Xchi >Xchi_stand)
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Xchi<Xchi_stand)
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the type of test=2
+//
+// The calculated Value chi-square value =
+//
+// 3.9375
+//
+// The table value of chi-square test =
+//
+// 1.239
+//
+// It falls in the Acceptance Region
+//
+// Then Null Hypothesis Ho should be Accepted
diff --git a/331/CH8/EX8.31/Example_8_31.sce b/331/CH8/EX8.31/Example_8_31.sce
new file mode 100755
index 000000000..9e1b10a3e
--- /dev/null
+++ b/331/CH8/EX8.31/Example_8_31.sce
@@ -0,0 +1,34 @@
+//Caption: Two-tailed Chi-square Test Concerning Single Population Variance
+//Example8.31
+//Page286
+//Test 2: Ho:Var =k; H1:Var#k
+
+clc;
+Var = 0.25; //popualtion variance of the weight of the drugs in mg
+n = 12;// sample size
+S2 = 0.49;//sample variance of the weight of drugs in mg
+Alpha = 0.10;
+Alpha = Alpha/2;
+Xchi = ((n-1)*S2)/Var;//chi-square statistic to test the variance
+Xchi_stand = Chi_test(Alpha,[])
+disp(Xchi,'The calculated Value chi-square value =')
+disp(Xchi_stand,'The table value of chi-square test =')
+if ((Xchi < Xchi_stand) &(Xchi< Xchi_stand)) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+else
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+end
+//Result
+//The calculated Value chi-square value =
+//
+// 21.56
+//
+// The table value of chi-square test =
+//
+// 4.575 19.675
+//
+// It falls in the Rejection Region
+//
+// Then Null Hypothesis Ho should be Rejected
diff --git a/331/CH8/EX8.32/Example_8_32.sce b/331/CH8/EX8.32/Example_8_32.sce
new file mode 100755
index 000000000..9879cca35
--- /dev/null
+++ b/331/CH8/EX8.32/Example_8_32.sce
@@ -0,0 +1,47 @@
+//Caption: One-tailed F-tests Concerning Two Population Variances
+//Example8.32
+//Page288
+//Test 1: Ho: Var1<=Var2; H1: Var1> Var2
+
+clc;
+n1 = 10; //size of the sample taken during night shift
+n2 = 15; //size of the sample taken during day shift
+Var1 = 64; //Variance in Kg of the sample taken during night shift
+Var2 = 40; //Variance in Kg of the sample taken during night shift
+Alpha = 0.05//significance level
+Test = input('Enter the type of test=')
+F = Var1/Var2; // F value
+F_stand = F_test(Alpha,Test)
+disp(F,'The calculated Value F=')
+disp(F_stand,'The value of F from F table =')
+if (Test==1) then
+ if(F < F_stand) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(F > F_stand) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if(F >-F_stand)
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(F<-F_stand)
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the type of test=1
+//
+// The calculated Value F=
+//
+// 1.6
+//
+// The value of F from F table =
+//
+// 2.65
+//
+// It falls in the Acceptance Region
+//
+// Then Null Hypothesis Ho should be Accepted \ No newline at end of file
diff --git a/331/CH8/EX8.33/Example_8_33.sce b/331/CH8/EX8.33/Example_8_33.sce
new file mode 100755
index 000000000..74da4ebf4
--- /dev/null
+++ b/331/CH8/EX8.33/Example_8_33.sce
@@ -0,0 +1,42 @@
+//Caption: One-tailed F-tests Concerning Two Population Variances
+//Example8.33
+//Page289
+//Test 2: Ho: Var1>=Var2; H1: Var1<Var2
+
+clc;
+n1 = 9; //size of the sample taken during night shift
+n2 = 13; //size of the sample taken during day shift
+Var1 = 0.49; //Variance in Kg of the sample taken during night shift
+Var2 = 0.81; //Variance in Kg of the sample taken during night shift
+Alpha = 0.01//significance level
+Test = input('Enter the type of test=')
+F = Var1/Var2; // F value
+F_stand = F_test(Alpha)
+disp(F,'The calculated Value F=')
+disp(F_stand,'The value of F from F table =')
+if (Test==1) then
+ if(F < F_stand) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(F > F_stand) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if(F >F_stand)
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(F<F_stand)
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the type of test=2
+//
+//The calculated Value F=
+// 0.6049383
+//The value of F from F table =
+// 0.176
+//It falls in the Acceptance Region
+//Then Null Hypothesis Ho should be Accepted \ No newline at end of file
diff --git a/331/CH8/EX8.34/Example_8_34.sce b/331/CH8/EX8.34/Example_8_34.sce
new file mode 100755
index 000000000..9c81c2fc6
--- /dev/null
+++ b/331/CH8/EX8.34/Example_8_34.sce
@@ -0,0 +1,33 @@
+//Caption:Two-tailed F-test Concerning Equality of Two Population Variances
+//Example8.34
+//Page291
+//Test2: Ho: Var1 = Var2 ; Var1 # Var2
+clc;
+n1 = 16; //size of the sample in old industrial estate
+n2 = 13; //size of the sample in new industrial estate
+Var1 = 225; //Variance in lakhs of old industrial estate
+Var2 = 83; //Variance in lakhs of new industrial estate
+Alpha = 0.1//significance level
+Alpha = Alpha/2;
+F = Var1/Var2; // F value
+F_stand = F_test(Alpha,[])
+disp(F,'The calculated Value F=')
+disp(F_stand,'The value of F from F table =')
+if ((F < F_stand) &(F< F_stand)) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+else
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+end
+//Result
+//The calculated Value F=
+//
+// 2.7108434
+//
+// The value of F from F table =
+//
+// 0.403 2.62
+//It falls in the Rejection Region
+//
+//Then Null Hypothesis Ho should be Rejected \ No newline at end of file
diff --git a/331/CH8/EX8.35/Example_8_35.sce b/331/CH8/EX8.35/Example_8_35.sce
new file mode 100755
index 000000000..a5c0da159
--- /dev/null
+++ b/331/CH8/EX8.35/Example_8_35.sce
@@ -0,0 +1,96 @@
+//Caption: Chi-Square Test for Checking Independence of categorized data
+//Example8.35
+//Page294
+//Ho: pij = pi.pj; H1: pij>pi.pj
+//ROR_LOT: Rate of return versus level of technology used
+clear;
+clc;
+ROR_LOT =[20,50,30,10;50,70,75,35;10,20,70,60]';
+disp('Level of technology used=')
+disp('Low Medium High')
+disp('___________________________')
+disp(ROR_LOT)
+disp('___________________________')
+[m,n]= size(ROR_LOT);
+for j = 1:n
+ oj(j)= sum(ROR_LOT(:,j));
+end
+oj = oj';
+disp(oj,'Column total =')
+for i = 1:m
+ oi(i) = sum(ROR_LOT(i,:));
+end
+disp(oi,'Row total =')
+oij = sum(oj);
+disp(oij,'Total number of observations in the entire table=')
+for i = 1:m
+ for j = 1:n
+ eij(i,j) = (oi(i)*oj(j))/oij
+ end
+end
+disp(eij,'The expected frequencies for different combinations of rows and columns')
+for i = 1:m
+ for j = 1:n
+ chi(i,j) = ((ROR_LOT(i,j)-eij(i,j))^2)/eij(i,j);
+ end
+end
+tot_chi = sum(chi(:,:));
+disp(tot_chi,'The calculated chi-square statistic =')
+alpha = 0.05;
+chi_stand = 12.592//chi-square statistic form table chi-square value
+disp(chi_stand,'The chi-square statistic form table chi-square value=')
+if (tot_chi>chi_stand) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+else
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+end
+//Result
+//Level of technology used=
+//
+// Low Medium High
+//
+// ___________________________
+//
+// 20. 50. 10.
+// 50. 70. 20.
+// 30. 75. 70.
+// 10. 35. 60.
+//
+// ___________________________
+//
+// Column total =
+//
+// 110. 230. 160.
+//
+// Row total =
+//
+// 80.
+// 140.
+// 175.
+// 105.
+//
+// Total number of observations in the entire table=
+//
+// 500.
+//
+// The expected frequencies for different combinations of rows and columns
+//
+// 17.6 36.8 25.6
+// 30.8 64.4 44.8
+// 38.5 80.5 56.
+// 23.1 48.3 33.6
+//
+// The calculated chi-square statistic =
+//
+// 78.339245
+//
+// The chi-square statistic form table chi-square value=
+//
+// 12.592
+//
+// It falls in the Rejection Region
+//
+// Then Null Hypothesis Ho should be Rejected
+// \ No newline at end of file
diff --git a/331/CH8/EX8.36/Example_8_36.sce b/331/CH8/EX8.36/Example_8_36.sce
new file mode 100755
index 000000000..0210377b3
--- /dev/null
+++ b/331/CH8/EX8.36/Example_8_36.sce
@@ -0,0 +1,95 @@
+//Caption: Chi-Square Test for Checking Independence of categorized data
+//Example8.36
+//Page296
+//Ho: pij = pi.pj; H1: pij>pi.pj
+//S_NOYE: Present monthly salary versus number of years of experience
+clear;
+clc;
+S_NOYE =[40,30,30,35;35,20,30,40;30,35,40,35]';
+disp('Number of years of experience,n')
+disp('n<2 2<=n<=5 5<=n')
+disp('___________________________')
+disp(S_NOYE)
+disp('___________________________')
+[m,n]= size(S_NOYE);
+for j = 1:n
+ oj(j)= sum(S_NOYE(:,j));
+end
+oj = oj';
+disp(oj,'Column total =')
+for i = 1:m
+ oi(i) = sum(S_NOYE(i,:));
+end
+disp(oi,'Row total =')
+oij = sum(oj);
+disp(oij,'Total number of observations in the entire table=')
+for i = 1:m
+ for j = 1:n
+ eij(i,j) = (oi(i)*oj(j))/oij
+ end
+end
+disp(eij,'The expected frequencies for different combinations of rows and columns')
+for i = 1:m
+ for j = 1:n
+ chi(i,j) = ((S_NOYE(i,j)-eij(i,j))^2)/eij(i,j);
+ end
+end
+tot_chi = sum(chi(:,:));
+disp(tot_chi,'The calculated chi-square statistic =')
+alpha = 0.05;
+chi_stand = 12.592//chi-square statistic form table chi-square value
+disp(chi_stand,'The chi-square statistic form table chi-square value=')
+if (tot_chi>chi_stand) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+else
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+end
+//Result
+//Number of years of experience,n
+//
+// n<2 2<=n<=5 5<=n
+//
+// ___________________________
+//
+// 40. 35. 30.
+// 30. 20. 35.
+// 30. 30. 40.
+// 35. 40. 35.
+//
+// ___________________________
+//
+// Column total =
+//
+// 135. 125. 140.
+//
+// Row total =
+//
+// 105.
+// 85.
+// 100.
+// 110.
+//
+// Total number of observations in the entire table=
+//
+// 400.
+//
+// The expected frequencies for different combinations of rows and columns
+//
+// 35.4375 32.8125 36.75
+// 28.6875 26.5625 29.75
+// 33.75 31.25 35.
+// 37.125 34.375 38.5
+//
+// The calculated chi-square statistic =
+//
+// 7.1221059
+//
+// The chi-square statistic form table chi-square value=
+//
+// 12.592
+//
+// It falls in the Acceptance Region
+//
+// Then Null Hypothesis Ho should be Accepted \ No newline at end of file
diff --git a/331/CH8/EX8.37/Example_8_37.sce b/331/CH8/EX8.37/Example_8_37.sce
new file mode 100755
index 000000000..e92080650
--- /dev/null
+++ b/331/CH8/EX8.37/Example_8_37.sce
@@ -0,0 +1,38 @@
+//Caption:Goodness of Fit Test
+//Example8.37
+//Page299
+//Ho: The given data follow an assumed distribution
+//H1: The given data do not follow the assumed distribution
+clear;
+clc;
+X = [30,31,32,33,34,35,36,37,38,39];//demand in units
+o = [13,10,7,10,6,9,12,10,14,9];//Observed frequencies
+N = sum(o);//total observed frequencies
+n = length(X);//number of demand values
+e = N/n; //expected frequency of each
+for i = 1:n
+ Obser_Chi(i) = ((o(i)-e)^2)/e;
+end
+Tol_Obser_Chi = sum(Obser_Chi);
+Chi_stand = 16.919;
+disp(Tol_Obser_Chi,'The observed chi-square statistic=')
+disp(Chi_stand,'The table chi-square statistic=')
+if (Tol_Obser_Chi>Chi_stand) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+else
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+end
+//Result
+//The observed chi-square statistic=
+//
+// 5.6
+//
+// The table chi-square statistic=
+//
+// 16.919
+//
+// It falls in the Acceptance Region
+//
+// Then Null Hypothesis Ho should be Accepted
diff --git a/331/CH8/EX8.38/Example_8_38.sce b/331/CH8/EX8.38/Example_8_38.sce
new file mode 100755
index 000000000..333306364
--- /dev/null
+++ b/331/CH8/EX8.38/Example_8_38.sce
@@ -0,0 +1,60 @@
+//Caption:Goodness of Fit Test
+//Example8.38
+//Page300
+//Ho: The given data follow an assumed distribution
+//H1: The given data do not follow the assumed distribution
+clear;
+clc;
+X = [0,1,2,3,4,5,6,7,8,9];//Arrival rate
+o = [2,4,8,14,7,5,4,3,2,1];//Observed frequencies
+for i = 1:length(X)
+ Xo(i)= X(i)*o(i);
+end
+Xioi = sum(Xo);
+N = sum(o);//total observed frequencies
+n = length(X);//number of demand values
+u = Xioi/N; //mean arrival rate
+for i = 1:length(X)
+ [P(i),Q(i)]=cdfpoi("PQ",X(i),u)
+end
+e = [1.24,4.57,8.46,10.44,9.65,7.14,4.41,2.33,1.08,0.44];//expected frequency of each
+for i = 1:n
+ Obser_Chi(i) = ((o(i)-e(i))^2)/e(i);
+end
+Tol_Obser_Chi = sum(Obser_Chi);
+Chi_stand = 16.919;
+disp(Tol_Obser_Chi,'The observed chi-square statistic=')
+disp(Chi_stand,'The table chi-square statistic=')
+if (Tol_Obser_Chi>Chi_stand) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+else
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+end
+//Result
+//The observed chi-square statistic=
+//
+// 4.8721893
+//
+// The table chi-square statistic=
+//
+// 16.919
+//
+// It falls in the Acceptance Region
+//
+// Then Null Hypothesis Ho should be Accepted
+//
+//-->Obser_Chi
+// Obser_Chi =
+//
+// 0.4658065
+// 0.0710941
+// 0.0250118
+// 1.2139464
+// 0.7277202
+// 0.6414006
+// 0.0381179
+// 0.1926609
+// 0.7837037
+// 0.7127273 \ No newline at end of file
diff --git a/331/CH8/EX8.4/Example_8_4.sce b/331/CH8/EX8.4/Example_8_4.sce
new file mode 100755
index 000000000..e331f9ee8
--- /dev/null
+++ b/331/CH8/EX8.4/Example_8_4.sce
@@ -0,0 +1,49 @@
+//One-tailed Tests Concerning Single Mean
+//(When the variance of the Population is Known and the Population is finite)
+//Example8.4
+//Page236
+//Test1: Ho:u<=k; H1:u>k
+clear
+clc;
+N = input('Enter the population size')
+u = input('Enter the Population Mean');
+Sigma2 = input('Enter the Populaion variance');
+std = sqrt(Sigma2); //standard deviation
+n = input('Enter the Sample Size');
+X = input('Enter the Sample Mean');
+alpha = input('Enter the significance level');
+Test = input('Enter the Type of test')
+//Calculation of Z statistic
+Zx = nor_dist_stat_finite_po(X,u,std,n,N)
+disp(Zx,'calculated Normal Z-statistic =')
+Z_alpha = standard_normal_zstat(alpha)
+disp(Z_alpha,'Standard Normal Stastistic=')
+if (Test==1) then
+ if(Zx < Z_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Zx > Z_alpha) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if (Zx > Z_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif (Zx < Z_alpha)then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the population size 1000
+//Enter the Population Mean 10000
+//Enter the Populaion variance 250000
+//Enter the Sample Size 81
+//Enter the Sample Mean 10250
+//Enter the significance level 0.05
+//Enter the Type of test 1
+//calculated Normal Z-statistic = 4.6917785
+//Standard Normal Stastistic= 1.64
+// It falls in the Rejection Region
+// Then Null Hypothesis Ho should be Rejected \ No newline at end of file
diff --git a/331/CH8/EX8.5/Example_8_5.sce b/331/CH8/EX8.5/Example_8_5.sce
new file mode 100755
index 000000000..c0a52dae2
--- /dev/null
+++ b/331/CH8/EX8.5/Example_8_5.sce
@@ -0,0 +1,53 @@
+//Caption:One-tailed Tests Concerning Single Mean
+//(When the variance of the Population is Known and the Population is finite)
+//Example8.5
+//Page238
+//Test2: Ho:u>=k; H1:u<k
+clear
+clc;
+N = input('Enter the population size')
+u = input('Enter the Population Mean');
+Sigma2 = input('Enter the Populaion variance');
+std = sqrt(Sigma2); //standard deviation
+n = input('Enter the Sample Size');
+X = input('Enter the Sample Mean');
+alpha = input('Enter the significance level');
+Test = input('Enter the Type of test')
+//Calculation of Z statistic
+Zx = nor_dist_stat_finite_po(X,u,std,n,N)
+disp(Zx,'calculated Normal Z-statistic =')
+Z_alpha = standard_normal_zstat(alpha)
+disp(Z_alpha,'Standard Normal Stastistic=')
+if(Test==1) then
+ if(Zx <= Z_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Zx > Z_alpha) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+ elseif(Test==2) then
+ if (Zx >=-Z_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif (Zx <-Z_alpha) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the population size 1000
+//Enter the Population Mean 8000
+//Enter the Populaion variance 160000
+//Enter the Sample Size 64
+//Enter the Sample Mean 7900
+//Enter the significance level 0.05
+//Enter the Type of test 2
+//
+// calculated Normal Z-statistic = - 2.0662117
+//
+// Standard Normal Stastistic= 1.64
+//It falls in the Rejection Region
+//
+// Then Null Hypothesis Ho should be Rejected
+// \ No newline at end of file
diff --git a/331/CH8/EX8.6/Example_8_6.sce b/331/CH8/EX8.6/Example_8_6.sce
new file mode 100755
index 000000000..71c9301e9
--- /dev/null
+++ b/331/CH8/EX8.6/Example_8_6.sce
@@ -0,0 +1,47 @@
+//Caption:Two-tailed Test Concerning Single Mean
+//(When the variance of the Population is Known and the Population is finite)
+//Example8.6
+//Page240
+//Test: Ho:u=k; H1:u!=k
+
+clc;
+N = input('Enter the population size')
+u = input('Enter the Population Mean');
+Sigma2 = input('Enter the Populaion variance');
+std = sqrt(Sigma2); //standard deviation
+n = input('Enter the Sample Size');
+X = input('Enter the Sample Mean');
+alpha = input('Enter the significance level');
+alpha = alpha/2;
+//Calculation of Z statistic
+Zx = nor_dist_stat_finite_po(X,u,std,n,N)
+disp(Zx,'calculated Normal Z-statistic =')
+Z_alpha = standard_normal_zstat(alpha)
+disp(Z_alpha,'Standard Normal Stastistic=')
+if ((-Z_alpha < Zx) &(Zx< Z_alpha)) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+else
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+end
+//Result
+//Enter the population size 1000
+//Enter the Population Mean 10000
+//Enter the Populaion variance 490000
+//Enter the Sample Size 36
+//Enter the Sample Mean 10250
+//Enter the significance level 0.01
+//
+// calculated Normal Z-statistic =
+//
+// 2.1814107
+//
+// Standard Normal Stastistic=
+//
+// 2.57
+//
+// It falls in the Acceptance Region
+//
+// Then Null Hypothesis Ho should be Accepted
+// \ No newline at end of file
diff --git a/331/CH8/EX8.7/Example_8_7.sce b/331/CH8/EX8.7/Example_8_7.sce
new file mode 100755
index 000000000..997e9c823
--- /dev/null
+++ b/331/CH8/EX8.7/Example_8_7.sce
@@ -0,0 +1,56 @@
+//One-tailed Tests Concerning Single Mean
+//(When the variance of the Population is UnKnown and the Sample size is Large)
+//Example8.7
+//Page242
+//Test1: Ho:u<=k; H1:u>k
+
+clc;
+u = input('Enter the Population Mean');
+Sigma2 = input('Enter the Sample variance');
+std = sqrt(Sigma2); //standard deviation
+n = input('Enter the Sample Size');
+X = input('Enter the Sample Mean');
+alpha = input('Enter the significance level');
+Test = input('Enter the Type of test')
+//Calculation of Z statistic
+Zx = nor_pop_unknown_large(X,u,std,n)
+disp(Zx,'calculated Normal Z-statistic =')
+Z_alpha = standard_normal_zstat(alpha)
+disp(Z_alpha,'Standard Normal Stastistic=')
+if (Test==1) then
+ if(Zx < Z_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Zx > Z_alpha) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if (Zx > Z_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif (Zx < Z_alpha)then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the Population Mean 5
+//Enter the Sample variance 1
+//Enter the Sample Size 81
+//Enter the Sample Mean 5.25
+//Enter the significance level 0.1
+//Enter the Type of test 1
+//
+// calculated Normal Z-statistic =
+//
+// 2.25
+//
+// Standard Normal Stastistic=
+//
+// 1.28
+//
+// It falls in the Rejection Region
+//
+// Then Null Hypothesis Ho should be Rejected
+// \ No newline at end of file
diff --git a/331/CH8/EX8.8/Example_8_8.sce b/331/CH8/EX8.8/Example_8_8.sce
new file mode 100755
index 000000000..2d9fe22b8
--- /dev/null
+++ b/331/CH8/EX8.8/Example_8_8.sce
@@ -0,0 +1,55 @@
+//One-tailed Tests Concerning Single Mean
+//(When the variance of the Population is UnKnown and the Sample size is Large)
+//Example8.8
+//Page244
+//Test2: Ho:u>=k; H1:u<k
+
+clc;
+u = input('Enter the Population Mean');
+Sigma2 = input('Enter the Sample variance');
+std = sqrt(Sigma2); //standard deviation
+n = input('Enter the Sample Size');
+X = input('Enter the Sample Mean');
+alpha = input('Enter the significance level');
+Test = input('Enter the Type of test')
+//Calculation of Z statistic
+Zx = nor_pop_unknown_large(X,u,std,n)
+disp(Zx,'calculated Normal Z-statistic =')
+Z_alpha = standard_normal_zstat(alpha)
+disp(Z_alpha,'Standard Normal Stastistic=')
+if (Test==1) then
+ if(Zx < Z_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Zx > Z_alpha) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if (Zx > Z_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif (Zx < Z_alpha)then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the Population Mean 50
+//Enter the Sample variance 0.64
+//Enter the Sample Size 64
+//Enter the Sample Mean 50.4
+//Enter the significance level 0.1
+//Enter the Type of test 2
+//
+// calculated Normal Z-statistic =
+//
+// 4.
+//
+// Standard Normal Stastistic=
+//
+// 1.28
+//
+// It falls in the Acceptance Region
+//
+// Then Null Hypothesis Ho should be Accepted \ No newline at end of file
diff --git a/331/CH8/EX8.9/Example_8_9.sce b/331/CH8/EX8.9/Example_8_9.sce
new file mode 100755
index 000000000..05111aed0
--- /dev/null
+++ b/331/CH8/EX8.9/Example_8_9.sce
@@ -0,0 +1,57 @@
+//One-tailed Tests Concerning Single Mean
+//(When the variance of the Population is UnKnown and the Sample size is Large)
+//Example8.9
+//Page245
+//Test2: Ho:u>=k; H1:u<k
+
+clc;
+N = input('Enter the Population size');
+u = input('Enter the Population Mean');
+Sigma2 = input('Enter the Sample variance');
+std = sqrt(Sigma2); //standard deviation
+n = input('Enter the Sample Size');
+X = input('Enter the Sample Mean');
+alpha = input('Enter the significance level');
+Test = input('Enter the Type of test')
+//Calculation of Z statistic
+Zx = nor_dist_stat_finite_po(X,u,std,n,N)
+disp(Zx,'calculated Normal Z-statistic =')
+Z_alpha = standard_normal_zstat(alpha)
+disp(Z_alpha,'Standard Normal Stastistic=')
+if (Test==1) then
+ if(Zx < Z_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif(Zx > Z_alpha) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+elseif (Test==2) then
+ if (Zx > -Z_alpha) then
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+ elseif (Zx <- Z_alpha)then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+ end
+end
+//Result
+//Enter the Population size 900
+//Enter the Population Mean 50
+//Enter the Sample variance 1.44
+//Enter the Sample Size 49
+//Enter the Sample Mean 49.8
+//Enter the significance level 0.1
+//Enter the Type of test 1
+//
+// calculated Normal Z-statistic =
+//
+// - 1.1991178
+//
+// Standard Normal Stastistic=
+//
+// 1.28
+//
+// It falls in the Acceptance Region
+//
+// Then Null Hypothesis Ho should be Accepted \ No newline at end of file
diff --git a/331/CH9/EX9.1/Example_9_1.sce b/331/CH9/EX9.1/Example_9_1.sce
new file mode 100755
index 000000000..da3e5cfc6
--- /dev/null
+++ b/331/CH9/EX9.1/Example_9_1.sce
@@ -0,0 +1,33 @@
+//Caption: One-Sample Tests
+//One-sample Sign Test for small samples
+//Example9.1
+//Page313
+//Test 1: Ho: p =1/2, H1: p>1/2
+clear;
+clc;
+n = 9;//sample size
+p = 0.5;
+q = 1-p;
+plus_signs = 7;
+minus_signs = 2;
+alpha = 0.05; //significance level
+//P(X>=7, n=9, p =0.5) =1-P(X<=6, n=9, p=0.5)
+X = 6;//Number plus signs is more than or equal to 7
+[P,Q]=cdfbin("PQ",X,n,p,q);
+disp(Q,'The binomial probability that the number of plus signs is >=7 is P(X>=7)=')
+if (Q>alpha) then
+ disp('Sine it is greater than significance level, the binomial statistic falls')
+ disp('in the acceptance region')
+else
+ disp('Since it is less than significance level, the binomial statistic falls')
+ disp('in the rejection region and the null hypothesis should be rejected')
+end
+//Result
+//The binomial probability that the number of plus signs is >=7 is P(X>=7)=
+//
+// 0.0898438
+//
+// Sine it is greater than significance level, the binomial statistic falls
+//
+// in the acceptance region
+// \ No newline at end of file
diff --git a/331/CH9/EX9.10/Example_9_10.sce b/331/CH9/EX9.10/Example_9_10.sce
new file mode 100755
index 000000000..c5b03969a
--- /dev/null
+++ b/331/CH9/EX9.10/Example_9_10.sce
@@ -0,0 +1,58 @@
+//Caption:Run Test for Randomness
+//Example9.10
+//Page325
+//run test of randomness of small samples
+//Ho: The occurrence of the runs of the given stream of symbols (M,F) is random
+//H1: The occurrence of the runs of the given stream of symbols (M,F) is not random
+clear;
+clc;
+X = ['M','M','F','F','F','M','M','M','F','F','F','M','F','M','M','M','M','F','F'];
+N = sum(length(X));
+n1 = 0;
+n2 = 0;
+r = 0;
+ind1 = 0;
+c1 = 0;
+ind2 = 0;
+c2 = 0;
+for i = 1:N
+ if(X(i)=='M')
+ n1 = n1+1;
+ elseif(X(i)=='F')
+ n2 = n2+1;
+ end
+ if (i~=N) then
+ if((X(i)=='M')&(X(i+1)=='F'))
+ r = r+1;
+ elseif((X(i)=='F')&(X(i+1)=='M'))
+ r= r+1;
+ end
+ else
+ r = r+1;
+ end
+end
+disp(n1,'Frequency of occurrence of letter M, n1=');
+disp(n2,'Frequency of occurrence of letter N, n2=');
+disp(r,'Number of runs, rcal =')
+alpha = 0.05;//significance level
+c1 = 5;//smaller critical value for the given combination at alpha =0.05;
+c2 = 16; //larger critical value for the given combination at alpha =0.05;
+if (c1<r) &(r<c2) then
+ disp('Accept Null Hypotheis Ho')
+else
+ disp("Reject Null Hypothesis Ho')
+end
+//Result
+//Frequency of occurrence of letter M, n1=
+//
+// 10.
+//
+// Frequency of occurrence of letter N, n2=
+//
+// 9.
+//
+// Number of runs, rcal =
+//
+// 8.
+//
+// Accept Null Hypotheis Ho
diff --git a/331/CH9/EX9.11/Example_9_11.sce b/331/CH9/EX9.11/Example_9_11.sce
new file mode 100755
index 000000000..03ce9df0f
--- /dev/null
+++ b/331/CH9/EX9.11/Example_9_11.sce
@@ -0,0 +1,51 @@
+//Caption:Run Test for Randomness
+//Example9.11
+//Page326
+//run test of randomness of large samples
+//Ho: The occurrence of the runs of the given stream of symbols (W,L) is random
+//H1: The occurrence of the runs of the given stream of symbols (W,L) is not random
+
+clc;
+n1 = 24; //Frequency of occurrence of letter 'W'
+n2 = 16; //Frequency of occurrence of letter 'L'
+r = 17;//number or runs
+alpha = 0.05;//significance level
+alpha = alpha/2;
+Mean_r = ((2*n1*n2)/(n1+n2))+1;
+Var_r = (2*n1*n2)*(2*n1*n2-n1-n2)/(((n1+n2)^2)*(n1+n2-1));
+Std = sqrt(Var_r);
+Z_calc = (r-Mean_r)/Std;
+Z_Stand = standard_normal_zstat(alpha);
+disp(Mean_r,'Mean of r u =')
+disp(Var_r,'variance of r =')
+disp(Std,'Standard deviation of r =')
+disp(Z_calc,'Calculated Z value = ')
+disp(Z_Stand,'Standard z value from table=')
+if (Z_calc>-Z_Stand)&(Z_calc<Z_Stand) then
+ disp('Since calculated Z value lies in between -Z and + Z from table value Accept Null Hypotheis Ho')
+else
+ disp("Reject Null Hypothesis Ho')
+end
+//Result
+//Mean of r u =
+//
+// 20.2
+//
+// variance of r =
+//
+// 8.96
+//
+// Standard deviation of r =
+//
+// 2.9933259
+//
+// Calculated Z value =
+//
+// - 1.069045
+//
+// Standard z value from table=
+//
+// 1.96
+//
+// Since calculated Z value lies in between -Z and + Z from table value Accept Null Hypotheis Ho
+// \ No newline at end of file
diff --git a/331/CH9/EX9.12/Example_9_12.sce b/331/CH9/EX9.12/Example_9_12.sce
new file mode 100755
index 000000000..43c1eac7c
--- /dev/null
+++ b/331/CH9/EX9.12/Example_9_12.sce
@@ -0,0 +1,31 @@
+//Caption: Two-Samples Tests
+//One-tailed two-samples sign tests with binomial distribution
+//Example9.12
+//Page330
+//Test 1: Ho: uX = uY or p = 1/2
+// H1: uX> uY or p > 1/2
+clear;
+clc;
+n = 9; //Number of observations of each sample
+plus_signs = 6;
+minus_signs = 3;
+alpha = 0.05; //significance level
+X = 5;////number of plus signs more than minus signs
+p = 1/2;
+q = 1-p;
+[P,Q]=cdfbin("PQ",X,n,p,q);
+disp(Q,'The binomial propability no. of plus signs > minus signs P(X>=6)=')
+if (Q>alpha) then
+ disp('Since P(Q>=6) is more than the significance level of 0.05')
+ disp('It falls in the acceptance region and accpt Ho')
+else
+ disp('Reject Null Hypothesis Ho')
+end
+//Result
+//The binomial propability no. of plus signs > minus signs P(X>=6)=
+//
+// 0.2539063
+//
+// Since P(Q>=6) is more than the significance level of 0.05
+//
+// It falls in the acceptance region and accpt Ho \ No newline at end of file
diff --git a/331/CH9/EX9.13/Example_9_13.sce b/331/CH9/EX9.13/Example_9_13.sce
new file mode 100755
index 000000000..ff37ab476
--- /dev/null
+++ b/331/CH9/EX9.13/Example_9_13.sce
@@ -0,0 +1,31 @@
+//Caption: Two-Samples Tests
+//Two-tailed two-samples sign test with binomial distribution
+//Example9.13
+//Page331
+//Test : Ho: uX = uY or p = 1/2
+// H1: uX # uY or p # 1/2
+clear;
+clc;
+n = 8; //Number of observations of each sample
+plus_signs = 6;
+minus_signs = 2;
+alpha = 0.05; //significance level
+X = 5;//number of plus signs more than minus signs
+p = 1/2;
+q = 1-p;
+[P,Q]=cdfbin("PQ",X,n,p,q);
+disp(Q,'The binomial propability no. of plus signs > minus signs P(X>=6)=')
+if (Q>alpha) then
+ disp('Since P(Q>=6) is more than the significance level of 0.05')
+ disp('It falls in the acceptance region and accpt Ho')
+else
+ disp('Reject Null Hypothesis Ho')
+end
+//Result
+//The binomial propability no. of plus signs > minus signs P(X>=6)=
+//
+// 0.1445313
+//
+// Since P(Q>=6) is more than the significance level of 0.05
+//
+// It falls in the acceptance region and accpt Ho \ No newline at end of file
diff --git a/331/CH9/EX9.14/Example_9_14.sce b/331/CH9/EX9.14/Example_9_14.sce
new file mode 100755
index 000000000..6f1c7d104
--- /dev/null
+++ b/331/CH9/EX9.14/Example_9_14.sce
@@ -0,0 +1,40 @@
+//Caption:Two-Samples Tests
+//One-tailed two-samples sign test with normal approximation
+//Example9.14
+//page333
+//Test 1: Ho: uX = uY or p = 1/2
+// H1: uX > uY or p > 1/2
+
+clc;
+n =14; //Number of observations of each sample
+plus_signs = 11;
+minus_signs = 3;
+alpha = 0.05; //significance level
+p = 1/2;
+q = 1-p;
+u = n*p; // its mean
+Var = n*p*q; //its variance
+Std = sqrt(Var);
+Z_Calc = (plus_signs-u)/Std;
+Z_Stand = standard_normal_zstat(alpha);
+disp(Z_Calc,'Calculated Z value Zcal=')
+disp(Z_Stand,'Standard Z statistic Zstand =')
+if (Z_Calc < Z_Stand)
+ disp('Since the calculated z value is less than standard z value')
+ disp('Accept Null Hypothesis Ho')
+else
+ disp('Since the calculated z value is greater than standard z value')
+ disp('Reject Null Hypothesis Ho')
+end
+//Result
+//Calculated Z value Zcal=
+//
+// 2.1380899
+//
+// Standard Z statistic Zstand =
+//
+// 1.64
+//
+// Since the calculated z value is greater than standard z value
+//
+// Reject Null Hypothesis Ho \ No newline at end of file
diff --git a/331/CH9/EX9.15/Example_9_15.sce b/331/CH9/EX9.15/Example_9_15.sce
new file mode 100755
index 000000000..16eaf464d
--- /dev/null
+++ b/331/CH9/EX9.15/Example_9_15.sce
@@ -0,0 +1,40 @@
+//Caption:Two-Samples Tests
+//One-tailed two-samples sign test with normal approximation
+//Example9.15
+//page334
+//Test 2: Ho: uX = uY or p = 1/2
+// H1: uX < uY or p < 1/2
+
+clc;
+n =14; //Number of observations of each sample
+plus_signs = 4;
+minus_signs = 10;
+alpha = 0.1; //significance level
+p = 1/2;
+q = 1-p;
+u = n*p; // its mean
+Var = n*p*q; //its variance
+Std = sqrt(Var);
+Z_Calc = (plus_signs-u)/Std;
+Z_Stand = standard_normal_zstat(alpha);
+disp(Z_Calc,'Calculated Z value Zcal=')
+disp(Z_Stand,'Standard Z statistic Zstand =')
+if (Z_Calc > -Z_Stand)
+ disp('Since the calculated z value is greater than standard z value')
+ disp('Accept Null Hypothesis Ho')
+else
+ disp('Since the calculated z value is less than standard z value')
+ disp('Reject Null Hypothesis Ho')
+end
+//Result
+//Calculated Z value Zcal=
+//
+// - 1.6035675
+//
+// Standard Z statistic Zstand =
+//
+// 1.28
+//
+// Since the calculated z value is less than standard z value
+//
+// Reject Null Hypothesis Ho \ No newline at end of file
diff --git a/331/CH9/EX9.16/Example_9_16.sce b/331/CH9/EX9.16/Example_9_16.sce
new file mode 100755
index 000000000..e78f1f07c
--- /dev/null
+++ b/331/CH9/EX9.16/Example_9_16.sce
@@ -0,0 +1,41 @@
+//Caption:Two-Samples Tests
+//Two-tailed two-samples sign test with normal approximation
+//Example9.16
+//page336
+//Test 2: Ho: uX = uY or p = 1/2
+// H1: uX # uY or p # 1/2
+
+clc;
+n = 20; //Number of observations of each sample
+plus_signs = 7;
+minus_signs = 13;
+alpha = 0.1; //significance level
+alpha = alpha/2;
+p = 1/2;
+q = 1-p;
+u = n*p; // its mean
+Var = n*p*q; //its variance
+Std = sqrt(Var);
+Z_Calc = (plus_signs-u)/Std;
+Z_Stand = standard_normal_zstat(alpha);
+disp(Z_Calc,'Calculated Z value Zcal=')
+disp(Z_Stand,'Standard Z statistic Zstand =')
+if (Z_Calc > -Z_Stand) & (Z_Calc < Z_Stand)
+ disp('Since the calculated z value is lies in between -Zalpha<Zcal<Zalpha')
+ disp('Accept Null Hypothesis Ho')
+else
+ disp('Since the calculated z value falls in the rejection region')
+ disp('Reject Null Hypothesis Ho')
+end
+//Result
+//Calculated Z value Zcal=
+//
+// - 1.3416408
+//
+// Standard Z statistic Zstand =
+//
+// 1.64
+//
+// Since the calculated z value is lies in between -Zalpha<Zcal<Zalpha
+//
+// Accept Null Hypothesis Ho \ No newline at end of file
diff --git a/331/CH9/EX9.17/Example_9_17.sce b/331/CH9/EX9.17/Example_9_17.sce
new file mode 100755
index 000000000..64266a499
--- /dev/null
+++ b/331/CH9/EX9.17/Example_9_17.sce
@@ -0,0 +1,63 @@
+//Caption: Two-samples Medain Test
+//Example9.17
+//Page339
+clear;
+clc;
+n1 = 7;//size of the first sample
+n2 = 6;//size of the second sample
+N = n1+n2;//size of the pooled obsrevations
+alpha = 0.05;//significance level
+S1 = [20,25,41,35,60,40,28];//sample 1:increased warranty period
+S2 = [23,27,30,42,56,48];//sample 2: Increased price discount
+X = [S1,S2];//increased warranty period & Increased price discount
+Xsort = gsort(X,'g','i');
+u = median(Xsort);
+disp(Xsort,'The pooled observations in the increasing order are:')
+disp(u,'The median of the pooled observations u =')
+p1 = 0;
+p2 = 0;
+for i = 1:length(S1)
+ if (S1(i)>u) then
+ p1 = p1+1;
+ elseif(S1(i)<=u)
+ p2 = p2+1;
+ end
+end
+
+p3 = 0;
+p4 = 0;
+for i = 1:length(S2)
+ if (S2(i)>u) then
+ p3 = p3+1;
+ elseif(S2(i)<=u)
+ p4 = p4+1;
+ end
+end
+p = [p1,p3;p2,p4]
+v1 = factorial(n1)/((factorial(n1-p1))*(factorial(p1)));
+v2 = factorial(n2)/((factorial(n2-p3))*(factorial(p3)));
+v3 = factorial(n1+n2)/((factorial(n1+n2-(p1+p3)))*(factorial(p1+p3)));;
+P = (v1*v2)/v3;
+disp(P,'calculated P value =')
+if (P>alpha) then
+ disp('Since the calculated probability is more than the significance level')
+ disp('Accept the Null Hypothesis')
+else
+ disp('Reject Null Hypothesis')
+end
+//Result
+//The pooled observations in the increasing order are:
+//
+// 20. 23. 25. 27. 28. 30. 35. 40. 41. 42. 48. 56. 60.
+//
+// The median of the pooled observations u =
+//
+// 35.
+//
+// calculated P value =
+//
+// 0.4079254
+//
+// Since the calculated probability is more than the significance level
+//
+// Accept the Null Hypothesis \ No newline at end of file
diff --git a/331/CH9/EX9.18/Example_9_18.sce b/331/CH9/EX9.18/Example_9_18.sce
new file mode 100755
index 000000000..1ba7ac1ce
--- /dev/null
+++ b/331/CH9/EX9.18/Example_9_18.sce
@@ -0,0 +1,77 @@
+//Caption: Two-samples Medain Test (Large Samples)
+//Example9.18
+//Page340
+clear;
+clc;
+S1 = [25,30,46,40,65,45,33,35,41,51,64,66,77,82,96,68];//sample 1:Catalyst X
+S2 = [28,32,42,47,62,53,29,34,54,57,63,70,80,78,93];//sample 2: Catalyst Y
+n1 = length(S1);//size of the first sample
+n2 = length(S2);//size of the second sample
+N = n1+n2;//size of the pooled obsrevations
+alpha = 0.05;//significance level
+X = [S1,S2];//increased warranty period & Increased price discount
+Xsort = gsort(X,'g','i');
+u = median(Xsort);
+disp(Xsort,'The pooled observations in the increasing order are:')
+disp(u,'The median of the pooled observations u =')
+p = 0;
+r = 0;
+for i = 1:length(S1)
+ if (S1(i)>u) then
+ p = p+1;
+ elseif(S1(i)<=u)
+ r = r+1;
+ end
+end
+
+q = 0;
+s = 0;
+for i = 1:length(S2)
+ if (S2(i)>u) then
+ q = q+1;
+ elseif(S2(i)<=u)
+ s = s+1;
+ end
+end
+P = [p,q;r,s]
+disp(P,'Table. Frequency of pooled observations')
+chi_calc = (N*(abs(p*s-q*r)-(N/2))^2)/((p+q)*(r+s)*(p+r)*(q+s));
+chi_table = 3.841;//chi-square value for 1 degree of freedom and alpha = 0.05
+disp(chi_calc,'calculated chi-square value =')
+disp(chi_table,'chi-square table value=')
+if (chi_calc < chi_table) then
+ disp('Since the calculated chi-square value is less than the table value')
+ disp('Accept the Null Hypothesis')
+else
+ disp('Reject Null Hypothesis')
+end
+//Result
+//The pooled observations in the increasing order are:
+// column 1 to 17
+//
+// 25. 28. 29. 30. 32. 33. 34. 35. 40. 41. 42. 45. 46. 47. 51. 53. 54.
+//
+// column 18 to 31
+//
+// 57. 62. 63. 64. 65. 66. 68. 70. 77. 78. 80. 82. 93. 96.
+//
+// The median of the pooled observations u =
+//
+// 53.
+//
+// Table. Frequency of pooled observations
+//
+// 7. 8.
+// 9. 7.
+//
+// calculated chi-square value =
+//
+// 0.0302734
+//
+// chi-square table value=
+//
+// 3.841
+//
+// Since the calculated chi-square value is less than the table value
+//
+// Accept the Null Hypothesis \ No newline at end of file
diff --git a/331/CH9/EX9.19/Example_9_19.sce b/331/CH9/EX9.19/Example_9_19.sce
new file mode 100755
index 000000000..4cee24f24
--- /dev/null
+++ b/331/CH9/EX9.19/Example_9_19.sce
@@ -0,0 +1,224 @@
+//Caption:Mann-Whitney U Test
+//Example9.19
+//Page342
+//Ho: Two samples are drawn from different populations having the same distribution
+//H1: The mean performance ratings of the programmers from the population of the
+//Branch-1 is stochastically larger than that of the programmers from the population
+//of the Branch-2
+//Rule for decision making: If the calculated ZU is more than Zalpha, then reject Ho
+//otherwise accept Ho
+
+clc;
+X1 = [87,76,57,50,43,73,40,90,75,85,91,68,73,79,59,50,35,82,73,66];//Performance indices of branch-1
+X2 = [78,55,92,71,25,62,45,77,34,50,83,97,53,89,74,30,54,32];//performance indices of branch-2
+X= [X1,X2];//
+n1 = length(X1);
+n2 = length(X2);
+N = length(X);
+[X_sort,ind] = gsort(X,'g','i');
+disp(ind,'Rank:');
+disp(X_sort,'Index:')
+j = 1;
+for i = 1:N
+ R(i)=i;
+ if (i~=N) then
+ if (X_sort(i)==X_sort(i+1)) then
+ K(j)=i;
+ j = j+1;
+ elseif (i>1)&(X_sort(i)==X_sort(i-1))
+ K(j)= i;
+ j = j+1;
+ end
+ end
+end
+for i = 1:length(K)
+ if (i<=floor(length(K)/2)) then
+ R(K(i))= sum(K([1:floor(length(K)/2)]))/floor(length(K)/2);
+ elseif(i>floor(length(K)/2))
+ R(K(i))= sum(K([floor(length(K)/2)+1:length(K)]))/floor(length(K)/2);
+ end
+end
+disp(R,'Revised Rank')
+for i =1:N
+ for j= 1:n1
+ if(X_sort(i)==X1(j))
+ R_S1(j) = R(i);
+ elseif (j<=n2)&(X_sort(i)==X2(j))
+ R_S2(j) = R(i);
+ end
+ end
+end
+R_S1 = gsort(R_S1,'g','i');
+disp(R_S1,'Ranks of Sample-1=');
+R_S2 = gsort(R_S2,'g','i');
+disp(R_S2,'Ranks of Sample-2=');
+Sum_R_S1 = sum(R_S1);
+disp(Sum_R_S1,'The sum of the ranks of the sample-1')
+Sum_R_S2 = sum(R_S2);
+disp(Sum_R_S2,'The sum of the ranks of the sample-2')
+U = n1*n2+(n1*(n1+1)/2)-Sum_R_S1;
+disp(U,'U=')
+uU = n1*n2/2; //mean
+disp(uU,'Mean uU=')
+sigU = n1*n2*(n1+n2+1)/12; //variance
+disp(sigU,'variance =')
+Std = sqrt(sigU);
+disp(Std,'Standard Deviation=')
+ZU = (U-uU)/Std;
+alpha = 0.05;//significance level
+Z_stand = standard_normal_zstat(alpha);
+disp(ZU,'Calculated Z statistic ZU=')
+disp(Z_stand,'Standard normal z statistic Z_Stand=')
+if (ZU < Z_stand)
+ disp('Since the computed ZU is less than Zalpha, accept the Null hypothesis')
+else
+ disp('Reject the Null hypothesis')
+end
+//Result
+// Rank:
+// column 1 to 17
+//
+// 25. 36. 38. 29. 17. 7. 5. 27. 4. 16. 30. 33. 37. 22. 3. 15. 26.
+//
+// column 18 to 34
+//
+// 20. 12. 24. 6. 13. 19. 35. 9. 2. 28. 21. 14. 18. 31. 10. 1. 34.
+//
+// column 35 to 38
+//
+// 8. 11. 23. 32.
+//
+// Index:
+//
+//
+// column 1 to 17
+//
+// 25. 30. 32. 34. 35. 40. 43. 45. 50. 50. 50. 53. 54. 55. 57. 59. 62.
+//
+// column 18 to 34
+//
+// 66. 68. 71. 73. 73. 73. 74. 75. 76. 77. 78. 79. 82. 83. 85. 87. 89.
+//
+// column 35 to 38
+//
+// 90. 91. 92. 97.
+//
+// Revised Rank
+//
+// 1.
+// 2.
+// 3.
+// 4.
+// 5.
+// 6.
+// 7.
+// 8.
+// 10.
+// 10.
+// 10.
+// 12.
+// 13.
+// 14.
+// 15.
+// 16.
+// 17.
+// 18.
+// 19.
+// 20.
+// 22.
+// 22.
+// 22.
+// 24.
+// 25.
+// 26.
+// 27.
+// 28.
+// 29.
+// 30.
+// 31.
+// 32.
+// 33.
+// 34.
+// 35.
+// 36.
+// 37.
+// 38.
+//
+// Ranks of Sample-1=
+//
+// 5.
+// 6.
+// 7.
+// 10.
+// 10.
+// 15.
+// 16.
+// 18.
+// 19.
+// 22.
+// 22.
+// 22.
+// 25.
+// 26.
+// 29.
+// 30.
+// 32.
+// 33.
+// 35.
+// 36.
+//
+// Ranks of Sample-2=
+//
+// 1.
+// 2.
+// 3.
+// 4.
+// 8.
+// 10.
+// 12.
+// 13.
+// 14.
+// 17.
+// 20.
+// 24.
+// 27.
+// 28.
+// 31.
+// 34.
+// 37.
+// 38.
+//
+// The sum of the ranks of the sample-1
+//
+// 418.
+//
+// The sum of the ranks of the sample-2
+//
+// 323.
+//
+// U=
+//
+// 152.
+//
+// Mean uU=
+//
+// 180.
+//
+// variance =
+//
+// 1170.
+//
+// Standard Deviation=
+//
+// 34.205263
+//
+// Calculated Z statistic ZU=
+//
+// - 0.8185875
+//
+// Standard normal z statistic Z_Stand=
+//
+// 1.64
+//
+// Since the computed ZU is less than Zalpha, accept the Null hypothesis
+ \ No newline at end of file
diff --git a/331/CH9/EX9.2/Example_9_2.sce b/331/CH9/EX9.2/Example_9_2.sce
new file mode 100755
index 000000000..1f4820594
--- /dev/null
+++ b/331/CH9/EX9.2/Example_9_2.sce
@@ -0,0 +1,32 @@
+//Caption: One-Sample Tests
+//One-sample Sign Test for small samples
+//Example9.2
+//Page313
+//Test 2: Ho: p =1/2, H1: p< 1/2
+clear;
+clc;
+n = 8;//sample size
+p =0.5;
+q = 1-p;
+alpha = 0.05;//significance level
+plus_signs = 2;
+minus_signs = 7;
+//The binomial probability that the number of plus signs <=2
+X =2;
+[P,Q]=cdfbin("PQ",X,n,p,q);
+disp(P,'The binomial probability that the number of plus signs P(X<=2)=')
+if (P>alpha) then
+ disp('Sine it is greater than significance level, the binomial statistic falls')
+ disp('in the acceptance region')
+else
+ disp('Since it is less than significance level, the binomial statistic falls')
+ disp('in the rejection region and the null hypothesis should be rejected')
+end
+//Result
+//The binomial probability that the number of plus signs P(X<=2)=
+//
+// 0.1445313
+//
+// Sine it is greater than significance level, the binomial statistic falls
+//
+// in the acceptance region \ No newline at end of file
diff --git a/331/CH9/EX9.20/Example_9_20.sce b/331/CH9/EX9.20/Example_9_20.sce
new file mode 100755
index 000000000..416ce775d
--- /dev/null
+++ b/331/CH9/EX9.20/Example_9_20.sce
@@ -0,0 +1,111 @@
+//Caption:Mann-Whitney U Test
+//Example9.20
+//Page344
+//Ho: Two samples are drawn from identical populaions
+//H1: Two samples are not drawn from indentical populations
+//Rule for decision making: If the calculated ZU is less than -Zalpha/2 or more than
+//+Zalpha/2, then reject Ho
+//otherwise accept Ho
+
+clc;
+X1 = [94,77,64,88,65,55,75,93,62,68,83,73,90,60,63];//capacity utilization of machine-1 in %
+X2 = [78,95,54,71,91,56,82,92,97,84,53,61,98,87];//capacity utilization of machine-2 in %
+X= [X1,X2];//
+n1 = length(X1);
+n2 = length(X2);
+N = length(X);
+[X_sort,ind] = gsort(X,'g','i');
+disp(X_sort,'Index:')
+R = ind;
+for i =1:N
+ R(i)=i;
+ for j= 1:n1
+ if(X_sort(i)==X1(j))
+ R_S1(j) = R(i);
+ elseif (j<=n2)&(X_sort(i)==X2(j))
+ R_S2(j) = R(i);
+ end
+ end
+end
+disp(R,'Rank')
+R_S1 = gsort(R_S1,'g','i');
+disp(R_S1,'Ranks of Sample-1=');
+R_S2 = gsort(R_S2,'g','i');
+disp(R_S2,'Ranks of Sample-2=');
+Sum_R_S1 = sum(R_S1);
+disp(Sum_R_S1,'The sum of the ranks of the sample-1')
+Sum_R_S2 = sum(R_S2);
+disp(Sum_R_S2,'The sum of the ranks of the sample-2')
+U = n1*n2+(n1*(n1+1)/2)-Sum_R_S1;
+disp(U,'U=')
+uU = n1*n2/2; //mean
+disp(uU,'Mean uU=')
+sigU = n1*n2*(n1+n2+1)/12; //variance
+disp(sigU,'variance =')
+Std = sqrt(sigU);
+disp(Std,'Standard Deviation=')
+ZU = (U-uU)/Std;
+alpha = 0.1;//significance level
+alpha = alpha/2;
+Z_stand = standard_normal_zstat(alpha);
+disp(ZU,'Calculated Z statistic ZU=')
+disp(Z_stand,'Standard normal z statistic Z_Stand=')
+if (-Z_stand< ZU)&(ZU < Z_stand)
+ disp('Since the computed ZU is lies in between -Zalpha and + Zalpha, accept the Null hypothesis')
+else
+ disp('Reject the Null hypothesis')
+end
+//Result
+// Index:
+// column 1 to 17
+// 53. 54. 55. 56. 60. 61. 62. 63. 64. 65. 68. 71. 73. 75. 77. 78. 82.
+// column 18 to 29
+// 83. 84. 87. 88. 90. 91. 92. 93. 94. 95. 97. 98.
+// Rank
+// column 1 to 18
+// 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. column 19 to 29
+// 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29.
+// Ranks of Sample-1=
+// 3.
+// 5.
+// 7.
+// 8.
+// 9.
+// 10.
+// 11.
+// 13.
+// 14.
+// 15.
+// 18.
+// 21.
+// 22.
+// 25.
+// 26.
+//
+// Ranks of Sample-2=
+// 1.
+// 2.
+// 4.
+// 6.
+// 12.
+// 16.
+// 17.
+// 19.
+// 20.
+// 23.
+// 24.
+// 27.
+// 28.
+// 29.
+//
+// The sum of the ranks of the sample-1
+// 207.
+// The sum of the ranks of the sample-2
+// 228.
+// U= 123.
+// Mean uU= 105.
+// variance = 525.
+// Standard Deviation= 22.912878
+// Calculated Z statistic ZU= 0.7855844
+// Standard normal z statistic Z_Stand= 1.64
+// Since the computed ZU is lies in between -Zalpha and + Zalpha, accept the Null hypothesis \ No newline at end of file
diff --git a/331/CH9/EX9.21/Example_9_21.sce b/331/CH9/EX9.21/Example_9_21.sce
new file mode 100755
index 000000000..f57642e4d
--- /dev/null
+++ b/331/CH9/EX9.21/Example_9_21.sce
@@ -0,0 +1,85 @@
+//Caption:K-Samples Tests
+//K-samples Median Test
+//Example9.21
+//Page347
+//Ho: There is no significant difference between the percentagge absenteeism of the
+//employees in different months
+//H1: There is significant difference between the percentage absenteeism of the
+//employees in different months
+clear;
+clc;
+X1 = [10,15,8,20,19];//Percentage absenteeism of employees for January month
+X2 = [18,25,16,17,11];//Percentage absenteeism of employees for February month
+X3 = [13,21,26,14,7];//Percentage absenteeism of employees for march month
+n1 = length(X1);//size of the first sample
+n2 = length(X2);//size of the second sample
+n3 = length(X3);//size of the third sample
+N = n1+n2+n3;//size of the pooled observations
+alpha = 0.05;//significance level
+X = [X1,X2,X3];
+Xsort = gsort(X,'g','i');
+u = median(Xsort);
+disp(Xsort,'The pooled observations in the increasing order are:')
+disp(u,'The median of the pooled observations u =')
+p1 = 0;
+q1 = 0;
+for i = 1:length(X1)
+ if (X1(i)>u) then
+ p1 = p1+1;
+ elseif(X1(i)<=u)
+ q1 = q1+1;
+ end
+end
+p2 = 0;
+q2 = 0;
+for i = 1:length(X2)
+ if (X2(i)>u) then
+ p2 = p2+1;
+ elseif(X2(i)<=u)
+ q2 = q2+1;
+ end
+end
+p3 = 0;
+q3 = 0;
+for i = 1:length(X3)
+ if (X3(i)>u) then
+ p3 = p3+1;
+ elseif(X3(i)<=u)
+ q3 = q3+1;
+ end
+end
+p = [p1,p2,p3;q1,q2,q3]
+disp(p,'Frequency of pooled observations');
+v1 = factorial(n1)/((factorial(n1-p1))*(factorial(p1)));
+v2 = factorial(n2)/((factorial(n2-p2))*(factorial(p2)));
+v3 = factorial(n3)/((factorial(n3-p3))*(factorial(p3)));
+v4 = factorial(N)/((factorial(N-(p1+p2+p3)))*(factorial(p1+p2+p3)));
+P = (v1*v2*v3)/v4;
+disp(P,'calculated Probability value =')
+if (P>alpha) then
+ disp('Since the calculated probability is more than the significance level')
+ disp('Accept the Null Hypothesis')
+else
+ disp('Reject Null Hypothesis')
+end
+////Result
+//The pooled observations in the increasing order are:
+//
+// 7. 8. 10. 11. 13. 14. 15. 16. 17. 18. 19. 20. 21. 25. 26.
+//
+// The median of the pooled observations u =
+//
+// 16.
+//
+// Frequency of pooled observations
+//
+// 2. 3. 2.
+// 3. 2. 3.
+//
+// calculated Probability value =
+//
+// 0.1554002
+//
+// Since the calculated probability is more than the significance level
+//
+// Accept the Null Hypothesis \ No newline at end of file
diff --git a/331/CH9/EX9.22/Example_9_22.sce b/331/CH9/EX9.22/Example_9_22.sce
new file mode 100755
index 000000000..6b4cb3ace
--- /dev/null
+++ b/331/CH9/EX9.22/Example_9_22.sce
@@ -0,0 +1,123 @@
+//Caption:K-Samples Tests
+//K-samples Median Test
+//Example9.22
+//Page349
+//Ho: There is no significant difference between the ages of respondents in three regions
+//H1: There is significant difference between the ages of respondents in three regions
+clear;
+clc;
+X1 = [35,42,28,31,44,50,33,52,56];//Age of Respondents in Region-1
+X2 = [45,55,32,47,53,46,41,34,49];//Age of Respondents in Region-2
+X3 = [38,36,43,30,60,39,54,57,27];//Age of Respondents in Region-3
+n1 = length(X1);//size of the first sample
+n2 = length(X2);//size of the second sample
+n3 = length(X3);//size of the third sample
+N = n1+n2+n3;//size of the pooled observations
+alpha = 0.05;//significance level
+X = [X1,X2,X3];
+Xsort = gsort(X,'g','i');
+u = median(Xsort);
+disp(Xsort,'The pooled observations in the increasing order are:')
+disp(u,'The median of the pooled observations u =')
+p1 = 0;
+q1 = 0;
+for i = 1:length(X1)
+ if (X1(i)>u) then
+ p1 = p1+1;
+ elseif(X1(i)<=u)
+ q1 = q1+1;
+ end
+end
+p2 = 0;
+q2 = 0;
+for i = 1:length(X2)
+ if (X2(i)>u) then
+ p2 = p2+1;
+ elseif(X2(i)<=u)
+ q2 = q2+1;
+ end
+end
+p3 = 0;
+q3 = 0;
+for i = 1:length(X3)
+ if (X3(i)>u) then
+ p3 = p3+1;
+ elseif(X3(i)<=u)
+ q3 = q3+1;
+ end
+end
+p = [p1,p2,p3;q1,q2,q3]
+disp(p,'Frequency of pooled observations');
+//v1 = factorial(n1)/((factorial(n1-p1))*(factorial(p1)));
+//v2 = factorial(n2)/((factorial(n2-p2))*(factorial(p2)));
+//v3 = factorial(n3)/((factorial(n3-p3))*(factorial(p3)));
+//v4 = factorial(N)/((factorial(N-(p1+p2+p3)))*(factorial(p1+p2+p3)));
+//P = (v1*v2*v3)/v4;
+//disp(P,'calculated Probability value =')
+[r,c] = size(p);
+for i = 1:r
+ for j = 1:c
+ Row_Tot(i) = sum(p(i,:));
+ Col_Tot(j) = sum(p(:,j));
+ e(i,j) = (Row_Tot(i)* Col_Tot(j))/N;
+ end
+end
+disp(Row_Tot,'Row Total=')
+disp(Col_Tot','Column Total=')
+chi = 0;
+for i = 1:r
+ for j =1:c
+ chi= chi+(((p(i,j)-e(i,j))^2)/(e(i,j)));
+ end
+end
+disp(chi,'The Chi-square Statistic value =')
+Chi_stand = 5.991;//for 2 degrees of freedom and significance level = 0.05
+disp(Chi_stand,'The table Chi-Square statistic for 2 degrees of freedom & alpha =0.05')
+if (chi < Chi_stand) then
+ disp('Since the calculated Chi-square statistic is less than table value')
+ disp('Accept the Null Hypothesis')
+else
+ disp('Reject Null Hypothesis')
+end
+//Result
+
+// The pooled observations in the increasing order are:
+//
+//
+// column 1 to 17
+//
+// 27. 28. 30. 31. 32. 33. 34. 35. 36. 38. 39. 41. 42. 43. 44. 45. 46.
+//
+// column 18 to 27
+//
+// 47. 49. 50. 52. 53. 54. 55. 56. 57. 60.
+//
+// The median of the pooled observations u =
+//
+// 43.
+//
+// Frequency of pooled observations
+//
+// 4. 6. 3.
+// 5. 3. 6.
+//
+// Row Total=
+//
+// 13.
+// 14.
+//
+// Column Total=
+//
+// 9. 9. 9.
+//
+// The Chi-square Statistic value =
+//
+// 2.0769231
+//
+// The table Chi-Square statistic for 2 degrees of freedom & alpha =0.05
+//
+// 5.991
+//
+// Since the calculated Chi-square statistic is less than table value
+//
+// Accept the Null Hypothesis \ No newline at end of file
diff --git a/331/CH9/EX9.23/Example_9_23.sce b/331/CH9/EX9.23/Example_9_23.sce
new file mode 100755
index 000000000..94a914c6c
--- /dev/null
+++ b/331/CH9/EX9.23/Example_9_23.sce
@@ -0,0 +1,168 @@
+//Caption:Kruskal-Wallis Test (H Test)
+//Example9.23
+//Page350
+//Ho: There is no significant difference between the production volumes of units assmebled by the three operators
+//H1: There is significant difference between the production volumes of units assmebled by the three operators
+clear;
+clc;
+X1 = [29,34,34,20,32,45,42,24,35];//Operator-1:production volume of Units Assembled
+X2 = [30,21,23,25,44,37,34,19,38];//Operator-2:production volume of Units Assembled
+X3 = [26,36,41,48,27,39,28,46,15];//Operator-3:production volume of Units Assembled
+n1 = length(X1);//number of shifts worked by operator-1
+n2 = length(X2);//number of shifts worked by operator-2
+n3 = length(X3);//number of shifts worked by operator-3
+N = n1+n2+n3;//total number of shifts
+X =[X1,X2,X3];
+[X_sort,ind] = gsort(X,'g','i');
+j = 1;
+for i = 1:N
+ R(i)=i;
+ if (i~=N) then
+ if (X_sort(i)==X_sort(i+1)) then
+ K(j)=i;
+ j = j+1;
+ elseif (i>1)&(X_sort(i)==X_sort(i-1))
+ K(j)= i;
+ j = j+1;
+ end
+ end
+end
+disp(X_sort,'Observations of all samples=')
+disp(R,'Ranks of all observations')
+for i = 1:length(K)
+ R(K(i))= sum(K(:))/length(K);
+end
+for i =1:N
+ for j= 1:n1
+ if(X_sort(i)==X1(j))
+ R_S1(j) = R(i);
+ elseif (X_sort(i)==X2(j))
+ R_S2(j) = R(i);
+ elseif (X_sort(i)==X3(j))
+ R_S3(j) = R(i);
+ end
+ end
+
+end
+R_S1 = gsort(R_S1,'g','i');
+disp(R_S1,'Ranks of Sample-1=');
+R_S2 = gsort(R_S2,'g','i');
+disp(R_S2,'Ranks of Sample-2=');
+R_S3 = gsort(R_S3,'g','i');
+disp(R_S3,'Ranks of Sample-3=');
+Sum_R_S1 = sum(R_S1);
+disp(Sum_R_S1,'The sum of the ranks of the sample-1')
+Sum_R_S2 = sum(R_S2);
+disp(Sum_R_S2,'The sum of the ranks of the sample-2')
+Sum_R_S3 = sum(R_S3);
+disp(Sum_R_S3,'The sum of the ranks of the sample-3')
+H = (12/(N*(N+1)))*((Sum_R_S1^2/n1)+(Sum_R_S2^2/n2)+(Sum_R_S3^2/n3))-3*(N+1);
+disp(H,'H~chi-square distribution with (K-1) degrees of freedom, where K is the total number of samples H=')
+H_table = 5.991;//for 2 degrees of freedom & significance level = 0.05
+disp(H_table,'H~chi-square table value for 2 degrees of freedom and significance level of 0.05=')
+if(H<H_table)
+ disp('Since the calculated value of H is < the table chi-square table, accept the null hypothesis' )
+else
+ disp('Reject null hypothesis')
+end
+//Result
+
+// Observations of all samples=
+//
+//
+// column 1 to 17
+//
+// 15. 19. 20. 21. 23. 24. 25. 26. 27. 28. 29. 30. 32. 34. 34. 34. 35.
+//
+// column 18 to 27
+//
+// 36. 37. 38. 39. 41. 42. 44. 45. 46. 48.
+//
+// Ranks of all observations
+//
+// 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.
+//
+// Ranks of Sample-1=
+//
+// 3.
+// 6.
+// 11.
+// 13.
+// 15.
+// 15.
+// 17.
+// 23.
+// 25.
+//
+// Ranks of Sample-2=
+//
+// 2.
+// 4.
+// 5.
+// 7.
+// 12.
+// 15.
+// 19.
+// 20.
+// 24.
+//
+// Ranks of Sample-3=
+//
+// 1.
+// 8.
+// 9.
+// 10.
+// 18.
+// 21.
+// 22.
+// 26.
+// 27.
+//
+// The sum of the ranks of the sample-1
+//
+// 128.
+//
+// The sum of the ranks of the sample-2
+//
+// 108.
+//
+// The sum of the ranks of the sample-3
+//
+// 142.
+//
+// H~chi-square distribution with (K-1) degrees of freedom, where K is the total number of samples H=
+//
+// 1.0299824
+//
+// H~chi-square table value for 2 degrees of freedom and significance level of 0.05=
+//
+// 5.991
+//
+// Since the calculated value of H is < the table chi-square table, accept the null hypothesis
+// \ No newline at end of file
diff --git a/331/CH9/EX9.3/Example_9_3.sce b/331/CH9/EX9.3/Example_9_3.sce
new file mode 100755
index 000000000..5c0e1d216
--- /dev/null
+++ b/331/CH9/EX9.3/Example_9_3.sce
@@ -0,0 +1,33 @@
+//Caption: Two-tailed sign test for small sample
+//Example9.3
+//Page314
+//Ho: p =1/2, H1: p#1/2
+clear;
+clc;
+n =9;//sample size
+p = 0.5;
+q = 1-p;
+alpha = 0.1;
+alpha = alpha/2;//significance level
+plus_signs = 8;
+minus_signs = 1;
+//Binomial probability that the number of plus signs >=8
+X =7;
+[P,Q]=cdfbin("PQ",X,n,p,q);
+disp(Q,'The binomial probability that the number of plus signs P(X>=7)=')
+if (Q>alpha) then
+ disp('Sine it is greater than significance level, the binomial statistic falls')
+ disp('in the acceptance region')
+else
+ disp('Since it is less than significance level, the binomial statistic falls')
+ disp('in the rejection region and the null hypothesis should be rejected')
+end
+//Result
+//The binomial probability that the number of plus signs P(X>=7)=
+//
+// 0.0195312
+//
+// Since it is less than significance level, the binomial statistic falls
+//
+// in the rejection region and the null hypothesis should be rejected
+ \ No newline at end of file
diff --git a/331/CH9/EX9.4/Example_9_4.sce b/331/CH9/EX9.4/Example_9_4.sce
new file mode 100755
index 000000000..578ad57e4
--- /dev/null
+++ b/331/CH9/EX9.4/Example_9_4.sce
@@ -0,0 +1,40 @@
+//Caption:One-tailed One-sample test for large sample
+//Example9.4
+//Page316
+//Test 1: Ho: u = 100,p =1/2, H1: u >100, p> 1/2
+
+clc;
+n = 36;//sample size
+p = 0.5;
+q = 1-p;
+plus_signs = 24;
+minus_signs = 11;
+zeros_num = 1;
+alpha = 0.05; //significance level
+Mean = n*p;
+Var = n*p*q;
+Std = sqrt(Var);
+X = plus_signs;
+Z_cal = (X-Mean)/Std;
+Z_std = standard_normal_zstat(alpha)
+disp(Z_cal,'The calculated z statistic Z=')
+disp(Z_std,'The standard z statistic Z=')
+if (Z_cal > Z_std) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+else
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+end
+//Result
+//The calculated z statistic Z=
+//
+// 2.
+//
+// The standard z statistic Z=
+//
+// 1.64
+//
+//It falls in the Rejection Region
+//
+// Then Null Hypothesis Ho should be Rejected \ No newline at end of file
diff --git a/331/CH9/EX9.5/Example_9_5.sce b/331/CH9/EX9.5/Example_9_5.sce
new file mode 100755
index 000000000..5bbc9cfa6
--- /dev/null
+++ b/331/CH9/EX9.5/Example_9_5.sce
@@ -0,0 +1,40 @@
+//Caption:One-tailed One-sample test for large sample
+//Example9.5
+//Page317
+//Test 2: Ho: u = 8,p =1/2, H1: u < 8, p < 1/2
+
+clc;
+n = 40;//sample size
+p = 0.5;
+q = 1-p;
+plus_signs = 11;
+minus_signs = 25;
+zeros_num = 4;
+alpha = 0.01; //significance level
+Mean = n*p;
+Var = n*p*q;
+Std = sqrt(Var);
+X = plus_signs;
+Z_cal = (X-Mean)/Std;
+Z_std = standard_normal_zstat(alpha)
+disp(Z_cal,'The calculated z statistic Z=')
+disp(Z_std,'The standard z statistic Z=')
+if (Z_cal < Z_std) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+else
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+end
+//Result
+//The calculated z statistic Z=
+//
+// - 2.8460499
+//
+// The standard z statistic Z=
+//
+// 2.33
+//
+// It falls in the Rejection Region
+//
+// Then Null Hypothesis Ho should be Rejected \ No newline at end of file
diff --git a/331/CH9/EX9.6/Example_9_6.sce b/331/CH9/EX9.6/Example_9_6.sce
new file mode 100755
index 000000000..d2b2c6fb5
--- /dev/null
+++ b/331/CH9/EX9.6/Example_9_6.sce
@@ -0,0 +1,40 @@
+//Caption: Two-tailed one-sample sign test for large sample
+//Example9.6
+//Page319
+
+clc;
+n = 36; //number of samples
+p = 1/2;
+q = 1-p;
+Mean = n*p;
+Var = n*p*q;
+Std = sqrt(Var);
+alpha = 0.05; //significance level
+alpha = alpha/2;
+plus_signs = 25; //if it is more than 75
+minus_signs = 10; //if it is less than 75
+no_of_zeros = 1;
+X = 25; //number of plus signs
+Z_calc = (X-Mean)/Std;
+Z_stand = standard_normal_zstat(alpha);
+disp(Z_calc,'The calculated z statistic Z=')
+disp(Z_stand,'The standard z statistic Z=')
+if (Z_calc > Z_stand) then
+ disp('It falls in the Rejection Region')
+ disp('Then Null Hypothesis Ho should be Rejected')
+else
+ disp('It falls in the Acceptance Region')
+ disp('Then Null Hypothesis Ho should be Accepted')
+end
+//Result
+//The calculated z statistic Z=
+//
+// 2.3333333
+//
+// The standard z statistic Z=
+//
+// 1.96
+//
+// It falls in the Rejection Region
+//
+// Then Null Hypothesis Ho should be Rejected \ No newline at end of file
diff --git a/331/CH9/EX9.7/Example_9_7.sce b/331/CH9/EX9.7/Example_9_7.sce
new file mode 100755
index 000000000..9bee695f5
--- /dev/null
+++ b/331/CH9/EX9.7/Example_9_7.sce
@@ -0,0 +1,73 @@
+//Caption: Kolmogorov-Smirnov Test
+//Example9.7
+//Page321
+//Ho: The given set of observations follows the uniform distribution
+//H1: The given set of observations does not follow the uniform distribution
+clear;
+clc;
+X = [30,31,32,33,34,35,36,37,38,39]; //Demand in tons
+o = [2,3,1,4,2,2,4,2,4,1];//Observed frequency
+n = sum(o);//total observed frequencies
+alpha = 0.05;//significance level
+N = length(X); //Number of values of the random variable
+ExFre = n/N; //Expected frequency for each
+disp(ExFre,'Expected Frequency for each =')
+ExPr = ExFre/n;// Expected probability for each
+disp(ExPr,'Expected probability for each=')
+for i = 1:N
+ EP(i)= ExPr;
+end
+op = o./(N*ExFre);//Observed probability
+disp(op,'Observed Probability=')
+OF = cumsum(op);//Observed cumulative probability
+disp(OF,'Observed Cumulative Probability OF =')
+EF = cumsum(EP);//Expected cumulative probability
+disp(EF,'Expected Cumulative Probability EF =')
+for i = 1:N
+ D(i) = abs(OF(i)-EF(i));
+end
+disp(D,'Calculated difference absolute value D =')
+Dn = 0.27;//theoretical value for a significance level of 0.05
+disp(Dn,'Theoretical table value for a significance level of 0.05=')
+[Dcal,ind]= max(D);
+if (Dcal<Dn) then
+ disp('Since Dcal is less than the table value Dn accept the null hypothesis Ho')
+else
+ disp('Sinc Dcal > Dn table value reject null hypothesis Ho')
+end
+//Result
+// Expected Frequency for each =
+// 2.5
+// Expected probability for each=
+// 0.1
+// Observed Probability=
+// 0.08 0.12 0.04 0.16 0.08 0.08 0.16 0.08 0.16 0.04
+// Observed Cumulative Probability OF =
+// 0.08 0.2 0.24 0.4 0.48 0.56 0.72 0.8 0.96 1.
+// Expected Cumulative Probability EF =
+// 0.1
+// 0.2
+// 0.3
+// 0.4
+// 0.5
+// 0.6
+// 0.7
+// 0.8
+// 0.9
+// 1.
+// Calculated difference absolute value D =
+// 10^(-8) *
+//
+// 2000000.
+// 0.
+// 6000000.
+// 0.
+// 2000000.
+// 4000000.
+// 2000000.
+// 1.110D-08
+// 6000000.
+// 1.110D-08
+// Theoretical table value for a significance level of 0.05=
+// 0.27
+// Since Dcal is less than the table value Dn accept the null hypothesis Ho \ No newline at end of file
diff --git a/331/CH9/EX9.8/Example_9_8.sce b/331/CH9/EX9.8/Example_9_8.sce
new file mode 100755
index 000000000..86470ac25
--- /dev/null
+++ b/331/CH9/EX9.8/Example_9_8.sce
@@ -0,0 +1,89 @@
+//Caption: Kolmogorov-Smirnov Test
+//Example9.8
+//Page322
+//Ho: The given set of observations follows poisson distribution
+//H1: The given set of observations does not follow the poisson distribution
+clear;
+clc;
+X = [0,1,2,3,4,5,6]; //Arrival rate
+o = [2,6,18,12,8,3,1];//Observed frequency
+n = sum(o);//total observed frequencies
+alpha = 0.05;//significance level
+N = length(X); //Number of values of the random variable
+for i = 1:length(X)
+ Xo(i)= X(i)*o(i);
+end
+Xioi = sum(Xo);
+u = Xioi/n; //mean arrival rate
+for i = 1:length(X)
+ P(i)= ((u^X(i))*exp(-u))/factorial(X(i));
+end
+op = o/n;
+disp(op,'Observed Probability=');
+disp(P,'Expected Probability=');
+OF = cumsum(op);
+EF = cumsum(P);
+disp(OF,'Observed cumulative probability=')
+disp(EF,'Expected cumulative probability=')
+for i = 1:N
+ D(i) = abs(OF(i)-EF(i));
+end
+disp(D,'Calculated difference absolute value D =')
+Dn = 1.36/sqrt(n);//theoretical value for a significance level of 0.05
+disp(Dn,'Theoretical table value for a significance level of 0.05=')
+[Dcal,ind]= max(D);
+disp(Dcal,'The maximum value of D is Dcal=')
+if (Dcal<Dn) then
+ disp('Since Dcal is less than the table value Dn accept the null hypothesis Ho')
+else
+ disp('Sinc Dcal > Dn table value reject null hypothesis Ho')
+end
+//Result
+
+// Observed Probability=
+//
+// 0.04 0.12 0.36 0.24 0.16 0.06 0.02
+//
+// Expected Probability=
+//
+// 0.0728029
+// 0.1907435
+// 0.2498740
+// 0.2182233
+// 0.1429362
+// 0.0748986
+// 0.0327057
+//
+// Observed cumulative probability=
+//
+// 0.04 0.16 0.52 0.76 0.92 0.98 1.
+//
+// Expected cumulative probability=
+//
+// 0.0728029
+// 0.2635464
+// 0.5134203
+// 0.7316436
+// 0.8745799
+// 0.9494785
+// 0.9821842
+//
+// Calculated difference absolute value D =
+//
+// 0.0328029
+// 0.1035464
+// 0.0065797
+// 0.0283564
+// 0.0454201
+// 0.0305215
+// 0.0178158
+//
+// Theoretical table value for a significance level of 0.05=
+//
+// 0.1923330
+//
+// The maximum value of D is Dcal=
+//
+// 0.1035464
+//
+// Since Dcal is less than the table value Dn accept the null hypothesis Ho \ No newline at end of file
diff --git a/331/CH9/EX9.9/Example_9_9.sce b/331/CH9/EX9.9/Example_9_9.sce
new file mode 100755
index 000000000..d8bc45499
--- /dev/null
+++ b/331/CH9/EX9.9/Example_9_9.sce
@@ -0,0 +1,95 @@
+//Caption: Kolmogorov-Smirnov Test
+//Example9.9
+//Page323
+//Ho: The given set of observations follows normal distribution
+//H1: The given set of observations does not follow the normal distribution
+clear;
+clc;
+X =[0,5;5,10;10,15;15,20;20,25;25,30;30,35]; //Demand
+o = [4,9,15,20,18,7,5]; //Observed frequency
+alpha = 0.10; //significance level
+n = sum(o); //total observed frequency
+[m1,n1] = size(X);
+for i = 1:m1
+ Xmid(i) = sum(X(i,:))/2;
+ Xo(i)= Xmid(i)*o(i);
+end
+Xioi = sum(Xo);
+u = Xioi/n; //mean demand
+N = length(Xmid);//Number of ranges for the random variable
+Var = variance(Xmid)/2;
+Std = sqrt(Var);
+alpha = 0.10;//significance level
+for i =1:N
+ Z_Stand(i) = (Xmid(i)-u)/Std;
+ [P(i),Q(i)]=cdfnor("PQ",Xmid(i),u,Std)
+end
+op = o/n;
+EF = cumsum(op);
+disp(op,'Observered probability=')
+disp(Z_Stand,'Calculated z value=');
+disp(P,'Observed cumulative Probability Z(OF) =');
+disp(EF,'Expected cumulative probability EF = ');
+for i = 1:N
+ D(i) = abs(P(i)-EF(i));
+end
+[Dcal,ind] = max(D);
+Dn = 1.22/sqrt(n);
+disp(D,'Calculated D values Di = ');
+disp(Dcal,'Maximum D value Dcal =');
+disp(Dn,'Theoritical D value of Dn for the sample size n =78, D78 =');
+if (Dcal<Dn) then
+ disp('Since Dcal is less than the table value Dn accept the null hypothesis Ho')
+else
+ disp('Sinc Dcal > Dn table value reject null hypothesis Ho')
+end
+//Result
+//
+// Observered probability=
+//
+// 0.0512821 0.1153846 0.1923077 0.2564103 0.2307692 0.0897436 0.0641026
+//
+// Calculated z value=
+//
+// - 1.980747
+// - 1.3260933
+// - 0.6714397
+// - 0.0167860
+// 0.6378677
+// 1.2925213
+// 1.947175
+//
+// Observed cumulative Probability Z(OF) =
+//
+// 0.0238098
+// 0.0924044
+// 0.2509702
+// 0.4933037
+// 0.7382201
+// 0.9019117
+// 0.9742431
+//
+// Expected cumulative probability EF =
+//
+// 0.0512821 0.1666667 0.3589744 0.6153846 0.8461538 0.9358974 1.
+//
+// Calculated D values Di =
+//
+// 0.0274722
+// 0.0742623
+// 0.1080041
+// 0.1220809
+// 0.1079338
+// 0.0339858
+// 0.0257569
+//
+// Maximum D value Dcal =
+//
+// 0.1220809
+//
+// Theoritical D value of Dn for the sample size n =78, D78 =
+//
+// 0.1381378
+//
+// Since Dcal is less than the table value Dn accept the null hypothesis Ho
+// \ No newline at end of file
diff --git a/331/DEPENDENCIES/Add.sce b/331/DEPENDENCIES/Add.sce
new file mode 100755
index 000000000..df71b04b9
--- /dev/null
+++ b/331/DEPENDENCIES/Add.sce
@@ -0,0 +1,6 @@
+
+function summation = add(x,y)
+
+ summation = x+y
+
+ endfunction \ No newline at end of file
diff --git a/331/DEPENDENCIES/Chi_test.sci b/331/DEPENDENCIES/Chi_test.sci
new file mode 100755
index 000000000..e5a82775c
--- /dev/null
+++ b/331/DEPENDENCIES/Chi_test.sci
@@ -0,0 +1,12 @@
+function [Chi]= Chi_test(Alpha,Test)
+ if Alpha ==0.05 then
+ if (Test==1 |Test==2) then
+ Chi = 19.675
+ else
+ Chi = [4.575,19.675]
+ end
+
+ elseif Alpha ==0.01
+ Chi = 1.239;
+ end
+endfunction \ No newline at end of file
diff --git a/331/DEPENDENCIES/F_test.sci b/331/DEPENDENCIES/F_test.sci
new file mode 100755
index 000000000..3fdeaccbb
--- /dev/null
+++ b/331/DEPENDENCIES/F_test.sci
@@ -0,0 +1,12 @@
+function [F]=F_test(Alpha,Test)
+ if Alpha ==0.05 then
+ if (Test==1 |Test==2) then
+ F = 2.65
+ else
+ F = [0.403,2.62]
+ end
+
+ elseif Alpha ==0.01
+ F = 0.176;
+ end
+endfunction \ No newline at end of file
diff --git a/331/DEPENDENCIES/Norm_Dis_Diff_Two_Mean.sci b/331/DEPENDENCIES/Norm_Dis_Diff_Two_Mean.sci
new file mode 100755
index 000000000..18792ecf4
--- /dev/null
+++ b/331/DEPENDENCIES/Norm_Dis_Diff_Two_Mean.sci
@@ -0,0 +1,6 @@
+function [Z]= Norm_Dis_Diff_Two_Mean(X1,X2,Sigma1,Sigma2,n1,n2)
+ u1 =0;
+ u2 =0;
+ Sigma12 = (Sigma1/n1)+(Sigma2/n2);
+ Z = ((X1-X2)-(u1-u2))/(sqrt(Sigma12));
+endfunction \ No newline at end of file
diff --git a/331/DEPENDENCIES/Students_t_Var_Unknown.sci b/331/DEPENDENCIES/Students_t_Var_Unknown.sci
new file mode 100755
index 000000000..8977322aa
--- /dev/null
+++ b/331/DEPENDENCIES/Students_t_Var_Unknown.sci
@@ -0,0 +1,9 @@
+function[t] = Students_t_Var_Unknown(X1,X2,Sigma1,Sigma2,n1,n2)
+u1 =0;
+u2 =0;
+Sp = ((n1-1)*Sigma1+(n2-1)*Sigma2)/(n1+n2-2)
+disp(Sp,'Sp=')
+Sigma = sqrt(Sp*((1/n1)+(1/n2)));
+disp(Sigma,'Sigma=')
+t = ((X1-X2)-(u1-u2))/Sigma;
+endfunction \ No newline at end of file
diff --git a/331/DEPENDENCIES/nor_dist_stat_finite_po.sci b/331/DEPENDENCIES/nor_dist_stat_finite_po.sci
new file mode 100755
index 000000000..b044a80ea
--- /dev/null
+++ b/331/DEPENDENCIES/nor_dist_stat_finite_po.sci
@@ -0,0 +1,3 @@
+function [Z]= nor_dist_stat_finite_po(X,u,std,n,N)
+ Z = (X-u)/((std/sqrt(n))*sqrt((N-n)/(N-1)));
+endfunction \ No newline at end of file
diff --git a/331/DEPENDENCIES/nor_dist_stat_infini_po.sci b/331/DEPENDENCIES/nor_dist_stat_infini_po.sci
new file mode 100755
index 000000000..093997518
--- /dev/null
+++ b/331/DEPENDENCIES/nor_dist_stat_infini_po.sci
@@ -0,0 +1,3 @@
+function [Z]= nor_dist_stat_infini_po(X,u,std,samplesize)
+ Z = (X-u)/(std/sqrt(samplesize));
+endfunction \ No newline at end of file
diff --git a/331/DEPENDENCIES/nor_pop_unknown_large.sci b/331/DEPENDENCIES/nor_pop_unknown_large.sci
new file mode 100755
index 000000000..fa0ebe5d8
--- /dev/null
+++ b/331/DEPENDENCIES/nor_pop_unknown_large.sci
@@ -0,0 +1,3 @@
+function [Z]= nor_pop_unknown_large(X,u,std,n)
+ Z = (X-u)/(std/sqrt(n));
+endfunction \ No newline at end of file
diff --git a/331/DEPENDENCIES/stand_students_t_VarUnkn.sci b/331/DEPENDENCIES/stand_students_t_VarUnkn.sci
new file mode 100755
index 000000000..d86c20f32
--- /dev/null
+++ b/331/DEPENDENCIES/stand_students_t_VarUnkn.sci
@@ -0,0 +1,7 @@
+function [t_alpha] = stand_students_t_VarUnkn(alpha)
+ if (alpha ==0.05) then
+ t_alpha = 1.645;
+ elseif (alpha==0.01) then
+ t_alpha = 2.326;
+ end
+endfunction \ No newline at end of file
diff --git a/331/DEPENDENCIES/stand_students_t_distri.sci b/331/DEPENDENCIES/stand_students_t_distri.sci
new file mode 100755
index 000000000..2173a656b
--- /dev/null
+++ b/331/DEPENDENCIES/stand_students_t_distri.sci
@@ -0,0 +1,9 @@
+function [t_alpha] = stand_students_t_distri(alpha)
+ if (alpha ==0.05) then
+ t_alpha = 1.711;
+ elseif (alpha==0.01) then
+ t_alpha = 2.602;
+ elseif (alpha==0.025) then
+ t_alpha = 2.064;
+ end
+endfunction \ No newline at end of file
diff --git a/331/DEPENDENCIES/standard_normal_zstat.sci b/331/DEPENDENCIES/standard_normal_zstat.sci
new file mode 100755
index 000000000..1e16fd405
--- /dev/null
+++ b/331/DEPENDENCIES/standard_normal_zstat.sci
@@ -0,0 +1,13 @@
+function [z]=standard_normal_zstat(alpha)
+ if (alpha ==0.05) then
+ z = 1.64;
+ elseif (alpha==0.005) then
+ z = 2.57;
+ elseif (alpha==0.10) then
+ z = 1.28;
+ elseif (alpha==0.01) then
+ z = 2.33;
+ elseif (alpha==0.025) then
+ z = 1.96;
+ end
+endfunction \ No newline at end of file
diff --git a/331/DEPENDENCIES/students_t_distri.sci b/331/DEPENDENCIES/students_t_distri.sci
new file mode 100755
index 000000000..6c9fcaf59
--- /dev/null
+++ b/331/DEPENDENCIES/students_t_distri.sci
@@ -0,0 +1,3 @@
+function[t] = students_t_distri(X,u,std,n)
+t = (X-u)/(std/sqrt(n));
+endfunction \ No newline at end of file