简体   繁体   中英

Drawing an xbar and R chart using qcc package in R program

The following data shows the average ( xbar ) and range ( r ) for 6 samples of size 5 each.

xbar <- c(1080͵1390͵1460͵1380͵1090͵1230)
   r <- c(420͵670͵180͵320͵70͵690)

how can we draw an xbar and r chart using this kind of data using qcc package of R program? ( Here we don't have individual observations of the sample but only their means and R values. )

#x-Bar
library(qcc)  
 x=c(1080͵ 1390͵ 1460͵ 1380͵ 1090͵ 1230)  
 xbarchart = qcc(x, type="xbar.one", std.dev = "SD")
#Range
   library(qcc)  
    r=array(c(420͵ 670͵ 180͵ 320͵ 70͵ 690, 0, 0, 0, 0, 0, 0),dim=c(6,2))  
    rchart = qcc(r, type="R")

You would need the individual values to correctly create an XBar-R chart with qcc or other stats packages. If you only have the summary data (averages of five values), you can chart the XBar data using xbar.one qcc chart type (aka "individual chart") as depicted in the answer above. That will create a chart that looks fine, but probably won't have the right limits automatically calculated.

The second command above will definitely produce a chart that plots ranges, but the calculated control limits (and hence any rule violations?) would not be valid without knowing the individual results.

If you don't have the individuals, it might be better to treat the 5 point computed values as individuals, and use a moving range chart instead of an R chart to chart between measurement variability. There are examples on how to compute the moving range using R and then plot in qcc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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