summaryrefslogtreecommitdiff
path: root/331/CH9/EX9.18/Example_9_18.sce
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /331/CH9/EX9.18/Example_9_18.sce
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/CH9/EX9.18/Example_9_18.sce')
-rwxr-xr-x331/CH9/EX9.18/Example_9_18.sce77
1 files changed, 77 insertions, 0 deletions
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