Processing math: 100%

Shewhart chart with estimated in-control state

Using normality assumptions

Here we consider an application to a two-sided Shewhart chart, assuming that all observations are normally distributed.

Based on n past in-control observations Xn,,X1, the in-control mean can be estimated by ˆμ=1n1i=nXi and the in-control variance by ˆσ2=1n11i=n(Xiˆμ)2. For new observations X1,X2,, a two-sided Shewhart chart based on these estimated parameters is defined by St=Xtˆμˆσ. and signals when |St|>c for some threshold c.

The following generates a data set of past observations (replace this with your observed past data).

X <-  rnorm(250)

plot of chunk unnamed-chunk-3

Next, we initialise the chart and compute the estimates needed for running the chart - in this case ˆμ and ˆσ.

library(spcadjust)
chartShew <- new("SPCShew",model=SPCModelNormal(),twosided=TRUE);
xihat <- xiofdata(chartShew,X)
str(xihat)
## List of 3
##  $ mu: num 0.0251
##  $ sd: num 1.05
##  $ m : int 250

Calibrating the chart to a given average run length (ARL)

We now compute a threshold that with roughly 90% probability results in an average run length of at least 370 in control. This is based on parametric resampling assuming normality of the observations. You should increase the number of bootstrap replications (the argument nrep) for real applications.

cal <- SPCproperty(data=X,nrep=100,
                   property="calARL", chart=chartShew,
                   params=list(target=370),quiet=TRUE)
cal
## 90 % CI: A threshold of 3.194 gives an in-control ARL of at least
##   370. 
## Unadjusted result:  3 
## Based on  100 bootstrap repetitions.

Run the chart

Next, we run the chart with new observations that are in-control.

newX <- rnorm(100)
S <- runchart(chartShew, newdata=newX,xi=xihat)

plot of chunk unnamed-chunk-8

In the next example, the chart is run with data that are out-of-control from time 51 and onwards.

newX <- rnorm(100,mean=c(rep(0,50),rep(2,50)))
S <- runchart(chartShew, newdata=newX,xi=xihat)

plot of chunk unnamed-chunk-10