Chap. 13. Exercise A few exercises from Chap. 13. n = 89; c = 2; OC B [p_] = CDF[BinomialDistribution[n, p], c];

Σχετικά έγγραφα
CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS

Ελληνικό Ανοικτό Πανεπιστήμιο

Section 7.6 Double and Half Angle Formulas

BarChart y 1, y 2, makes a bar chart with bar lengths y 1, y 2,.

Histogram list, 11 RANDOM NUMBERS & HISTOGRAMS. r : RandomReal. ri : RandomInteger. rd : RandomInteger 1, 6

Second Order RLC Filters

Exercise SOME HINTS for a few exercises from Chap. 10

3.4 SUM AND DIFFERENCE FORMULAS. NOTE: cos(α+β) cos α + cos β cos(α-β) cos α -cos β

Section 8.3 Trigonometric Equations

Math 6 SL Probability Distributions Practice Test Mark Scheme

Εργαστήριο 4. Άóêçóç 1. Άóêçóç 2. Χημικοί. Plot Sec x, x, 2 π, 2π. p1 Plot Abs 1 Abs x, x, 3, 3. 1 In[3]:= f x_ : 2 π. p2 Plot f x, x, 3,

Section 9.2 Polar Equations and Graphs

C.S. 430 Assignment 6, Sample Solutions

Areas and Lengths in Polar Coordinates

k A = [k, k]( )[a 1, a 2 ] = [ka 1,ka 2 ] 4For the division of two intervals of confidence in R +

DESIGN OF MACHINERY SOLUTION MANUAL h in h 4 0.

APPENDICES APPENDIX A. STATISTICAL TABLES AND CHARTS 651 APPENDIX B. BIBLIOGRAPHY 677 APPENDIX C. ANSWERS TO SELECTED EXERCISES 679

CRASH COURSE IN PRECALCULUS

ΕΛΛΗΝΙΚΗ ΔΗΜΟΚΡΑΤΙΑ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΡΗΤΗΣ. Ψηφιακή Οικονομία. Διάλεξη 10η: Basics of Game Theory part 2 Mαρίνα Μπιτσάκη Τμήμα Επιστήμης Υπολογιστών

Areas and Lengths in Polar Coordinates

Statistics 104: Quantitative Methods for Economics Formula and Theorem Review

Risk! " #$%&'() *!'+,'''## -. / # $

ΕΛΛΗΝΙΚΗ ΔΗΜΟΚΡΑΤΙΑ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΡΗΤΗΣ. Ψηφιακή Οικονομία. Διάλεξη 7η: Consumer Behavior Mαρίνα Μπιτσάκη Τμήμα Επιστήμης Υπολογιστών

SOLUTIONS TO MATH38181 EXTREME VALUES AND FINANCIAL RISK EXAM


Other Test Constructions: Likelihood Ratio & Bayes Tests

Lecture 34 Bootstrap confidence intervals

Second Order Partial Differential Equations

1. Πόσοι αριθμοί μικρότεροι του διαιρούνται με όλους τους μονοψήφιους αριθμούς;

FORMULAS FOR STATISTICS 1

EE101: Resonance in RLC circuits

2 Composition. Invertible Mappings

Chapter 6 BLM Answers

PARTIAL NOTES for 6.1 Trigonometric Identities

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 24/3/2007

Example Sheet 3 Solutions

ES440/ES911: CFD. Chapter 5. Solution of Linear Equation Systems

± 20% ± 5% ± 10% RENCO ELECTRONICS, INC.

Aquinas College. Edexcel Mathematical formulae and statistics tables DO NOT WRITE ON THIS BOOKLET

Supplementary Appendix

Nowhere-zero flows Let be a digraph, Abelian group. A Γ-circulation in is a mapping : such that, where, and : tail in X, head in

Inverse trigonometric functions & General Solution of Trigonometric Equations

HOMEWORK 4 = G. In order to plot the stress versus the stretch we define a normalized stretch:

Analytical Expression for Hessian

Overview. Transition Semantics. Configurations and the transition relation. Executions and computation

the total number of electrons passing through the lamp.

HW 3 Solutions 1. a) I use the auto.arima R function to search over models using AIC and decide on an ARMA(3,1)

MathCity.org Merging man and maths

An Inventory of Continuous Distributions

Στο εστιατόριο «ToDokimasesPrinToBgaleisStonKosmo?» έξω από τους δακτυλίους του Κρόνου, οι παραγγελίες γίνονται ηλεκτρονικά.

Matrices and Determinants

A Hierarchy of Theta Bodies for Polynomial Systems

; +302 ; +313; +320,.

Statistical Inference I Locally most powerful tests

ST5224: Advanced Statistical Theory II

Fourier Series. MATH 211, Calculus II. J. Robert Buchanan. Spring Department of Mathematics

AREAS AND LENGTHS IN POLAR COORDINATES. 25. Find the area inside the larger loop and outside the smaller loop

4.6 Autoregressive Moving Average Model ARMA(1,1)

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 19/5/2007

CHAPTER 48 APPLICATIONS OF MATRICES AND DETERMINANTS

EE512: Error Control Coding

Homework 3 Solutions

Lifting Entry (continued)

CE 530 Molecular Simulation

Bayesian statistics. DS GA 1002 Probability and Statistics for Data Science.

Pg The perimeter is P = 3x The area of a triangle is. where b is the base, h is the height. In our case b = x, then the area is

department listing department name αχχουντσ ϕανε βαλικτ δδσϕηασδδη σδηφγ ασκϕηλκ τεχηνιχαλ αλαν ϕουν διξ τεχηνιχαλ ϕοην µαριανι

Jesse Maassen and Mark Lundstrom Purdue University November 25, 2013

Practice Exam 2. Conceptual Questions. 1. State a Basic identity and then verify it. (a) Identity: Solution: One identity is csc(θ) = 1

