Más aplicaciones estadísticas en:

https://rpubs.com/orlandoan

0. Introducción.

Los datos utilizados son tomados del libro Control estadístico de la calidad de Douglas C. Montgomery.

1. Carta Cusum.

Página 407.

x1<-c(9.45,7.99,9.29,11.66,12.16,10.18,8.04,11.46,9.2,10.34,9.03,11.47,
10.51,9.4,10.08,9.37,10.62,10.31,8.52,10.84,10.9,9.33,12.29,11.5,
10.6,11.08,10.38,11.62,11.31,10.52)
ca<-qcc(x1[1:20],newdata=x1[21:30],type="xbar.one")

summary(ca)
## 
## Call:
## qcc(data = x1[1:20], type = "xbar.one", newdata = x1[21:30])
## 
## xbar.one chart for x1[1:20] 
## 
## Summary of group statistics:
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  7.9900  9.2675 10.1300  9.9960 10.6750 12.1600 
## 
## Group sample size:  1
## Number of groups:  20
## Center of group statistics:  9.996
## Standard deviation:  1.374113 
## 
## Summary of group statistics in x1[21:30]:
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  9.3300 10.5400 10.9900 10.9530 11.4525 12.2900 
## 
## Group sample size:  1
## Number of groups:  10 
## 
## Control limits:
##      LCL      UCL
##  5.87366 14.11834
n<-length(x1);n
## [1] 30
z<-(x1-10);z
##  [1] -0.55 -2.01 -0.71  1.66  2.16  0.18 -1.96  1.46 -0.80  0.34 -0.97  1.47
## [13]  0.51 -0.60  0.08 -0.63  0.62  0.31 -1.48  0.84  0.90 -0.67  2.29  1.50
## [25]  0.60  1.08  0.38  1.62  1.31  0.52
z1<-z[1];z1
## [1] -0.55
for(i in 2:n){
z1[i]=z[i]+z1[i-1]}
z1
##  [1] -0.55 -2.56 -3.27 -1.61  0.55  0.73 -1.23  0.23 -0.57 -0.23 -1.20  0.27
## [13]  0.78  0.18  0.26 -0.37  0.25  0.56 -0.92 -0.08  0.82  0.15  2.44  3.94
## [25]  4.54  5.62  6.00  7.62  8.93  9.45
ca1<-qcc(z1[1:20],newdata=z1[21:30],type="xbar.one")

summary(ca1)
## 
## Call:
## qcc(data = z1[1:20], type = "xbar.one", newdata = z1[21:30])
## 
## xbar.one chart for z1[1:20] 
## 
## Summary of group statistics:
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -3.2700 -0.9900 -0.1550 -0.4390  0.2625  0.7800 
## 
## Group sample size:  1
## Number of groups:  20
## Center of group statistics:  -0.439
## Standard deviation:  0.8767264 
## 
## Summary of group statistics in z1[21:30]:
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.150   2.815   5.080   4.951   7.215   9.450 
## 
## Group sample size:  1
## Number of groups:  10 
## 
## Control limits:
##        LCL      UCL
##  -3.069179 2.191179
cu <- cusum(x1, lambda=0.1, nsigmas=3,std.dev=1)

summary(cu)
## 
## Call:
## cusum(data = x1, std.dev = 1, lambda = 0.1, nsigmas = 3)
## 
## cusum chart for x1 
## 
## Summary of group statistics:
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   7.990   9.377  10.445  10.315  11.252  12.290 
## 
## Group sample size:  1
## Number of groups:  30
## Center of group statistics:  10.315
## Standard deviation:  1 
## 
## Decision interval (std.err.): 5 
## Shift detection  (std. err.): 1
x11<-x1[1:20]
x12<-x1[21:30]
cu1 <- cusum(x11, lambda=0.1, nsigmas=3,center=10)

x12<-x1[21:30]
cu2 <- cusum(x12, lambda=0.1, nsigmas=3,center=11)

cu3<-cusum(x11, newdata=x12,nsigmas=3,lambda=0.1)

plot(cu3, chart.all=FALSE)

2. Carta Ewma.

x2<-c(9.45,7.99,9.29,11.66,12.16,10.18,8.04,11.46,9.2,10.34,9.03,11.47,
10.51,9.4,10.08,9.37,10.62,10.31,8.52,10.84,10.9,9.33,12.29,11.5,
10.6,11.08,10.38,11.62,11.31,10.52)
ew <- ewma(x2, lambda=0.1,nsigmas=3,std.dev=1,center=10)

summary(ew)
## 
## Call:
## ewma(data = x2, center = 10, std.dev = 1, lambda = 0.1, nsigmas = 3)
## 
## ewma chart for x2 
## 
## Summary of group statistics:
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  7.9900  9.3775 10.4450 10.3150 11.2525 12.2900 
## 
## Group sample size:  1
## Number of groups:  30
## Center of group statistics:  10
## Standard deviation:  1 
## 
## Smoothing parameter: 0.1 
## Control limits:
##            LCL      UCL
## [1,]  9.700000 10.30000
## [2,]  9.596391 10.40361
## ...                    
## [30,] 9.312371 10.68763

Paquete utilizado: qcc

|-|-|-|

O.M.F.

|-|-|-|