R/xbarCC.R

"xbarCC" <-
function (xbar, n, sigma, k, mu) 
{
    if (!missing(mu)) {
        UCL <- mu + k * sigma/sqrt(n)
        LCL <- mu - k * sigma/sqrt(n)
    }
    else {
    number.ooc <- 1
    out.of.control <- rep(FALSE, length(xbar))
    while (number.ooc > 0) {
        mu <- mean(xbar[!out.of.control])
        UCL <- mu + k * sigma/sqrt(n)
        LCL <- mu - k * sigma/sqrt(n)
        number.ooc <- sum(((xbar > UCL) | (xbar < LCL))) - sum(out.of.control)
        out.of.control <- ((xbar > UCL) | (xbar < LCL))   
       }
    }
list(CL = mu, UCL = UCL, LCL = LCL, mu = mu)
}

Try the CC package in your browser

Any scripts or data that you put into this service are public.

CC documentation built on Aug. 27, 2019, 9:02 a.m.