简体   繁体   English

Shewhart标志控制图

[英]Shewhart Sign Control Chart

I have written this function in the hope of obtaining a Nonparametric Shewhart Sign Control Chart used in statistical quality control. 我编写此函数是为了希望获得用于统计质量控制的非参数Shewhart符号控制图。 The function is:- 功能是:-

    Shewhart.Sign<-function(data,size)
    {
    y<- as.matrix(data,ncol=size)
    n<-nrow(data)
    p<-ncol(y)
    center<-0

    ##Charting Statistic SNt##
    Rnk<-t(apply(y,1,rank))
    Sgn<-t(apply(y,1,sign))
    med<-369
    Calc<-t(apply(x-med,1,sign))
    Psi<-Calc*Rnk
    SNt<-t(t(apply(Psi,1,sum))
    U<-10

    ##Upper & Lower Control Limits##
    UCL<- +U
    LCL<- -U

    ## Drawing the Shewhart Sign Control_Chart ##
    xmin <- 1;  xmax <- n
    ymin <- LCL; ymax <- UCL
    x<-seq(from=1, to=n, by=1)

    plot(x, SNt,xlim=c(xmin,xmax), ylim=c(ymin,ymax),pch=16, cex=1.25,
    col="red", type="b", xlab= "Subgroup",ylab=expression(paste("SNt")),
    main="Shewhart Sign Control Chart")))
    abline(h=UCL, col = "red", lty = 2)
    abline(h=LCL, col = "red", lty = 2)
    abline(h=0, col="black",lty=2)
    }

However I keep getting this error:- 但是我一直收到这个错误:

    > Shewhart.Sign<-edit()
    Error in .External2(C_edit, name, file, title, editor) : 
     unexpected symbol occurred on line 15
    use a command like
     x <- edit()
     to recover

I can not seem to locate the mistake in my function 我似乎无法在我的职能中找到错误

Using the following data and a size of 7 , the function at the end, Shewhart.Sign(V,7) , seems to provide the chart you are looking for. 使用以下数据,大小为7 ,最后的函数Shewhart.Sign(V,7)似乎提供了您想要的图表。

V <- c(-.01,-.04,.08,-.08,.03,-.02,.08,-.05,.01,.01,.06,0,0,.11,.06,-.05,-.01,-.03,.04,.05,.07,.03,-.02,.02,.04,.02,-.01,.08,.02,.07,.01,.03,.01,.01,.08,.11,.10,.12,.12,.13,.12,.06,.08,.11,.12,.12,.13,.12,.06,.07,.04,.06,.07,.07,.05,.07,.04,.01,.01,0,-.02,.03,.08,-.01,.04,.02,0,.01,.01,.14)

The function: 功能:

Shewhart.Sign<-function(data,size)
{
  y<-matrix(data, ncol = size, byrow = TRUE)
  n<-nrow(y)
  p<-ncol(y)
  center<-0

  ##Charting Statistic SNt##
  Rnk<-t(apply(y,1,rank))
  Sgn<-t(apply(y,1,sign))
  med<-369
  Calc<-t(apply(y-med,1,sign))
  Psi<-Calc*Rnk
  SNt<-t(t(apply(Psi,1,sum)))
  d<-0 # The number of signs that should signal an error
  U<-2*d-p

  ##Upper & Lower Control Limits##
  UCL<- +U
  LCL<- -U

  ## Drawing the Shewhart Sign Control_Chart ##
  xmin <- 1;  xmax <- n
  ymin <- LCL; ymax <- UCL
  x<-seq(from=1, to=n, by=1)

  plot(x, SNt,xlim=c(xmin,xmax), ylim=c(ymin,ymax),pch=16, cex=1.25,
              col="red", type="b", xlab= "Subgroup",ylab=expression(paste("SNt")),
              main="Shewhart Sign Control Chart")
  abline(h=UCL, col = "red", lty = 2)
  abline(h=LCL, col = "red", lty = 2)
  abline(h=0, col="black",lty=2)
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM