Skip to contents

This function is used to compute statistics required by the xbar chart.

Usage

qcs.xbar(x, ...)

# S3 method for default
qcs.xbar(
  x,
  var.index = 1,
  sample.index = 2,
  covar.index = NULL,
  covar.names = NULL,
  data.name = NULL,
  sizes = NULL,
  center = NULL,
  std.dev = c("UWAVE-R", "UWAVE-SD", "MVLUE-R", "MVLUE-SD", "RMSDF"),
  conf.nsigma = 3,
  limits = NULL,
  plot = FALSE,
  ...
)

# S3 method for qcd
qcs.xbar(
  x,
  center = NULL,
  std.dev = c("UWAVE-R", "UWAVE-SD", "MVLUE-R", "MVLUE-SD", "RMSDF"),
  conf.nsigma = 3,
  limits = NULL,
  plot = FALSE,
  ...
)

Arguments

x

An object of class "qcd" (Quality Control Data).

...

Arguments passed to or from methods.

var.index

A scalar with the column number corresponding to the observed data for the variable (the variable quality). Alternativelly can be a string with the name of the quality variable.

sample.index

A scalar with the column number corresponding to the index fo each group (sample).

covar.index

Optional. A scalar or numeric vector with the column number(s) corresponding to the covariate(s). Alternativelly it can be a character vector with the names of the covariates.

covar.names

Optional. A string or vector of strings indicating the names for the covariate columns. Only valid if there is more than one column of data. By default, takes the names from the original object.

data.name

A string specifying the name of the variable which appears on the plots. If not provided, it is taken from the object given as data.

sizes

Optional. A value or a vector of values specifying the sample sizes associated with each group. For continuous data, the sample sizes are obtained counting the non-NA elements of the sample.index vector. For attribute variable the argument sizes is required.

center

A value specifying the center of group statistics or the ''target'' value of the process.

std.dev

A value or an available method specifying the within-group standard deviation(s) of the process. Several methods are available for estimating the standard deviation in case of a continuous process variable.

conf.nsigma

A numeric value used to compute control limits, specifying the number of standard deviations (if conf.nsigma > 1) or the confidence level (if 0 < conf.nsigma < 1).

limits

A two-value vector specifying control limits.

plot

Logical value. If TRUE a xbar chart should be plotted.

References

Montgomery, D.C. (2000)

Examples


##
##  Continuous data 
##
library(qcr)
data(pistonrings)
str(pistonrings)
#> 'data.frame':	200 obs. of  3 variables:
#>  $ diameter: num  74 74 74 74 74 ...
#>  $ sample  : int  1 1 1 1 1 2 2 2 2 2 ...
#>  $ trial   : logi  TRUE TRUE TRUE TRUE TRUE TRUE ...
pistonrings.qcd<-qcd(pistonrings)

class(pistonrings.qcd)
#> [1] "qcd"        "data.frame"

res.qcs <- qcs.xbar(pistonrings.qcd)
plot(res.qcs,title="Control Chart Xbar for pistonrings I")

summary(res.qcs)  
#> xbar chart for pistonrings 
#> 
#> Summary of group statistics:
#>       xbar      
#>  Min.   :73.99  
#>  1st Qu.:74.00  
#>  Median :74.00  
#>  Mean   :74.00  
#>  3rd Qu.:74.01  
#>  Max.   :74.02  
#> 
#> Group sample size:  5
#> Number of groups:  40
#> Center of group statistics:  74.0036
#> Standard deviation:  0.01007094 
#> 
#> Control limits: 
#>       LCL      UCL
#>  73.99009 74.01712
#> 
#> Beyond limits of control: 
#> [1] 74.0196 74.0234
#> 
#> Violationg runs: 
#> [1] 74.0128

res.qcd <- state.control(res.qcs)
res.qcs <- qcs.xbar(res.qcd)
plot(res.qcs,title="Control Chart Xbar for pistonrings II")

summary(res.qcs)  
#> xbar chart for pistonrings 
#> 
#> Summary of group statistics:
#>       xbar      
#>  Min.   :73.99  
#>  1st Qu.:74.00  
#>  Median :74.00  
#>  Mean   :74.00  
#>  3rd Qu.:74.01  
#>  Max.   :74.02  
#> 
#> Group sample size:  5
#> Number of groups:  37
#> Center of group statistics:  74.00239
#> Standard deviation:  0.009992796 
#> 
#> Control limits: 
#>       LCL     UCL
#>  73.98898 74.0158
#> 
#> Beyond limits of control: 
#> [1] 74.0166
#> 
#> Number violationg runs: 0 

res.qcd <- state.control(res.qcs)
res.qcs <- qcs.xbar(res.qcd)
plot(res.qcs,title="Control Chart Xbar for pistonrings III")

summary(res.qcs)  
#> xbar chart for pistonrings 
#> 
#> Summary of group statistics:
#>       xbar      
#>  Min.   :73.99  
#>  1st Qu.:74.00  
#>  Median :74.00  
#>  Mean   :74.00  
#>  3rd Qu.:74.01  
#>  Max.   :74.01  
#> 
#> Group sample size:  5
#> Number of groups:  36
#> Center of group statistics:  74.00199
#> Standard deviation:  0.01004347 
#> 
#> Control limits: 
#>       LCL      UCL
#>  73.98852 74.01547
#> 
#> Number beyond limits: 0 
#> 
#> Number violationg runs: 0 

x <- droplevels(pistonrings[1:125,])
y <- droplevels(pistonrings[126:200,])

res.qcs <- qcs.xbar(x, data.name="Control Chart Xbar for pistonrings")
plot(res.qcs)


res.qcs <- qcs.add(x = res.qcs, value = y[,c(1,2)]) 
plot(res.qcs)

summary(res.qcs)
#> xbar chart for Control Chart Xbar for pistonrings 
#> 
#> Summary of group statistics:
#>       xbar      
#>  Min.   :73.99  
#>  1st Qu.:74.00  
#>  Median :74.00  
#>  Mean   :74.00  
#>  3rd Qu.:74.01  
#>  Max.   :74.02  
#> 
#> Group sample size:  5
#> Number of groups:  40
#> Center of group statistics:  74.0036
#> Standard deviation:  0.01007094 
#> 
#> Control limits: 
#>       LCL     UCL
#>  73.98805 74.0143
#> 
#> Beyond limits of control: 
#> [1] 74.0166 74.0196 74.0234
#> 
#> Violationg runs: 
#> [1] 74.0128


res.qcs <- qcs.xbar(pistonrings.qcd, std.dev="UWAVE-SD")
class(res.qcs)
#> [1] "qcs.xbar" "qcs"     
plot(res.qcs,title="Control Chart Xbar for pistonrings (UWAVE-SD)")

summary(res.qcs)  
#> xbar chart for pistonrings 
#> 
#> Summary of group statistics:
#>       xbar      
#>  Min.   :73.99  
#>  1st Qu.:74.00  
#>  Median :74.00  
#>  Mean   :74.00  
#>  3rd Qu.:74.01  
#>  Max.   :74.02  
#> 
#> Group sample size:  5
#> Number of groups:  40
#> Center of group statistics:  74.0036
#> Standard deviation:  0.01003811 
#> 
#> Control limits: 
#>       LCL      UCL
#>  73.99014 74.01707
#> 
#> Beyond limits of control: 
#> [1] 74.0196 74.0234
#> 
#> Violationg runs: 
#> [1] 74.0128