Μηχανική Μάθηση Hypothesis Testing

ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΥΠΡΟΥ ΤΜΗΜΑ ΠΛΗΡΟΦΟΡΙΚΗΣ. ΕΠΛ342: Βάσεις Δεδομένων. Χειμερινό Εξάμηνο Φροντιστήριο 10 ΛΥΣΕΙΣ. Επερωτήσεις SQL

Cable Systems - Postive/Negative Seq Impedance

ΠΟΙΟΤΗΤΑ ΑΤΜΟΣΦΑΙΡΙΚΟΥ ΠΕΡΙΒΑΛΛΟΝΤΟΣ

Notes on the Open Economy

1. Αφετηρία από στάση χωρίς κριτή (self start όπου πινακίδα εκκίνησης) 5 λεπτά µετά την αφετηρία σας από το TC1B KALO LIVADI OUT

ΚΥΠΡΙΑΚΟΣ ΣΥΝΔΕΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY 21 ος ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ Δεύτερος Γύρος - 30 Μαρτίου 2011

ΕΙΣΑΓΩΓΗ ΣΤΗ ΣΤΑΤΙΣΤΙΚΗ ΑΝΑΛΥΣΗ

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 6/5/2006

Mock Exam 7. 1 Hong Kong Educational Publishing Company. Section A 1. Reference: HKDSE Math M Q2 (a) (1 + kx) n 1M + 1A = (1) =

Instruction Execution Times

Εργαστήριο Οργάνωσης Η/Υ. Δαδαλιάρης Αντώνιος

Luminaire Property. Photometric Results. Page 1 of 15 Pages. Report No.: 9 Test Time: 2017/5/18 09:59

Figure A.2: MPC and MPCP Age Profiles (estimating ρ, ρ = 2, φ = 0.03)..

ΠΑΝΔΠΗΣΖΜΗΟ ΠΑΣΡΩΝ ΣΜΖΜΑ ΖΛΔΚΣΡΟΛΟΓΩΝ ΜΖΥΑΝΗΚΩΝ ΚΑΗ ΣΔΥΝΟΛΟΓΗΑ ΤΠΟΛΟΓΗΣΩΝ ΣΟΜΔΑ ΤΣΖΜΑΣΩΝ ΖΛΔΚΣΡΗΚΖ ΔΝΔΡΓΔΗΑ

Computing the Gradient

FOR THE MOMENT, DUE TO ECONOMICAL CRISIS, PRODUCTION OF GICLEE COPIES UNDER REQUEST, IS SUSPENDED.

b. Use the parametrization from (a) to compute the area of S a as S a ds. Be sure to substitute for ds!

NMBTC.COM /

Molecular evolutionary dynamics of respiratory syncytial virus group A in

Numerical Analysis FMN011

Durbin-Levinson recursive method

SCOPE OF ACCREDITATION TO ISO 17025:2005

6.003: Signals and Systems. Modulation

Tridiagonal matrices. Gérard MEURANT. October, 2008

Graded Refractive-Index

πόρτες κατοικιών residential doors

Magnetically Coupled Circuits

Metal Oxide Leaded Film Resistor

SMD Wire Wound Ferrite Chip Inductors - LS Series. LS Series. Product Identification. Shape and Dimensions / Recommended Pattern LS0402/0603/0805/1008

Liner Shipping Hub Network Design in a Competitive Environment

Transcript:

Cha. 13 A few exercises from Cha. 13 Exercise 13.2 n = 89; c = 2; OC B [_] = CDF[BinomialDistribution[n, ], c]; TableForm[Table[{, OC B []}, {, 0.01, 0.05, 0.01}], TableHeadings {None, {"", "OC B ()"}}] Plot[OC B [], {, 0,.1}, AxesLabel {"", "OC B ()"}] (* OC curve tye B* ) OC B () 0.01 0.93969 0.02 0.736578 0.03 98483 0.04 0.304158 0.05 0.172077 OC B () 0.02 0.04 0.06 0.08 0.10

2 Ex-Ca13.nb 1 = 0.05; idealoc[_] = If[ 1, 1, 0]; G1 = Plot[idealOC[], {, 0, 1 }, PlotStyle {RGBColor[0, 1, 0], Thickness[0.008]}, AxesLabel {"", "Ideal P a ()"}, PlotRange {{0, 1}, {0, 1.1}}, DislayFunction Identity]; G2 = Plot[idealOC[], {, 1, 1}, PlotStyle {RGBColor[1, 0, 0], Thickness[0.02]}, PlotStyle Thickness[0.008], PlotRange {{0, 1}, {0, 1.1}}, DislayFunction Identity]; Show[G1, G2, DislayFunction $DislayFunction] Ideal P a () 0.0 0.0 Exercise 13.3 1 = 0.01; (* AQL * ) α = 0.05; (* roducer's risk * ) 2 = 0.1; (* LTPD * ) β = 0.10; (* consumer's risk * ) Q[c_, x_] = Quantile[ChiSquareDistribution[2 (c + 1)], x]; N[Q[c, 1 - β], 5] r[c_] = N[Q[c, α], 5] ; i = 0; While r[i] > 2 1, Print "Do not use accetance number c=", i, " because r(c)=", r[i], "> 2 =", 2 ; 1 1 i++ Print "Use accetance number c=", i, " because r(c)=", r[i], " 2 1 =", 2 1 Q[i, 1 - β] n[c_] = Ceiling ; 2 2 Print["Use the samle size n=", n[i]] Do not use accetance number c=0 because r(c)=44.8906> 2 1 =10. Do not use accetance number c=1 because r(c)=10.9458> 2 1 =10. Use accetance number c=2 because r(c)=6.50896 2 1 =10. Use the samle size n=54

