diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /331/CH7 | |
download | Scilab-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/CH7')
-rwxr-xr-x | 331/CH7/EX7.1/Example_7_1.sce | 23 | ||||
-rwxr-xr-x | 331/CH7/EX7.10/Example_7_10.sce | 25 | ||||
-rwxr-xr-x | 331/CH7/EX7.11/Example_7_11.sce | 18 | ||||
-rwxr-xr-x | 331/CH7/EX7.12/Example_7_12.sce | 19 | ||||
-rwxr-xr-x | 331/CH7/EX7.13/Example_7_13.sce | 21 | ||||
-rwxr-xr-x | 331/CH7/EX7.14/Example_7_14.sce | 17 | ||||
-rwxr-xr-x | 331/CH7/EX7.15/Example_7_15.sce | 17 | ||||
-rwxr-xr-x | 331/CH7/EX7.2/Example_7_2.sce | 35 | ||||
-rwxr-xr-x | 331/CH7/EX7.3/Example_7_3.sce | 16 | ||||
-rwxr-xr-x | 331/CH7/EX7.4/Example_7_4.sce | 36 | ||||
-rwxr-xr-x | 331/CH7/EX7.5/Example_7_5.sce | 31 | ||||
-rwxr-xr-x | 331/CH7/EX7.6/Example_7_6.sce | 19 | ||||
-rwxr-xr-x | 331/CH7/EX7.7/Example_7_7.sce | 16 | ||||
-rwxr-xr-x | 331/CH7/EX7.8/Example_7_8.sce | 19 | ||||
-rwxr-xr-x | 331/CH7/EX7.9/Example_7_9.sce | 16 |
15 files changed, 328 insertions, 0 deletions
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 |