This function is used to compute statistics required by the u chart.
Usage
qcs.u(x, ...)
# S3 method for default
qcs.u(
x,
var.index = 1,
sample.index = 2,
covar.index = NULL,
covar.names = NULL,
data.name = NULL,
sizes = NULL,
center = NULL,
conf.nsigma = 3,
limits = NULL,
plot = FALSE,
...
)
# S3 method for qcd
qcs.u(x, center = NULL, conf.nsigma = 3, limits = NULL, plot = FALSE, ...)
Arguments
- x
An object of class "qcd".
- ...
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 thesample.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.
- 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-values vector specifying control limits.
- plot
Logical value. If
TRUE
a u chart should be plotted.
Examples
data(pcmanufact)
attach(pcmanufact)
#> The following objects are masked from orangejuice (pos = 3):
#>
#> sample, size
#> The following objects are masked from orangejuice (pos = 4):
#>
#> sample, size
#> The following object is masked from pistonrings (pos = 5):
#>
#> sample
#> The following object is masked from pistonrings (pos = 6):
#>
#> sample
#> The following objects are masked from circuit:
#>
#> sample, size, x
#> The following objects are masked from orangejuice (pos = 8):
#>
#> sample, size
str(pcmanufact)
#> 'data.frame': 20 obs. of 3 variables:
#> $ x : int 10 12 8 14 10 16 11 7 10 15 ...
#> $ sample: int 1 2 3 4 5 6 7 8 9 10 ...
#> $ size : int 5 5 5 5 5 5 5 5 5 5 ...
datos <- pcmanufact
datos$sample <- 1:length(datos$x)
str(datos)
#> 'data.frame': 20 obs. of 3 variables:
#> $ x : int 10 12 8 14 10 16 11 7 10 15 ...
#> $ sample: int 1 2 3 4 5 6 7 8 9 10 ...
#> $ size : int 5 5 5 5 5 5 5 5 5 5 ...
sizes <- datos[,2]
datos.qcd <- qcd(data = datos, var.index = 1,sample.index = 2,
sizes = sizes, type.data = "atributte")
res.qcs <- qcs.u(datos.qcd)
summary(res.qcs)
#> u chart for datos
#>
#> Summary of group statistics:
#> u
#> Min. : 0.2500
#> 1st Qu.: 0.5215
#> Median : 0.8466
#> Mean : 1.8635
#> 3rd Qu.: 2.1667
#> Max. :10.0000
#>
#> Summary of group sample sizes:
#> sizes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#> counts 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#>
#> Number of groups: 20
#> Center of group statistics: 0.9190476
#> Standard deviation: 0.9586697
#>
#> Control limits:
#> LCL UCL
#> 0.000000000 3.795057
#> 0.000000000 2.952693
#> 0.000000000 2.579512
#> 0.000000000 2.357052
#> 0.000000000 2.205238
#> 0.000000000 2.093173
#> 0.000000000 2.006077
#> 0.000000000 1.935870
#> 0.000000000 1.877717
#> 0.009573674 1.828522
#> 0.051898236 1.786197
#> 0.088815294 1.749280
#> 0.121386202 1.716709
#> 0.150401845 1.687693
#> 0.176465252 1.661630
#> 0.200045334 1.638050
#> 0.221512945 1.616582
#> 0.241165764 1.596929
#> 0.259245872 1.578849
#> 0.275952425 1.562143
#>
#> Beyond limits of control:
#> [1] 10.000000 6.000000 2.666667 3.500000 2.666667 0.250000
#>
#> Violationg runs:
#> [1] 1.5714286 0.4705882 0.5555556 0.3684211 0.2500000
plot(res.qcs)