Ex-Ca13.nb 3 OC B [_] = CDF[BinomialDistribution[n[i], ], i]; TableForm[Table[{, OC B []}, {, 0.005, 0.15, 0.005}], TableHeadings {None, {"", "OC B ()"}}] G1 = Plot[OC B [], {, 0,.15}, AxesLabel {"", "OC B ()"}, PlotStyle RGBColor[1, 0, 0], DislayFunction Identity]; riskoints = {{ 1, 1 - α}, { 2, β}}; G2 = ListPlot[riskoints, PlotStyle PointSize[0.014], PlotStyle RGBColor[0, 1, 0], DislayFunction Identity]; Show[G1, G2, DislayFunction $DislayFunction] (* OC curve tye B obtain via Wetherill and Brown's method; roducer's risk oint (left) and consumer's risk oint (right). * ) OC B () 0.005 0.997437 0.01 0.98302 0.015 0.952447 0.02 0.906268 0.025 4742 0.03 0.779716 0.035 0.706983 0.04 32605 0.045 0.559329 0.05 89225 0.055 23727 0.06 0.363724 0.065 0.309664 0.07 6165 0.075 19535 0.08 0.182999 0.085 0.151615 0.09 0.124894 0.095 0.102326 0.1 0.0834077 0.105 0.0676558 0.11 0.0546237 0.115 0.0439056 0.12 0.0351398 0.125 0.0280082 0.13 0.022235 0.135 0.0175838 0.14 0.0138534 0.145 0.0108746 0.15 0.00850593 OC B ()

4 Ex-Ca13.nb bdist[n_, t_] := BinomialDistribution[n, t]; dist[n_, t_] := PoissonDistribution[n * t]; hdist[n_, t_, ng_] := HyergeometricDistribution[n, Round[t * ng], ng]; bin[x_, n_, t_, ng_] := PDF[bdist[n, t], x]; oi[x_, n_, t_, ng_] := PDF[dist[n, t], x]; hi[x_, n_, t_, ng_] := PDF[hdist[n, t, ng], x]; c Pa[_, {n_, c_, ng_}, f_] := f[d, n,, ng]; d=0 Paatr[_, {{a_, b_}, {e_, d_}}, ng_, f_] := Pa[, {lanoamosatrib[{{a, b}, {e, d}}, ng, f][[1]], lanoamosatrib[{{a, b}, {e, d}}, ng, f][[2]], ng}, f] lanoamosatrib[{{a_, b_}, {e_, d_}}, ng_, f_] := Module[{n, c}, j = 0; t = 0; While[t 0, i = 2; While[i ng && Pa[a, {i, j, ng}, f] 1 - b, i = i + 1] If[Pa[e, {i - 1, j, ng}, f] d, t = 1, t = 0]; j = j + 1]; While[ Pa[a, {i - 1, j - 1, ng}, f] 1 - b && Pa[e, {i - 1, j - 1, ng}, f] d, i = i - 1]; {n = i, c = j - 1}] n tot = 800; (* lot size * ) 1 = 0.01; (* AQL * ) α = 0.05; (* roducer's risk * ) 2 = 0.1; (* LTPD * ) β = 0.10; (* consumer's risk * ) Print["Use the samle size and accetance number, (n,c)=", lanoamosatrib[{{ 1, α}, { 2, β}}, n tot, hi]] (* By using the exact distribution, both n and c are smaller than the one obtained via the Poisson aroximation * ) listoca = Table[{, N[CDF[HyergeometricDistribution[37, Round[n tot ], n tot ], 1], 5]}, {, 0.005, 0.15, 0.005}]; TableForm[listOCA, TableHeadings {None, {"", "OC A ()"}}] G3 = ListPlot[listOCA, AxesLabel {"", "OC A ()"}, PlotStyle RGBColor[1, 0, 1], DislayFunction Identity]; riskoints = {{ 1, 1 - α}, { 2, β}}; G2 = ListPlot[riskoints, PlotStyle PointSize[0.014], DislayFunction Identity]; Show[G3, G2, DislayFunction $DislayFunction] (* OC curve tye B, roducer's risk oint (left) and consumer's risk oint (right). * ) Use the samle size and accetance number, (n,c)={37, 1}

Ex-Ca13.nb 5 OC A () 0.005 0.98822 0.01 0.95111 0.015 9737 0.02 3359 0.025 0.76465 0.03 9412 0.035 2454 0.04 0.55766 0.045 9462 0.05 3612 0.055 0.38249 0.06 0.33384 0.065 9010 0.07 5106 0.075 1646 0.08 0.18597 0.085 0.15924 0.09 0.13593 0.095 0.11568 0.1 0.098171 0.105 0.083084 0.11 0.070132 0.115 0.059048 0.12 0.049594 0.125 0.041554 0.13 0.034737 0.135 0.028972 0.14 0.024111 0.145 0.020021 0.15 0.016589 OC A ()

6 Ex-Ca13.nb Print["Use the samle size and accetance number, (n,c)=", lanoamosatrib[{{ 1, α}, { 2, β}}, n tot, bin]] (* Both n and c are smaller than the one obtained via the Poisson aroximation * ) OC B [_] = CDF[BinomialDistribution[52, ], 2]; TableForm[Table[{, OC B []}, {, 0.005, 0.15, 0.005}], TableHeadings {None, {"", "OC B ()"}}] G4 = Plot[OC B [], {, 0,.15}, AxesLabel {"", "OC B ()"}, DislayFunction Identity]; riskoints = {{ 1, 1 - α}, { 2, β}}; G2 = ListPlot[riskoints, PlotStyle PointSize[0.014], DislayFunction Identity]; Show[G4, G2, DislayFunction $DislayFunction] (* OC curve tye B, roducer's risk oint (left) and consumer's risk oint (right). * ) Use the samle size and accetance number, (n,c)={52, 2} OC B () 0.005 0.997699 0.01 0.984647 0.015 0.9567 0.02 0.914066 0.025 59182 0.03 0.795393 0.035 0.726159 0.04 54624 0.045 0.583414 0.05 0.51457 0.055 49569 0.06 0.389391 0.065 0.334593 0.07 85401 0.075 41786 0.08 03539 0.085 0.170325 0.09 0.141737 0.095 0.117325 0.1 0.0966333 0.105 0.0792127 0.11 0.0646382 0.115 0.0525163 0.12 0.0424896 0.125 0.0342391 0.13 0.0274835 0.135 0.0219777 0.14 0.0175108 0.145 0.0139021 0.15 0.0109987 OC B ()

Ex-Ca13.nb 7 Show[G1, G2, G3, G4, DislayFunction $DislayFunction] OC B ()

8 Ex-Ca13.nb Exercise 13.4 n tot = 800; (* lot size * ) 1 = 0.01; (* AQL * ) α = 0.05; (* roducer's risk * ) 2 = 0.1; (* LTPD * ) β = 0.10; (* consumer's risk * ) (* Single samling lans (n,c) according to: * ) (* (54,2), Binomial Distribution aroximation + Wetherhill and Brown method RED * ) (* (52,2), Binomial Distribution aroximation GREEN* ) (* (37,1), exact HyerGeometric Distribution BLUE * ) (* (80,2), Norm ANSI/ ASQC Z1.4-1981 MAGENTA * ) OC Wetherill [_] = CDF[BinomialDistribution[54, ], 2]; OC B [_] = CDF[BinomialDistribution[52, ], 2]; listocawetherill = Table[{, N[CDF[HyergeometricDistribution[54, Round[n tot ], n tot ], 2], 5]}, {, 0.005, 0.15, 0.005}] listocabinomial = Table[ {, N[CDF[HyergeometricDistribution[52, Round[n tot ], n tot], 2], 5]}, {, 0.005, 0.15, 0.005}] listoca = Table[{, N[CDF[HyergeometricDistribution[37, Round[n tot ], n tot ], 1], 5]}, {, 0.005, 0.15, 0.005}] listocanorm = Table[{, N[CDF[HyergeometricDistribution[80, Round[n tot ], n tot ], 1], 2]}, {, 0.005, 0.15, 0.005}] riskoints = {{ 1, 1 - α}, { 2, β}}; G1 = Plot[OC Wetherill [], {, 0,.15}, PlotStyle {RGBColor[0, 1, 0], Thickness[0.002]}, DislayFunction Identity]; G2 = Plot[OC B [], {, 0,.15}, PlotStyle {RGBColor[1, 0, 0], Thickness[0.002]}, AxesLabel {"", "OC B ()"}, DislayFunction Identity]; G3 = ListPlot[listOCA, PlotStyle {RGBColor[0, 0, 1], Thickness[0.01]}, DislayFunction Identity]; G4 = ListPlot[listOCAnorm, PlotStyle {RGBColor[1, 0, 1], Thickness[0.01]}, DislayFunction Identity]; G5 = ListPlot[riskoints, PlotStyle PointSize[0.014], DislayFunction Identity]; Show[G1, G2, G3, G4, G5, DislayFunction $DislayFunction] (* OC curve associated to the Norm far from riskoints * ) {{0.005, 0.99889}, {0.01, 0.98721}, {0.015, 0.95858}, {0.02, 0.91292}, {0.025, 5322}, {0.03, 0.78366}, {0.035, 0.70851}, {0.04, 3153}, {0.045, 0.55577}, {0.05, 8350}, {0.055, 1626}, {0.06, 0.35499}, {0.065, 0.30013}, {0.07, 5172}, {0.075, 0957}, {0.08, 0.17328}, {0.085, 0.14235}, {0.09, 0.11625}, {0.095, 0.094391}, {0.1, 0.076233}, {0.105, 0.061253}, {0.11, 0.048977}, {0.115, 0.038978}, {0.12, 0.030882}, {0.125, 0.024361}, {0.13, 0.019137}, {0.135, 0.014973}, {0.14, 0.011668}, {0.145, 0.0090579}, {0.15, 0.0070053}}

Ex-Ca13.nb 9 {{0.005, 0.99901}, {0.01, 0.98849}, {0.015, 0.96245}, {0.02, 0.92047}, {0.025, 6499}, {0.03, 0.79965}, {0.035, 0.72827}, {0.04, 5434}, {0.045, 0.58077}, {0.05, 0.50980}, {0.055, 4303}, {0.06, 0.38149}, {0.065, 0.32575}, {0.07, 7600}, {0.075, 3219}, {0.08, 0.19402}, {0.085, 0.16112}, {0.09, 0.13302}, {0.095, 0.10921}, {0.1, 0.089198}, {0.105, 0.072488}, {0.11, 0.058629}, {0.115, 0.047204}, {0.12, 0.037839}, {0.125, 0.030205}, {0.13, 0.024012}, {0.135, 0.019014}, {0.14, 0.014999}, {0.145, 0.011787}, {0.15, 0.0092291}} {{0.005, 0.98822}, {0.01, 0.95111}, {0.015, 9737}, {0.02, 3359}, {0.025, 0.76465}, {0.03, 9412}, {0.035, 2454}, {0.04, 0.55766}, {0.045, 9462}, {0.05, 3612}, {0.055, 0.38249}, {0.06, 0.33384}, {0.065, 9010}, {0.07, 5106}, {0.075, 1646}, {0.08, 0.18597}, {0.085, 0.15924}, {0.09, 0.13593}, {0.095, 0.11568}, {0.1, 0.098171}, {0.105, 0.083084}, {0.11, 0.070132}, {0.115, 0.059048}, {0.12, 0.049594}, {0.125, 0.041554}, {0.13, 0.034737}, {0.135, 0.028972}, {0.14, 0.024111}, {0.145, 0.020021}, {0.15, 0.016589}} {{0.005, 0.95}, {0.01, 1}, {0.015, 6}, {0.02, 0.51}, {0.025, 0.39}, {0.03, 9}, {0.035, 1}, {0.04, 0.15}, {0.045, 0.11}, {0.05, 0.075}, {0.055, 0.052}, {0.06, 0.036}, {0.065, 0.025}, {0.07, 0.017}, {0.075, 0.011}, {0.08, 0.0077}, {0.085, 0.0052}, {0.09, 0.0034}, {0.095, 0.0023}, {0.1, 0.0015}, {0.105, 0.00098}, {0.11, 0.00064}, {0.115, 0.00042}, {0.12, 0.00027}, {0.125, 0.00017}, {0.13, 0.00011}, {0.135, 0.000071}, {0.14, 0.000045}, {0.145, 0.000029}, {0.15, 0.000018}}

10 Ex-Ca13.nb Exercise 13.6 n tot = 800; (* lot size * ) AOQ[n_, c_, _] = 1 n tot (n tot - n) CDF[BinomialDistribution[n, ], c]; (* Average Outgoing Quality (AOQ) or ercentage of defective due to rectifying insection in a single samling lan and using the binomial aroximation to the accetance robability * ) Plot[{AOQ[80, 2, ], AOQ[37, 1, ], }, {, 0.001, 0.15}, PlotStyle {RGBColor[1, 0, 0], RGBColor[0, 1, 0], RGBColor[0, 0, 1]}, AxesLabel {"", "AOQ()"}] (* AOQ of single samling lan using the Norm RED * ) (* AOQ of single samling lan obtained by solving (13.5) with the exact Hyergeometric distribution GREEN * ) FindMaximum[AOQ[80, 2, ], {, 0.001, 1}] FindMaximum[AOQ[37, 1, ], {, 0.001, 1}] AOQ[80, 2, ] AOQ[37, 1, ] Plot 1-100, 1-100, {, 0.001, 0.15}, AxesLabel {"", "AOQ rel. reduction"}, PlotStyle {RGBColor[1, 0, 0], RGBColor[0, 1, 0]} (* Associated relative reduction of the ercentage of defective * ) AOQ() 0.15 0.10 0.05 {0.0154001, { 0.0280931}} {0.0214757, { 0.0427029}} AOQ rel. reduction 100 80 60 40 20

Ex-Ca13.nb 11 Exercise 13.7 n tot = 800; (* lot size * ) ATI[n_, c_, _] = n tot + (n - n tot ) CDF[BinomialDistribution[n, ], c]; (* Average Total Insection (ATI) or ercentage of defective due to rectifying insection in a single samling lan and using the binomial aroximation to the accetance robability * ) ATItable = Table[{, ATI[80, 2, ], ATI[37, 1, ]}, {, 0, 0.15, 0.01}]; TableForm[ATItable, TableHeadings {None, {"", "ATI(n=80,c=2)", "ATI(n=37,c=1)"}}] Plot[{ATI[80, 2, ], ATI[37, 1, ], n tot }, {, 0.001, 0.15}, PlotStyle {RGBColor[1, 0, 0], RGBColor[0, 1, 0], RGBColor[0, 0, 1]}, AxesLabel {"", "ATI()"}] (* ATI of single samling lan using the Norm RED * ) (* ATI of single samling lan obtained by solving (13.5) with the exact Hyergeometric distribution GREEN * ) ATI(n=80,c=2) ATI(n=37,c=1) 0. 80 37 0.01 113.518 77.3459 0.02 235.218 165.85 0.03 390.951 269.885 0.04 530.153 371.768 0.05 633.953 462.92 0.06 703.199 540.095 0.07 745.976 603.006 0.08 770.928 652.864 0.09 784.838 691.512 0.1 792.308 720.93 0.11 796.193 742.977 0.12 798.158 759.28 0.13 799.128 771.188 0.14 799.595 779.793 0.15 799.816 785.946 ATI() 800 600 400 200

12 Ex-Ca13.nb Exercise 13.8 n 1 = 50; (* Collect a first samle of size n 1 * ) c 1 = 1; (* Accet the lot if D 1 c 1, reject if D1>c2 * ) n 2 = 100; (* Collect a second samle of size n 2 if c 1 <D 1 c 2 * ) c 2 = 3; (* Accet the lot if D 1 +D 2 c 2, reject otherwise * ) I[_] = CDF[BinomialDistribution[n 1, ], c 1 ]; (* RED * ) II[_] = c 2 PDF[BinomialDistribution[n 1, ], k] k=c 1 +1 CDF[BinomialDistribution[n 2, ], c 2 - k]; (* GREEN * ) a[_] = I[] + II[]; (* BLUE * ) OC B [_] = CDF[BinomialDistribution[75, ], 2]; (* MAGENTA * ) Plot[{I[], II[], a[], OC B []}, {, 0.001, 0.15}, PlotStyle {RGBColor[1, 0, 0], RGBColor[0, 1, 0], RGBColor[0, 0, 1], RGBColor[1, 0, 1]}, AxesLabel {"", ""}] Null

Ex-Ca13.nb 13 Exercise 13.9 n 1 = 50; (* Collect a first samle of size n 1 * ) c 1 = 2; (* Accet the lot if D 1 c 1, reject if D1>c2 * ) n 2 = 100; (* Collect a second samle of size n 2 if c 1 <D 1 c 2 * ) c 2 = 6; (* Accet the lot if D 1 +D 2 c 2, reject otherwise * ) ASN[_] = n 1 + n 2 CDF[BinomialDistribution[n 1, ], c 2 ] - CDF[BinomialDistribution[n 1, ], c 1 ] ; (* RED * ) (* Average Samle Number * ) Plot[{ASN[], 79}, {, 0.001, 0.15}, PlotStyle {RGBColor[1, 0, 0], RGBColor[0, 1, 0]}, AxesLabel {"", "ASN()"}] ASN() 120 110 100 90 80 70 60 Exercise 13.11 n 1 = 60; (* Collect a first samle of size n 1 * ) c 1 = 2; (* Accet the lot if D 1 c 1, reject if D1>c2 * ) n 2 = 120; (* Collect a second samle of size n 2 if c 1 <D 1 c 2 * ) c 2 = 3; (* Accet the lot if D 1 +D 2 c 2, reject AS SOON AS D 1 +D 2 >c 2, * ) ASN[_] = n 1 + c 2 PDF[BinomialDistribution[n 1, ], j] j=c 1 +1 n 2 CDF[BinomialDistribution[n 2, ], c 2 - j] + c 2 - j + 1 PDF[BinomialDistribution[n 2 + 1, ], c 2 - j + 2] ; (* Average Samle Number - double samling lan with curtailment * ) TableForm[Table[{, ASN[]}, {, 0.005, 0.15, 0.005}], TableHeadings {None, {"", "ASN()"}}] Plot[ASN[], {, 0.001, 0.15}, AxesLabel {"", "ASN()"}]

14 Ex-Ca13.nb ASN() 0.005 6756 0.01 61.1169 0.015 61.8346 0.02 62.0549 0.025 61.8529 0.03 61.4504 0.035 6265 0.04 6734 0.045 6161 0.05 6449 0.055 60.1384 0.06 60.0756 0.065 60.04 0.07 60.0206 0.075 60.0104 0.08 60.0051 0.085 60.0025 0.09 60.0012 0.095 60.0005 0.1 60.0003 0.105 60.0001 0.11 60.0001 0.115 60. 0.12 60. 0.125 60. 0.13 60. 0.135 60. 0.14 60. 0.145 60. 0.15 60. ASN() 62.0 61.5 6 60.5 60.0

Ex-Ca13.nb 15 I[_] = CDF[BinomialDistribution[n 1, ], c 1 ]; II[_] = c 2 PDF[BinomialDistribution[n 1, ], k] * k=c 1 +1 CDF[BinomialDistribution[n 2, ], c 2 - k]; a[_] = I[] + II[]; (* RED * ) OC B [_] = CDF[BinomialDistribution[89, ], 2]; (* GREEN * ) Plot[{a[], OC B []}, {, 0.001, 0.15}, PlotStyle {RGBColor[1, 0, 0], RGBColor[0, 1, 0]}, AxesLabel {"", ""}] Plot[{ASN[], 89}, {, 0.001, 0.15}, PlotStyle {RGBColor[1, 0, 0], RGBColor[0, 0, 1]}, AxesLabel {"", "ASN()"}] ASN() 90 85 80 75 70 65 60

16 Ex-Ca13.nb Exercise 13.12 1 = 0.01; (* AQL * ) α = 0.05; (* roducer's risk * ) 2 = 0.06; (* LTPD * ) β = 0.10; (* consumer's risk * ) n 1 = 60; (* Collect a first samle of size n 1 * ) c 1 = 1; (* Accet the lot if D 1 c 1, reject if D1>c2 * ) n 2 = 2 n 1 ; (* Collect a second samle of size n 2 if c 1 <D 1 c 2 * ) c 2 = 3; (* Accet the lot if D 1 +D 2 c 2, reject otherwise * ) I[_] = CDF[BinomialDistribution[n 1, ], c 1 ]; II[_] = c 2 PDF[BinomialDistribution[n 1, ], k] * k=c 1 +1 CDF[BinomialDistribution[n 2, ], c 2 - k]; a[_] = I[] + II[]; Plot[a[], {, 0.001, 0.15}, AxesLabel {"", "P a ()"}] (* Primary OC curve of tye B of a double samling lan (without rectifying insection or curtailment) * ) ASN[_] = n 1 + n 2 CDF[BinomialDistribution[n 1, ], c 2 ] - CDF[BinomialDistribution[n 1, ], c 1 ] ; (* RED * ) (* Average Samle Number * ) Plot[ASN[], {, 0.001, 0.15}, AxesLabel {"", "ASN()"}] P a () ASN() 120 110 100 90 80 70 60

Ex-Ca13.nb 17 Exercise 13.13 n tot = 800; (* lot size * ) 1 = 0.01; (* AQL * ) α = 0.05; (* roducer's risk * ) 2 = 0.06; (* LTPD * ) β = 0.10; (* consumer's risk * ) n 1 = 60; (* Collect a first samle of size n 1 * ) c 1 = 1; (* Accet the lot if D 1 c 1, reject if D1>c2 * ) n 2 = 2 n 1 ; (* Collect a second samle of size n 2 if c 1 <D 1 c 2 * ) c 2 = 3; (* Accet the lot if D 1 +D 2 c 2, reject otherwise * ) I[_] = CDF[BinomialDistribution[n 1, ], c 1 ]; II[_] = c 2 PDF[BinomialDistribution[n 1, ], k] * k=c 1 +1 CDF[BinomialDistribution[n 2, ], c 2 - k]; a[_] = I[] + II[]; AOQ[_] = 1 ((n tot - n 1 ) I[] + (n tot - n 1 - n 2 ) II[]); n tot Plot[AOQ[], {, 0.001, 0.15}, AxesLabel {"", "AOQ()"}] (* AOQ of a double samling (WITH rectifying insection and NO curtailment) * ) FindMaximum[AOQ[], {, 0.001, 1}] AOQ() 0.014 0.012 0.010 0.008 0.006 0.004 0.002 {0.0139338, { 0.0252902}}

18 Ex-Ca13.nb ATI[_] = n 1 I[] + (n 1 + n 2 ) II[] + n tot (1 - a[]); Plot[{ATI[], 800}, {, 0.001, 0.15}, PlotStyle {RGBColor[1, 0, 0], RGBColor[0, 0, 1]}, AxesLabel {"", "ATI()"}, PlotRange {0, n tot }] (* ATI of a double samling lan(with rectifying insection and NO curtailment) * ) ATI() 800 600 400 200 0.00 1 = 0.01; (* AQL * ) α = 0.05; (* roducer's risk * ) 2 = 0.06; (* LTPD * ) β = 0.10; (* consumer's risk * ) Q[c_, x_] = Quantile[ChiSquareDistribution[2 (c + 1)], x]; N[Q[c, 1 - β], 5] r[c_] = N[Q[c, α], 5] ; i = 0; While r[i] > 2 1, Print "Do not use accetance number c=", i, " because r(c)=", r[i], "> 2 =", 2 ; 1 1 i++ Print "Use accetance number c=", i, " because r(c)=", r[i], " 2 1 =", 2 1 Q[i, 1 - β] n[c_] = Ceiling ; 2 2 Print["Use the samle size n=", n[i]] ATISingle[_] = n tot + n[i] - n tot CDF[BinomialDistribution[n[i], ], i]; (* ATI of a single samling lan(with rectifying insection) * ) Plot[{ATI[], ATISingle[], 800}, {, 0.001, 0.15}, PlotStyle {RGBColor[1, 0, 0], RGBColor[0, 1, 0], RGBColor[0, 0, 1]}, AxesLabel {"", "ASN()"}, PlotRange {0, n tot }]

Ex-Ca13.nb 19 Do not use accetance number c=0 because r(c)=44.8906> 2 1 =6. Do not use accetance number c=1 because r(c)=10.9458> 2 1 =6. Do not use accetance number c=2 because r(c)=6.50896> 2 1 =6. Use accetance number c=3 because r(c)=4.88962 2 1 =6. Use the samle size n=112 ASN() 800 600 400 200 0.00 Exercise 13.14 1 = 0.01; (* AQL * ) α = 0.05; (* roducer's risk * ) 2 = 0.07; (* LTPD * ) β = 0.10; (* consumer's risk * ) gdist = NormalDistribution[0, 1]; Φ[x_] := CDF[gdist, x]; Ω[x_] := Quantile[gdist, x]; n σ = Ceiling Ω[1 - α] - Ω[β] Ω[ 2 ] - Ω[ 1 ] 2 ; k σ = Ω[ 2] Ω[1 - α] - Ω[ 1 ] Ω[β] ; Ω[β] - Ω[1 - α] PVar[n_, _] = Φ n (- k σ - Ω[]) ; i = n σ ; While[PVar[i, 1 ] < 1 - α PVar[i, 2 ] > β, Print["Do not use samle size n σ =", i, " because P a [ 1 ]=", PVar[i, 1 ], "<", 1 - α, " or P a [ 2 ]=", PVar[i, 2 ], ">", β]; i++] Print["Use samle size n σ =", i, " and accetance constant k σ =", k σ, " because P a [ 1 ]=", PVar[i, 1 ], " ", 1 - α, " and P a [ 2 ]=", PVar[i, 2 ], " ", β] Use samle size n σ =12 and accetance constant k σ = 1.84827 because P a [ 1 ]=0.951149 0.95 and P a [ 2 ]=0.0984707 0.1

20 Ex-Ca13.nb bdist[n_, t_] := BinomialDistribution[n, t]; dist[n_, t_] := PoissonDistribution[n * t]; hdist[n_, t_, ng_] := HyergeometricDistribution[n, Round[t * ng], ng]; bin[x_, n_, t_, ng_] := PDF[bdist[n, t], x]; oi[x_, n_, t_, ng_] := PDF[dist[n, t], x]; hi[x_, n_, t_, ng_] := PDF[hdist[n, t, ng], x]; c Pa[_, {n_, c_, ng_}, f_] := f[d, n,, ng]; d=0 Paatr[_, {{a_, b_}, {e_, d_}}, ng_, f_] := Pa[, {lanoamosatrib[{{a, b}, {e, d}}, ng, f][[1]], lanoamosatrib[{{a, b}, {e, d}}, ng, f][[2]], ng}, f] lanoamosatrib[{{a_, b_}, {e_, d_}}, ng_, f_] := Module[{n, c}, j = 0; t = 0; While[t 0, i = 2; While[i ng && Pa[a, {i, j, ng}, f] 1 - b, i = i + 1] If[Pa[e, {i - 1, j, ng}, f] d, t = 1, t = 0]; j = j + 1]; While[ Pa[a, {i - 1, j - 1, ng}, f] 1 - b && Pa[e, {i - 1, j - 1, ng}, f] d, i = i - 1]; {n = i, c = j - 1}] n tot = 500; (* lot size * ) 1 = 0.01; (* AQL * ) α = 0.05; (* roducer's risk * ) 2 = 0.07; (* LTPD * ) β = 0.10; (* consumer's risk * ) Print["Use the samle size and accetance number, (n,c)=", lanoamosatrib[{{ 1, α}, { 2, β}}, n tot, hi]] Use the samle size and accetance number, (n,c)={72, 2}

Ex-Ca13.nb 21 G1 = Plot[PVar[12, ], {, 0.001, 0.15}, PlotStyle RGBColor[0, 1, 0], AxesLabel {"", ""}, DislayFunction Identity]; (* GREEN * ) listoca = Table[{, N[CDF[HyergeometricDistribution[72, Round[n tot ], n tot ], 2], 5]}, {, 0.005, 0.15, 0.005}]; TableForm[listOCA, TableHeadings {None, {"", "OC A ()"}}]; G2 = ListPlot[listOCA, PlotStyle RGBColor[1, 0, 0], DislayFunction Identity]; (* RED * ) riskoints = {{ 1, 1 - α}, { 2, β}}; G3 = ListPlot[riskoints, PlotStyle PointSize[0.014], DislayFunction Identity]; Show[G1, G2, G3, DislayFunction $DislayFunction] (* OC curve tye B, roducer's risk oint (left) and consumer's risk oint (right). * )

22 Ex-Ca13.nb Exercise 13.15 In[1]:= 1 = 0.01; (* AQL * ) α = 0.05; (* roducer's risk * ) 2 = 0.07; (* LTPD * ) β = 0.10; (* consumer's risk * ) gdist = NormalDistribution[0, 1]; Φ[x_] := CDF[gdist, x]; Ω[x_] := Quantile[gdist, x]; n σ = Ceiling Ω[1 - α] - Ω[β] Ω[ 2 ] - Ω[ 1 ] 2 ; k σ = Ω[ 2] Ω[1 - α] - Ω[ 1 ] Ω[β] ; Ω[β] - Ω[1 - α] PVar[n_, _] = Φ n (- k σ - Ω[]) ; i = n σ ; While[PVar[i, 1 ] < 1 - α PVar[i, 2 ] > β, Print["Do not use samle size n σ =", i, " because P a [ 1 ]=", PVar[i, 1 ], "<", 1 - α, " or P a [ 2 ]=", PVar[i, 2 ], ">", β]; i++] Print["Use samle size n σ =", i, " and accetance constant k σ =", k σ, " because P a [ 1 ]=", PVar[i, 1 ], " ", 1 - α, " and P a [ 2 ]=", PVar[i, 2 ], " ", β] Use samle size n σ =12 and accetance constant k σ = 1.84827 because P a [ 1 ]=0.951149 0.95 and P a [ 2 ]=0.0984707 0.1

Ex-Ca13.nb 23 In[14]:= n σ = 12; k σ = 1.848273; u = 3 n σ k σ 2-2 + 8; v = 3 n σ 2 k σ 2 ; n s = Ceiling n σ + u + u2 + 24 v 12 ; k s = 3 n s - 3 3 n s - 4 k σ; Ω[1 - ] - k PVarDesc[n_, k_, _] = Φ 1+ 3 n k2 6 n- 8 n 3 n- 4 3 n- 3 ; (* PVarDesc[n_,k_,_]= CDF NoncentralStudentTDistribution n- 1, n Ω[],- n k ; * ) i = n s ; While PVarDesc i, 3 i - 3 3 i - 4 k σ, 1 < 1 - α PVarDesc i, 3 i - 3 3 i - 4 k σ, 2 > β, Print "Do not use samle size n s =", i, " and accetance constant k s =", 3 i - 3 3 i - 4 k σ, " because P a [ 1 ]=", PVarDesc i, 3 i - 3 3 i - 4 k σ, 1, "<", 1 - α, " or P a [ 2 ]=", PVarDesc i, 3 i - 3 3 i - 4 k σ, 2, ">", β ; i++ Print "Use samle size n s =", i, " and accetance constant k s =", 3 i - 3 3 i - 4 k σ, " because P a [ 1 ]=", PVarDesc i, 3 i - 3 3 i - 4 k σ, 1, " ", 1 - α, " and P a [ 2 ]=", PVarDesc i, 3 i - 3 3 i - 4 k σ, 2, " ", β Use samle size n s =34 and accetance constant k s = 1.85768 because P a [ 1 ]=0.952257 0.95 and P a [ 2 ]=0.0969855 0.1

24 Ex-Ca13.nb In[30]:= G1 = Plot[PVarDesc[34, 1.857679, ], {, 0.001, 0.15}, PlotStyle RGBColor[1, 0, 0], AxesLabel {"", ""}, DislayFunction Identity]; (* RED * ) G2 = Plot CDF NoncentralStudentTDistribution 34-1, 34. Ω[], - 34 1.857679, {, 0.001, 0.15}, PlotStyle RGBColor[0, 1, 0], DislayFunction Identity ; (* GREEN * ) G3 = Plot Φ 12 (- 1.848273 - Ω[]), {, 0.001, 0.15}, PlotStyle RGBColor[0, 0, 1], DislayFunction Identity ; (* BLUE * ) riskoints = {{ 1, 1 - α}, { 2, β}}; G4 = ListPlot[riskoints, PlotStyle PointSize[0.014], DislayFunction Identity]; Show[G1, G2, G3, G4, DislayFunction $DislayFunction] Out[35]=

Ex-Ca13.nb 25 Exercise 13.17 In[36]:= 1 = 0.01; (* AQL * ) α = 0.05; (* roducer's risk * ) 2 = 0.07; (* LTPD * ) β = 0.10; (* consumer's risk * ) gdist = NormalDistribution[0, 1]; Φ[x_] := CDF[gdist, x]; Ω[x_] := Quantile[gdist, x]; Ω[1 - ] - k PVarDesc[n_, k_, _] = Φ 1+ 3 n k2 6 n- 8 n 3 n- 4 3 n- 3 ; G1 = Plot[PVarDesc[34, 1.857679, ], {, 0.001, 0.15}, PlotStyle RGBColor[1, 0, 0], AxesLabel {"", ""}, DislayFunction Identity]; (* RED * ) G2 = Plot CDF NoncentralStudentTDistribution 34-1, 34. Ω[], - 34 1.857679, {, 0.001, 0.15}, PlotStyle RGBColor[0, 1, 0], DislayFunction Identity ; (* GREEN * ) G3 = Plot[PVarDesc[25, 1.85, ], {, 0.001, 0.15}, PlotStyle RGBColor[0, 0, 1], DislayFunction Identity]; (* BLUE * ) G4 = Plot CDF NoncentralStudentTDistribution 25-1, 25 Ω[], - 25 1.85, {, 0.001, 0.15}, PlotStyle RGBColor[1, 0, 1], DislayFunction Identity ; (* MAGENTA * ) riskoints = {{ 1, 1 - α}, { 2, β}}; G5 = ListPlot[riskoints, PlotStyle PointSize[0.014], DislayFunction Identity]; Show[G1, G3, G5, DislayFunction $DislayFunction] Show[G2, G4, G5, DislayFunction $DislayFunction] Show[G1, G2, G3, G4, G5, DislayFunction $DislayFunction] Out[50]=

26 Ex-Ca13.nb Out[51]= Out[52]=