# Chapter 15: The Statistical Content of Quality-Improvement Programs¶

## Example, page-468¶

In [1]:
# Variable declaration

x1=[-1,1,-1,1,-1,1,-1,1]   # Solvent
x2=[-1,-1,1,1,-1,-1,1,1]   # Time
x3=[-1,-1,-1,-1,1,1,1,1]   # Temperature
Var = [2048,2813,800,1352,2113,1568,882,1013]      # Variance

# Calculation
from scipy import *
from pylab import *
%matplotlib inline

Var = log(Var)

solvent = 0
for i in range(0,8):
solvent = solvent + x1[i]*Var[i]
solvent = round(solvent/4,3)

time=0
for i in range(0,8):
time = time + x2[i]*Var[i]
time = round(time/4,3)

temp=0
for i in range(0,8):
temp = temp + x3[i]*Var[i]
temp = round(temp/4,3)

st = 0
for i in range(0,8):
st = st + x1[i]*x2[i]*Var[i]
st =round(st/4,3)

stemp = 0
for i in range(0,8):
stemp = stemp + x1[i]*x3[i]*Var[i]
stemp =round(stemp/4,3)

tt = 0
for i in range(0,8):
tt = tt + x2[i]*x3[i]*Var[i]
tt =round(tt/4,3)

stt = 0
for i in range(0,8):
stt = stt + x1[i]*x2[i]*x3[i]*Var[i]
stt =round(stt/4,3)

x = [0.15,0.30,0.45,0.60,0.90,1.2,1.5]
y = [stt,st,stemp,solvent,(-1)*temp,(-1)*tt,(-1)*time]

# Result
print "solvent:",solvent," time:",time
print "temp:",temp," solvent*time:",tt
print "solvent*temp:",st," time*temp:",stemp
print "solvent*time*temp:",stt
scatter(x,y)
title("A Half Normal plot")

solvent: 0.171  time: -0.746
temp: -0.186  solvent*time: 0.091
solvent*temp: 0.161  time*temp: -0.25
solvent*time*temp: 0.057

Out[1]:
<matplotlib.text.Text at 0xa254048>

## Example, page-470¶

In [2]:
# Variable declaration

lsl = 10.98        # Diameter in mm
usl = 11.01        # Diameter in mm
s = 0.0035
x_avg = 10.991

# Calculation
from scipy import *
from pylab import *

Cp = (usl - lsl)/(6*s)
Cp

Cpk = min(x_avg-lsl , usl-x_avg)/(3*s)
Cpk

# Result
print "Second index is smaller than First"

Second index is smaller than First


## Example, Page-483¶

In [3]:
# Variable declaration
alpha = 0.05             # level of significance
x = [210,234,216,232,262,183,227,197,
248,218,256,218,244,259,263,185,
218,196,235,223,212,237,275,240,
217,263,240,247,253,269,231,254,
248,261,268,262,247,292,238,215]
n = 40

# Calculation
from scipy import *
from pylab import *

Mean = mean(x)
s = 25.10
k = 2.126

# Result
print "L =",int(Mean-k*s),"psi"

L = 183 psi