Package 'qcr'

Title: Quality Control Review
Description: Univariate and multivariate SQC tools that completes and increases the SQC techniques available in R. Apart from integrating different R packages devoted to SQC ('qcc','MSQC'), provides nonparametric tools that are highly useful when Gaussian assumption is not met. This package computes standard univariate control charts for individual measurements, X-bar, S, R, p, np, c, u, EWMA and CUSUM. In addition, it includes functions to perform multivariate control charts such as Hotelling T2, MEWMA and MCUSUM. As representative feature, multivariate nonparametric alternatives based on data depth are implemented in this package: r, Q and S control charts. In addition, Phase I and II control charts for functional data are included. This package also allows the estimation of the most complete set of capability indices from first to fourth generation, covering the nonparametric alternatives, and performing the corresponding capability analysis graphical outputs, including the process capability plots.
Authors: Miguel Flores [aut, cre] , Ruben Fernandez-Casal [aut] , Salvador Naya [aut], Javier Tarrio-Saavedra [aut], Jorge Sosa Donoso [ctb]
Maintainer: Miguel Flores <[email protected]>
License: GPL (>= 2)
Version: 1.3
Built: 2024-11-20 03:35:12 UTC
Source: https://github.com/mflores72000/qcr

Help Index


Target archery dataset in the ranking round (used as Phase I)

Description

It consists of a stage in which the archer shoots 72 arrows in 12 ends of six arrows. The information is given in x and y coordinates.

Format

An array of (24 x 2 x 3).

x-coordinate

x-coordinate

y-coordinate

y-coordinate

Examples

data(archery1)
str(archery1) ; plot(archery1)

Circuit boards data

Description

Number of nonconformities observed in 26 successive samples of 100 printed circuit boards. Sample 6 and 20 are out of control limits. Sample 6 was examined by a new inspector and he did not recognize several type of nonconformities that could have been present. Furthermore, the unusually large number of nonconformities in sample 20 resulted from a temperature control problem in the wave soldering machine, which was subsequentely repaired. The last 20 samples are further samples collected on inspection units (each formed by 100 boards).

Format

A data frame with 46 observations on the following 4 variables:

x

Number of defectives in 100 printed circuit boards (inspection unit)

sample

Sample ID

size

Sample size

trial

Trial sample indicator (TRUE/FALSE)

References

Montgomery, D.C. (1991) Introduction to Statistical Quality Control, 2nd ed, New York, John Wiley & Sons, pp. 173–175

Examples

data(circuit)
attach(circuit)
summary(circuit)
boxplot(x ~ trial)
plot(x, type="b")
detach(circuit)

The performance of the counters data

Description

A water supply company wants to control the performance of the water counters installed throughout a city. For this purpose, 60 rational samples have been taken, each one composed by 3 measurements, from the same age (10 years) and caliber water counters corresponding to two different brands, and during a period of 5 years. This dataset is based on a study case of A Coruña’s water supply company, Empresa Municipal de Aguas de La Coruña (Emalcsa).

Format

A data frame with 180 observations on the following 3 variables:

error

The measurement error of the counters (Error: (Real Volume - Measured Volume)/Real Volume)

sample

Sample ID

brand

Brands of providers of counters

Examples

data(counters)
attach(counters)
summary(counters)
plot(error, type="b")
detach(counters)

Dowel pin dataset

Description

Diameter and length of a manufacturing process of a dowel pin.

Format

A data frame with 40 observations on the following 2 variables.

diameter

A numeric vector

length

A numeric vector

Examples

data(dowel1)
str(dowel1) ; plot(dowel1)

Level of employment data

Description

A Spaniard-Argentinian hotel company wants to control the level of occupancy (measured in application of a continuous control. For this purpose, 48 subsamples have been taken from six hotels corresponding to two different countries.

Format

A data frame with 288 observations on the following 3 variables:

occupantion

The amount of occupants in terms of percentage

sample

Sample ID

hemisphere

Hemisphere

Examples

data(employment)
attach(employment)
summary(employment)
boxplot(occupantion ~ hemisphere)
plot(occupantion, type="b")
detach(employment)

It creates a data object to be used in Functional Data Quality Control

Description

Create an object of class 'fdqcd' to perform statistical quality control. This object is used to plot Functional Data Control Charts.

Usage

fdqcd(x, data.name = NULL, ...)

Arguments

x

Matrix of set cases with dimension (n x m), where 'n' is the number of curves and 'm' are the points observed in each curve.

data.name

A string that specifies the title displayed on the plots. If not provided it is taken from the name of the object x.

...

Arguments passed to or from methods.

Examples

library(qcr)
m <- 30
tt<-seq(0,1,len=m)
mu<-30 * tt * (1 - tt)^(3/2)
n0 <- 100
set.seed(12345)
mdata<-matrix(NA,ncol=m,nrow=n0)
sigma <- exp(-3*as.matrix(dist(tt))/0.9)
for (i in 1:n0) mdata[i,]<- mu+0.5*mvrnorm(mu = mu,Sigma = sigma )
fdchart <- fdqcd(mdata)
plot(fdchart,type="l",col="gray")

Function to plot depth functional data (DFD) - chart

Description

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

Usage

fdqcs.depth(x, ...)

## Default S3 method:
fdqcs.depth(
  x,
  data.name = NULL,
  func.depth = depth.mode,
  nb = 200,
  type = c("trim", "pond"),
  ns = 0.01,
  plot = TRUE,
  trim = 0.025,
  smo = 0.05,
  draw.control = NULL,
  ...
)

## S3 method for class 'fdqcd'
fdqcs.depth(
  x,
  func.depth = depth.mode,
  nb = 200,
  type = c("trim", "pond"),
  ns = 0.01,
  plot = TRUE,
  trim = 0.025,
  smo = 0.05,
  draw.control = NULL,
  ...
)

Arguments

x

An object of class 'fdqcd'.

...

Arguments passed to or from methods.

data.name

A string that specifies the title displayed on the plots. If not provided it is taken from the name of the object x.

func.depth

Type of depth measure, by default depth.mode.

nb

The number of bootstrap samples.

type

The method used to trim the data (trim or pond).

ns

Quantile to determine the cutoff from the Bootstrap procedure.

plot

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

trim

The percentage of the trimming.

smo

The smoothing parameter for the bootstrap samples.

draw.control

It specifies the col, lty and lwd for objects: fdataobj, statistic, IN and OUT.

References

Flores, M.; Naya, S.; Fernández-Casal,R.; Zaragoza, S.; Raña, P.; Tarrío-Saavedra, J. Constructing a Control Chart Using Functional Data. Mathematics 2020, 8, 58.

Examples

## Not run: 
library(qcr)
m <- 30
tt<-seq(0,1,len=m)
mu<-30 * tt * (1 - tt)^(3/2)
n0 <- 100
set.seed(12345)
mdata<-matrix(NA,ncol=m,nrow=n0)
sigma <- exp(-3*as.matrix(dist(tt))/0.9)
for (i in 1:n0) mdata[i,]<- mu+0.5*mvrnorm(mu = mu,Sigma = sigma )
fdchart <- fdqcd(mdata)
plot.fdqcd(fdchart,type="l",col="gray")
set.seed(1234)
fddep <- fdqcs.depth(fdchart,plot = T)
plot(fddep,title.fdata = "Fdata",title.depth = "Depth")
summary(fddep)

## End(Not run)

Function to plot rank functional data (RFD) - chart

Description

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

Usage

fdqcs.rank(x, ...)

## S3 method for class 'fdqcd'
fdqcs.rank(
  x,
  y = x,
  func.depth = depth.FM,
  alpha = 0.01,
  plot = TRUE,
  trim = 0.1,
  draw.control = NULL,
  ...
)

Arguments

x

The set of reference curves respect to which the depth is computed. fdqcd class object.

...

Arguments passed to or from methods.

y

The set of new curves to evaluate the depth. fdqcd class object.

func.depth

Type of depth measure, by default depth.FM

alpha

Quantile to determine the cutoff from the Bootstrap procedure.

plot

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

trim

The percentage of the trimming.

draw.control

It specifies the col, lty and lwd for objects: fdataobj, statistic, IN and OUT.

References

Flores, M.; Naya, S.; Fernández-Casal,R.; Zaragoza, S.; Raña, P.; Tarrío-Saavedra, J. Constructing a Control Chart Using Functional Data. Mathematics 2020, 8, 58.

Examples

## Not run: 
library(qcr)
m <- 30
tt<-seq(0,1,len=m)
mu<-30 * tt * (1 - tt)^(3/2)
n0 <- 100
set.seed(12345)
mdata<-matrix(NA,ncol=m,nrow=n0)
sigma <- exp(-3*as.matrix(dist(tt))/0.9)
for (i in 1:n0) mdata[i,]<- mu+0.5*mvrnorm(mu = mu,Sigma = sigma )
fdchart <- fdqcd(mdata)
summary(fdchart)
plot(fdchart,type="l",col="gray")
out <- fddep$out
## Outliers - State in Control
alpha <- 0.005
trim <- 0.1
while (length(out)>0) {
 mdata <- fddep$fdata$data[-out,]
 fddep <- fdqcs.depth(mdata,ns = alpha, trim=trim, plot=FALSE)
 out <- fddep$out
}
plot(fddep,title.fdata = "FD-State in Control",title.depth = "Depth")
# Ha
mu_a<- 30 * tt^(3/2) * (1 - tt)
n_a <- 50
set.seed(12345)
mdata_a<-matrix(NA,ncol=m,nrow=n_a)
for (i in 1:n_a) mdata_a[i,]<- mu_a+0.5*mvrnorm(mu = mu_a,Sigma = sigma )
fdchart_a <- fdqcd(mdata_a,"Curves Monitoring")
plot(fdchart_a)
plot(fdchart,fdchart_a,main="Phase II")
pashe2.chart <- fdqcs.rank(fdchart,fdchart_a)
plot(pashe2.chart,title.fdata = "FDA",title.rank = "Rank")
summary(pashe2.chart)

## End(Not run)

It creates a data object to be used in Multivariante Quality Control

Description

Create an object of class 'mqcd' to perform statistical quality control. This object is used to plot Multivariate Control Charts.

Usage

mqcd(x, data.name = NULL)

Arguments

x

A matrix, a data-frame or an array where it should contain data.

data.name

A string that specifies the title displayed on the plots. If not provided it is taken from the name of the object x.

Examples

library(qcr)
data(dowel1)
str(dowel1)
data.mqcd <- mqcd(dowel1)
str(data.mqcd)

It computes statistics to be used in Multivariante Quality Control

Description

Create an object of class 'mqcs' to perform statistical quality control. This function is used to compute statistics required to plot Multivariate Control Charts

Usage

mqcs(x, method = "sw", ...)

Arguments

x

An object of class 'mqcd' (Multivariante Quality Control Data)

method

The method employed to compute the covariance matrix in individual observation case. Two methods are used "sw" for compute according to (Sullivan,Woodall 1996a) and "hm" by (Holmes,Mergen 1993)

...

Arguments passed to or from methods.


mqcs.add Add a matrix, data.frame or array object with a mqcs object

Description

This function is used to join two objects of type matrix, data.frame or array and mqcs.

Usage

mqcs.add(x, ...)

## Default S3 method:
mqcs.add(x, value, ...)

Arguments

x

Object type mqcs

...

arguments to be passed to or from methods.

value

Object type data.frame, matrix or array


Function to plot mcusum chart

Description

This function is used to compute statistics required by the Multivariate Cumulative Sum (MCUSUM) chart.

Usage

mqcs.mcusum(x, ...)

## Default S3 method:
mqcs.mcusum(
  x,
  data.name = NULL,
  limits = NULL,
  Xmv = NULL,
  S = NULL,
  k = 0.5,
  h = 5.5,
  method = "sw",
  plot = FALSE,
  ...
)

## S3 method for class 'mqcd'
mqcs.mcusum(
  x,
  limits = NULL,
  Xmv = NULL,
  S = NULL,
  k = 0.5,
  h = 5.5,
  method = "sw",
  plot = FALSE,
  ...
)

Arguments

x

An object of class 'mqcd'.

...

Arguments passed to or from methods.

data.name

A string that specifies the title displayed on the plots. If not provided it is taken from the name of the object x.

limits

A two-values vector specifying the control limits.

Xmv

The mean vector. It is only specified for Phase II or when the parameters of the distribution are known.

S

The sample covariance matrix. It is only used for Phase II or when the parameters of the distribution are known.

k

A constant used in MCUSUM chart. Frequently k = 0.5

h

A constant used in MCUSUM chart. Usually h = 5.5

method

The method employed to compute the covariance matrix in the individual observation case. Two methods are used "sw" for compute according to (Sullivan,Woodall 1996a) and "hm" by (Holmes,Mergen 1993)

plot

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

Author(s)

Edgar Santos-Fernandez

See Also

mqcd, mqcs

Examples

##
##  Continuous data 
##
library(qcr)
data(dowel1)
str(dowel1)
data.mqcd <- mqcd(dowel1)
res.mqcs <- mqcs.mcusum(data.mqcd)
summary(res.mqcs)
plot(res.mqcs, title =" MCUSUM Control Chart for dowel1")

Function to plot mewma chart

Description

This function is used to compute statistics required by the Multivariate Exponentially Weighted Moving Average (MEWMA) chart.

Usage

mqcs.mewma(x, ...)

## Default S3 method:
mqcs.mewma(
  x,
  data.name = NULL,
  limits = NULL,
  Xmv = NULL,
  S = NULL,
  method = "sw",
  plot = FALSE,
  ...
)

## S3 method for class 'mqcd'
mqcs.mewma(
  x,
  limits = NULL,
  Xmv = NULL,
  S = NULL,
  lambda = 0.1,
  method = "sw",
  plot = FALSE,
  ...
)

Arguments

x

An object of class 'mqcd'

...

Arguments passed to or from methods.

data.name

A string that specifies the title displayed on the plots. If not provided it is taken from the name of the object x.

limits

A two-values vector specifying the control limits.

Xmv

The mean vector. It is only specified for Phase II or when the parameters of the distribution are known.

S

The sample covariance matrix. It is only used for Phase II or when the parameters of the distribution are known.

method

The method employed to compute the covariance matrix in the individual observation case. Two methods are used "sw" for compute according to (Sullivan,Woodall 1996a) and "hm" by (Holmes,Mergen 1993)

plot

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

lambda

The smoothing constant. Only values of 0.1, 0.2,...,0.9 are allowed.

Author(s)

Edgar Santos-Fernandez

See Also

mqcd, mqcs

Examples

##
##  Continuous data 
##
library(qcr)
data(dowel1)
str(dowel1)
data.mqcd <- mqcd(dowel1)
res.mqcs <- mqcs.mewma(data.mqcd)
summary(res.mqcs)
plot(res.mqcs, title =" MEWMA Control Chart for dowel1")

Function to plot t2 Hotelling chart

Description

This function is used to compute statistics required by the t2 of HOTELLING or Shewhart Multivariate chart.

Usage

mqcs.t2(x, ...)

## Default S3 method:
mqcs.t2(
  x,
  data.name = NULL,
  limits = NULL,
  Xmv = NULL,
  S = NULL,
  colm = NULL,
  alpha = 0.01,
  phase = 1,
  method = "sw",
  plot = FALSE,
  ...
)

## S3 method for class 'mqcd'
mqcs.t2(
  x,
  limits = NULL,
  Xmv = NULL,
  S = NULL,
  colm = NULL,
  alpha = 0.01,
  phase = 1,
  method = "sw",
  plot = FALSE,
  ...
)

Arguments

x

An object of class 'mqcd'

...

Arguments passed to or from methods.

data.name

A string that specifies the title displayed on the plots. If not provided it is taken from the name of the object x.

limits

A two-values vector specifying the control limits.

Xmv

The mean vector. It is only specified for Phase II or when the parameters of the distribution are known.

S

The sample covariance matrix. It is only used for Phase II or when the parameters of the distribution are known.

colm

The number of samples (m) and it is only used in Hotelling control chart for Phase II.

alpha

It is the the significance level (0.01 for default)

phase

Allows to select the type of UCL to use. Only values of phase = 1 or 2 are allowed.

method

The method employed to compute the covariance matrix in the individual observation case. Two methods are used "sw" for compute according to (Sullivan,Woodall 1996a) and "hm" by (Holmes,Mergen 1993)

plot

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

Author(s)

Edgar Santos-Fernandez

See Also

mqcd, mqcs

Examples

##
##  Continuous data 
##
library(qcr)
data(dowel1)
str(dowel1)
data.mqcd <- mqcd(dowel1)
res.mqcs <- mqcs.t2(data.mqcd)
summary(res.mqcs)
plot(res.mqcs, title =" Hotelling Control Chart for dowel1")

data(archery1)
str(archery1)
data.mqcd <- mqcd(archery1)
res.mqcs <- mqcs.t2(data.mqcd)
summary(res.mqcs)
plot(res.mqcs, title =" Hotelling Control Chart for archery1")

Multivariate process state

Description

This function removes observations from the sample which violates the rules of a process under control.

Usage

mstate.control(x)

Arguments

x

Object mqcd (Multivariate Quality Control Statistical)

control

A logical value indicating whether the initial sample comes from a process under control.

Examples

##
##  Continuous data 
##
library(qcr)
set.seed(356)
x <- matrix(rnorm(66),ncol=3)
x <- rbind(x,matrix(rexp(66,100),ncol=3))
dim(x)
x <-mqcd(x)
str(x)
x <-mqcs.mewma(x)
str(x)
plot(x)
data.mqcs <- mstate.control(x)
x <-mqcs.mewma(data.mqcs)
plot(x)

It creates a data object for Non Parametric Quality Control

Description

It creates an object of class 'npqcd' to perform statistical quality control. This object is used to plot Non Parametric Multivariate Control Charts.

Usage

npqcd(x, G = NULL, data.name = NULL)

Arguments

x

A matrix, a data-frame or an array which it should contain data. Dimension has to be the same as that of the observations.

G

The x as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one multivariate observation.

data.name

A string that specifies the title displayed on the plots. If not provided it is taken from the name of the object x.

Examples

library(qcr)

set.seed(356)
data <- matrix(rnorm(999), nc = 3)
x <-rexp(999,0.5) 
x <-matrix(x,ncol=3) 
data.npqcd <- npqcd(data,x)
str(data.npqcd)

Statistical Quality Control Object

Description

Create an object of class 'npqcs' to perform statistical quality control. This function is used to compute statistics required to plot Non Parametric Multivariate Control Charts.

Usage

npqcs(x, method = c("Tukey", "Liu", "Mahalanobis", "RP", "LD"), ...)

Arguments

x

Object npqcd (Non Parametric Multivariate Quality Control Data)

method

Character string which determines the depth function used. method can be "Tukey" (the default), "Liu", "Mahalanobis", "RP" Random Project or "LD" Likelihood depth.

...

Arguments passed to or from methods.


npqcs.add Add a matrix, data.frame or array object with a npqcs object

Description

This function is used to join two objects of type matrix, data.frame or array and npqcs.

Usage

npqcs.add(x, ...)

## Default S3 method:
npqcs.add(x, value, ...)

Arguments

x

Object type npqcs

...

Arguments to be passed to or from methods.

value

Object type data.frame, matrix or array.


Function to plot the Q chart

Description

This function is used to compute statistics required by the Non Parametric Q chart.

Usage

npqcs.Q(x, ...)

## Default S3 method:
npqcs.Q(
  x,
  G,
  data.name = NULL,
  limits = NULL,
  method = c("Tukey", "Liu", "Mahalanobis", "RP", "LD"),
  alpha = 0.01,
  plot = FALSE,
  ...
)

## S3 method for class 'npqcd'
npqcs.Q(
  x,
  data.name,
  limits = NULL,
  method = c("Tukey", "Liu", "Mahalanobis", "RP", "LD"),
  alpha = 0.01,
  plot = FALSE,
  ...
)

Arguments

x

An object of class "npqcd".

...

Arguments passed to or from methods.

G

The x as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one multivariate observation.

data.name

A string that specifies the title displayed on the plots. If not provided it is taken from the name of the object x.

limits

A two-value vector specifying the control limits lower and central.

method

Character string which determines the depth function used. method can be "Tukey" (the default), "Liu", "Mahalanobis", "RP" Random Project or "LD" Likelihood depth.

alpha

It is the significance level (0.01 for default)

plot

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

References

Regina Liu (1995)

Examples

## Not run:  
##
##  Continuous data 
##
library(qcr)
set.seed(12345)
mu<-c(0,0)
Sigma<- matrix(c(1,0,0,1),nrow = 2,ncol = 2)
u <- c(2,2)
S <- matrix(c(4,0,0,4),nrow = 2,ncol = 2)
G <- rmvnorm(540, mean = mu, sigma = Sigma)
x<- rmvnorm(40,mean=u,sigma = S)
x <- rbind(G[501:540,],x)
n <- 4 # samples
m <- 20  # measurements
k <- 2  # number of variables
x.a <- array(,dim=c(n,k,m))
for (i in 1:m){
x.a[,,i] <- x[(1+(i-1)*n):(i*n),] }
M <- G[1:500,]
data.npqcd <- npqcd(x.a,M)
str(data.npqcd)
res.npqcs <- npqcs.Q(data.npqcd,method = "Liu", alpha=0.025)
str(res.npqcs)
summary(res.npqcs)
plot(res.npqcs,title =" Q Control Chart")
## End(Not run)

Function to plot the r chart

Description

This function is used to compute statistics required by the Non Parametric r chart.

Usage

npqcs.r(x, ...)

## Default S3 method:
npqcs.r(
  x,
  G,
  data.name = NULL,
  limits = NULL,
  method = c("Tukey", "Liu", "Mahalanobis", "RP", "LD"),
  alpha = 0.01,
  plot = FALSE,
  ...
)

## S3 method for class 'npqcd'
npqcs.r(
  x,
  data.name,
  limits = NULL,
  method = c("Tukey", "Liu", "Mahalanobis", "RP", "LD"),
  alpha = 0.01,
  plot = FALSE,
  ...
)

Arguments

x

An object of class "npqcd".

...

Arguments passed to or from methods.

G

The x as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one multivariate observation.

data.name

A string that specifies the title displayed on the plots. If not provided it is taken from the name of the object x.

limits

A two-value vector specifying the control limits lower and central.

method

Character string which determines the depth function used. method can be "Tukey" (the default), "Liu", "Mahalanobis", "RP" Random Project or "LD" Likelihood depth.

alpha

It is the significance level (by default alpha = 0.01)

plot

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

References

Regina Liu (1995)

Examples

## Not run: 
library(qcr)
set.seed(356)
mu<-c(0,0)
Sigma<- matrix(c(1,0,0,1),nrow = 2,ncol = 2)
u <- c(2,2)
S <- matrix(c(4,0,0,4),nrow = 2,ncol = 2)
G <- rmvnorm(540, mean = mu, sigma = Sigma)
x<- rmvnorm(40,mean=u,sigma = S)
x <- rbind(G[501:540,],x)
M <- G[1:500,]
data.npqcd <- npqcd(x,M)
str(data.npqcd)
res.npqcs <- npqcs.r(data.npqcd,method = "Liu", alpha=0.025)
str(res.npqcs)
summary(res.npqcs)
plot(res.npqcs,title =" r Control Chart")  
## End(Not run)

Function to plot the S chart

Description

This function is used to compute statistics required by the Non Parametric S chart.

Usage

npqcs.S(x, ...)

## Default S3 method:
npqcs.S(
  x,
  G,
  data.name = NULL,
  limits = NULL,
  method = c("Tukey", "Liu", "Mahalanobis", "RP", "LD"),
  alpha = 0.01,
  plot = FALSE,
  standardize = FALSE,
  ...
)

## S3 method for class 'npqcd'
npqcs.S(
  x,
  data.name,
  limits = NULL,
  method = c("Tukey", "Liu", "Mahalanobis", "RP", "LD"),
  alpha = 0.01,
  plot = FALSE,
  standardize = F,
  ...
)

Arguments

x

An object of class "npqcd".

...

Arguments passed to or from methods.

G

The x as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one multivariate observation.

data.name

A string that specifies the title displayed on the plots. If not provided it is taken from the name of the object x.

limits

A two-value vector specifying the control limits lower and central.

method

Character string which determines the depth function used. method can be "Tukey" (the default), "Liu", "Mahalanobis", "RP" Random Project or "LD" Likelihood depth.

alpha

It is the significance level (by default alpha = 0.01)

plot

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

standardize

A logical value indicating data should be standardized.

References

Regina Liu (1995)

Examples

## Not run: 
##
##  Continuous data 
##
set.seed(12345)
mu<-c(0,0)
Sigma<- matrix(c(1,0,0,1),nrow = 2,ncol = 2)
u <- c(2,2)
S <- matrix(c(4,0,0,4),nrow = 2,ncol = 2)
G <- rmvnorm(540, mean = mu, sigma = Sigma)
x<- rmvnorm(40,mean=u,sigma = S)
x.a <- rbind(G[501:540,],x)
M <- G[1:500,]
data.npqcd <- npqcd(x.a,M)
res.npqcs <- npqcs.S(data.npqcd,method = "Liu", alpha=0.05)
summary(res.npqcs)
plot(res.npqcs,title =" S Control Chart")
## End(Not run)

Non parametric process state

Description

This function removes observations from the sample which violates the rules of a process under control.

Usage

npstate.control(x, control = FALSE)

Arguments

x

An object of class "npqcd" (Quality Control Statitical Non Parametric).

control

A logical value indicating whether the initial sample comes from a process under control.

Examples

## Not run: 
##
##  Continuous data 
##
library(qcr)
set.seed(356)
mu<-c(0,0)
Sigma<- matrix(c(1,0,0,1),nrow = 2,ncol = 2)
mu <- c(2,2)
S <- matrix(c(4,0,0,4),nrow = 2,ncol = 2)
G <- rmvnorm(540, mean = mu, sigma = Sigma)
x<- rmvnorm(40,mean=mu,sigma = S)
x <- rbind(G[501:540,],x)
M <- G[1:500,]
data.npqcd <- npqcd(x,M)
str(data.npqcd)
res.npqcs <- npqcs.r(data.npqcd,method = "Liu", alpha=0.025)
str(res.npqcs)
summary(res.npqcs)
plot(res.npqcs)
new.npqcd <- npstate.control(x = res.npqcs)
res.npqcs <- npqcs.r(new.npqcd)
summary(res.npqcs)
plot(res.npqcs)  

## End(Not run)

Orange juice data

Description

Frozen orange juice concentrate is packed in 6-oz cardboard cans. These cans are formed on a machine by spinning them from cardboard stock and attaching a metal bottom panel. A can is then inspected to determine whether, when filled, the liquid could possible leak either on the side seam or around the bottom joint. If this occurs a can is considered nonconforming. The data were collected as 30 samples of 50 cans each at half-hour intervals over a three-shift period in which the machine was in continuous operation. From sample 15 used, a new bacth of cardboard stock was punt into production. Sample 23 was obtained when an inexperienced operator was temporarily assigned to the machine. After the first 30 samples, a machine adjustment was made. Then further 24 samples were taken from the process.

Format

A data frame with 54 observations on the following 4 variables:

sample

Sample ID

D

Number of defectives

size

Sample sizes

trial

Trial samples (TRUE/FALSE)

References

Montgomery, D.C. (1991) Introduction to Statistical Quality Control, 2nd ed, New York, John Wiley & Sons, pp. 152–155.

Examples

data(orangejuice)
orangejuice$d <- orangejuice$D/orangejuice$size
attach(orangejuice)
summary(orangejuice)
boxplot(d ~ trial)
mark <- ifelse(trial, 1, 2)
plot(sample, d, type="b", col=mark, pch=mark)

Oxidation Onset Temperature

Description

This database contains information about the level of purity of each batch of Picual varities. Then we have the type of oil by measuring the Oxidation Onset Temperature (OOT). We have 50 subsamples of oil with their temperature to oxide, each subsample is size 5.

Format

A data frame with 250 observations on the following 2 variables:

OOT

A quantitative variable that controls the quality of oil.

sample

sample id

Examples

data(oxidation)
attach(oxidation)
summary(oxidation)
plot(OOT, type="b",xlab='Observations')
detach(oxidation)

Personal computer manufacturer data

Description

A personal computer manufacturer counts the number of nonconformities per unit on the final assembly line. He collects data on 20 samples of 5 computers each.

Format

A data frame with 20 observations on the following 3 variables.

x

A quantitative variable that measures the number of nonconformities in each sample.

sample

Sample ID

size

Number of computers inspected.

References

Montgomery, D.C. (1991) Introduction to Statistical Quality Control, 2nd ed, New York, John Wiley & Sons, pp. 181–182

Examples

data(pcmanufact)
summary(pcmanufact)
plot(pcmanufact$x/pcmanufact$size, type="b")

Piston rings data

Description

This is a database that contains information on the inside diameter of piston rings. Piston rings are manufactured for an automobile engine that are produced through a forging process. This process is considered "in control" and is measured on 25 samples, each of size 5.

Format

A data frame with 200 observations on the following 3 variables.

diameter

A numeric vector.

sample

Sample ID

trial

Trial sample indicator (TRUE/FALSE)

References

Montgomery, D.C. (1991) Introduction to Statistical Quality Control, 2nd ed, New York, John Wiley & Sons, pp. 206–213

Examples

data(pistonrings)
attach(pistonrings)
summary(pistonrings)
boxplot(diameter ~ sample)
plot(sample, diameter, cex=0.7)
lines(tapply(diameter,sample,mean))
detach(pistonrings)

Vickers hardness data

Description

A known chemical company is developing a patent for a new variant of artificial stone composed mostly of quartz ( 93wt and polyester resin . This company is launching a pilot plant where it begins to produce plates of this material to industry scale. In order to measure the degree of product homogeneity, 50 samples were taken, performed 5 measurements per plate corresponding to different areas of artificial stone Vickers hardness

Format

A data frame with 250 observations on the following 2 variables:

hardness

A quantitative variable that measure Vickers hardness corresponding to different areas of artificial stone.

sample

Sample ID

Examples

data(plates)
attach(plates)
summary(plates)
plot(hardness, type="b")
detach(plates)

Plot method for 'fdqcd' objects

Description

Generic function for plotting Multivarite charts of object of class 'fdqcd' to perform statistical quality control.

Usage

## S3 method for class 'fdqcd'
plot(x, y = NULL, title = NULL, xlab = NULL, ylab = NULL, col = NULL, ...)

Arguments

x

Object fdqcd (pashe I)

y

Object fdqcd (monitoring)

title

An overall title for the plot.

xlab

A title for the 'x' axis.

ylab

A title for the 'y' axis.

col

The color for curves.

...

Arguments to be passed to or from methods.

Examples

library(qcr)
m <- 30
tt<-seq(0,1,len=m)
mu<-30 * tt * (1 - tt)^(3/2)
n0 <- 100
set.seed(12345)
mdata<-matrix(NA,ncol=m,nrow=n0)
sigma <- exp(-3*as.matrix(dist(tt))/0.9)
for (i in 1:n0) mdata[i,]<- mu+0.5*mvrnorm(mu = mu,Sigma = sigma )
fdchart <- fdqcd(mdata)
plot(fdchart,type="l",col="gray")

Plot method for 'fdqcs.depth' objects

Description

Generic function for plotting charts of object of class 'fdqcs.depth' to perform statistical quality control.

Usage

## S3 method for class 'fdqcs.depth'
plot(
  x,
  title.fdata = NULL,
  title.depth = NULL,
  xlab = NULL,
  ylab = NULL,
  col = NULL,
  draw.control = NULL,
  ...
)

Arguments

x

An object of class fdqcs.depth

title.fdata

An overall title for the fdata plot.

title.depth

An overall title for the depth plot.

xlab

A title for the x axis.

ylab

A title for the y axis.

col

The color for curves.

draw.control

It specifies the col, lty and lwd for objects: fdataobj, statistic, IN and OUT.

...

Arguments to be passed to or from methods.


Plot method for 'fdqcs.rank' objects

Description

Generic function for plotting charts of object of class 'fdqcs.rank' to perform statistical quality control.

Usage

## S3 method for class 'fdqcs.rank'
plot(
  x,
  title.fdata = NULL,
  title.rank = NULL,
  xlab = NULL,
  ylab = NULL,
  col = NULL,
  draw.control = NULL,
  ...
)

Arguments

x

An object of class fdqcs.rank

title.fdata

An overall title for the fdata plot.

title.rank

An overall title for the depth plot.

xlab

A title for the x axis.

ylab

A title for the y axis.

draw.control

It specifies the col, lty and lwd for objects: fdataobj, statistic, IN and OUT.

...

Arguments to be passed to or from methods.


Plot method for 'mqcs' objects

Description

Generic function for plotting Multivarite charts of object of class 'mqcs' to perform statistical quality control.

Usage

## S3 method for class 'mqcs'
plot(x, title, subtitle, xlab, ylab, ylim, ...)

## S3 method for class 'mqcs.t2'
plot(
  x,
  title = NULL,
  subtitle = NULL,
  xlab = NULL,
  ylab = NULL,
  ylim = NULL,
  ...
)

## S3 method for class 'mqcs.mcusum'
plot(
  x,
  title = NULL,
  subtitle = NULL,
  xlab = NULL,
  ylab = NULL,
  ylim = NULL,
  ...
)

## S3 method for class 'mqcs.mewma'
plot(
  x,
  title = NULL,
  subtitle = NULL,
  xlab = NULL,
  ylab = NULL,
  ylim = NULL,
  ...
)

Arguments

x

An Object of class 'mqcs' (Multivarite Quality Control Statical)

title

An overall title for the plot.

subtitle

A sub title for the plot.

xlab

A title for the 'x' axis.

ylab

A title for the 'y' axis.

ylim

The 'y' limits of the plot.

...

Arguments to be passed to or from methods.

Examples

## Not run: 
## 
## Continuous data 
## 
data(dowel1) 
data.mqcd <- mqcd(dowel1)  
res.mqcs <- mqcs.mcusum(data.mqcd) 
plot(res.mqcs, title =" MCUSUM Control Chart ", subtitle="Database dowel1",
     xlab = "Observations", ylab = "MCUSUM", ylim = c(-1,6.5)) 

res1.mqcs <- mqcs.mewma(data.mqcd) 
plot(res1.mqcs, title =" MEWMA Control Chart", subtitle="Database dowel1",
     xlab = "Observations", ylab = "MEWMA", ylim = c(-1,10))
      
res2.mqcs <- mqcs.t2(data.mqcd)
plot(res2.mqcs, title =" Hotelling Control Chart",subtitle="Database dowel1",
     xlab = "Observations", ylab = "T2 Hotelling", ylim = c(-1,14))
## End(Not run)

Plot method for 'npqcs' objects

Description

Generic function for plotting Multivariate charts of object of class 'npqcs' to perform statistical quality control.

Usage

## S3 method for class 'npqcs'
plot(x, title, subtitle, xlab, ylab, ylim, lim = TRUE, ...)

## S3 method for class 'npqcs.r'
plot(
  x,
  title = NULL,
  subtitle = NULL,
  xlab = NULL,
  ylab = NULL,
  ylim = NULL,
  ...
)

## S3 method for class 'npqcs.Q'
plot(
  x,
  title = NULL,
  subtitle = NULL,
  xlab = NULL,
  ylab = NULL,
  ylim = NULL,
  ...
)

## S3 method for class 'npqcs.S'
plot(
  x,
  title = NULL,
  subtitle = NULL,
  xlab = NULL,
  ylab = NULL,
  ylim = NULL,
  ...
)

Arguments

x

An object of class "npqcs" (Multivariate Statistical Quality Control)

title

An overall title for the plot.

subtitle

A sub title for the plot.

xlab

A title for the "x" axis.

ylab

A title for the "y" axis.

ylim

The "y" limits of the plot.

lim

A logical value indicating that limits should be constant.

...

Arguments to be passed to or from methods.


Function to create a plotting 'qcs' object

Description

Generic function for plotting Shewhart charts of object of class 'qcs' to perform statistical quality control.

Usage

## S3 method for class 'qcs'
plot(
  x,
  title,
  subtitle,
  xlab,
  ylab,
  ylim,
  center.nominal = NULL,
  limits.specification = NULL,
  limits.alert = NULL,
  type.data = c("continuous", "atributte", "dependence"),
  ...
)

## S3 method for class 'qcs.xbar'
plot(
  x,
  title = NULL,
  subtitle = NULL,
  xlab = NULL,
  ylab = NULL,
  ylim = NULL,
  conf.nsigma.alert = NULL,
  center.nominal = NULL,
  limits.specification = NULL,
  ...
)

## S3 method for class 'qcs.S'
plot(
  x,
  title = NULL,
  subtitle = NULL,
  xlab = NULL,
  ylab = NULL,
  ylim = NULL,
  conf.nsigma.alert = NULL,
  center.nominal = NULL,
  limits.specification = NULL,
  ...
)

## S3 method for class 'qcs.R'
plot(
  x,
  title = NULL,
  subtitle = NULL,
  xlab = NULL,
  ylab = NULL,
  ylim = NULL,
  conf.nsigma.alert = NULL,
  center.nominal = NULL,
  limits.specification = NULL,
  ...
)

## S3 method for class 'qcs.one'
plot(
  x,
  title = NULL,
  subtitle = NULL,
  xlab = NULL,
  ylab = NULL,
  ylim = NULL,
  conf.nsigma.alert = NULL,
  center.nominal = NULL,
  limits.specification = NULL,
  ...
)

## S3 method for class 'qcs.p'
plot(
  x,
  title = NULL,
  subtitle = NULL,
  xlab = NULL,
  ylab = NULL,
  ylim = NULL,
  conf.nsigma.alert = NULL,
  center.nominal = NULL,
  limits.specification = NULL,
  ...
)

## S3 method for class 'qcs.np'
plot(
  x,
  title = NULL,
  subtitle = NULL,
  xlab = NULL,
  ylab = NULL,
  ylim = NULL,
  conf.nsigma.alert = NULL,
  center.nominal = NULL,
  limits.specification = NULL,
  ...
)

## S3 method for class 'qcs.c'
plot(
  x,
  title = NULL,
  subtitle = NULL,
  xlab = NULL,
  ylab = NULL,
  ylim = NULL,
  conf.nsigma.alert = NULL,
  center.nominal = NULL,
  limits.specification = NULL,
  ...
)

## S3 method for class 'qcs.u'
plot(
  x,
  title = NULL,
  subtitle = NULL,
  xlab = NULL,
  ylab = NULL,
  ylim = NULL,
  conf.nsigma.alert = NULL,
  center.nominal = NULL,
  limits.specification = NULL,
  ...
)

## S3 method for class 'qcs.ewma'
plot(
  x,
  title = NULL,
  subtitle = NULL,
  xlab = NULL,
  ylab = NULL,
  ylim = NULL,
  ...
)

## S3 method for class 'qcs.cusum'
plot(
  x,
  title = NULL,
  subtitle = NULL,
  xlab = NULL,
  ylab = NULL,
  ylim = NULL,
  ...
)

Arguments

x

An object of class "qcs" (Quality Control Statical).

title

An overall title for the plot.

subtitle

A sub title for the plot.

xlab

A title for the "x" axis.

ylab

A title for the "y" axis.

ylim

The "y" limits of the plot.

center.nominal

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

limits.specification

A two-value vector specifying control limits.

limits.alert

A two-value vector specifying control alert limits.

type.data

A string specifying the type of data.

...

Arguments to be passed to or from methods.

conf.nsigma.alert

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).

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).


Level of pressure data

Description

A shipyard of recreational boats manufacturing, intended to optimize and control the mechanical properties hull yacht models. This has made a study in which the modulus of elasticity tensile strength of the epoxy resin (polymer) used, after applying different curing pressures measured: 0.1 y 10 MPa. 60 subsamples composed of three measurements taken on the same day are taken.

Format

A data frame with 180 observations on the following 3 variables:

presion

Presion level.

sample

sample id

measur

Pressures measured: 0.1 y 10 MPa

Examples

data(presion)
attach(presion)
summary(presion)
plot(presion$presion, type="b")
detach(presion)

Quality Control Data

Description

Create an object of class 'qcd' to perform statistical quality control. This object may then be used to plot Shewhart charts, Multivariate Control Charts, and more.

Usage

qcd(
  data,
  var.index = 1,
  sample.index = 2,
  covar.index = NULL,
  covar.names = NULL,
  data.name = NULL,
  type.data = c("continuous", "atributte", "dependence"),
  sizes = NULL
)

Arguments

data

A matrix or data-frame which should contain data, index sample and, optionally, covariate(s).

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.

type.data

A string specifying the type of 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.

Examples

## Not run: 
library(qcr)
data(pistonrings)
str(pistonrings)
pistonrings.qcd<-qcd(pistonrings)
class(pistonrings.qcd)

## End(Not run)

Quality Control Review

Description

Quality Control Review

Details

Univariate and multivariate SQC tools that completes and increases the SQC techniques available in R. Apart from integrating different R packages devoted to SQC ('qcc','MSQC'), provides nonparametric tools that are highly useful when Gaussian assumption is not met. This package computes standard univariate control charts for individual measurements, X-bar, S, R, p, np, c, u, EWMA and CUSUM. In addition, it includes functions to perform multivariate control charts such as Hotelling T2, MEWMA and MCUSUM. As representative feature, multivariate nonparametric alternatives based on data depth are implemented in this package: r, Q and S control charts. In addition, Phase I and II control charts for functional data are included. This package also allows the estimation of the most complete set of capability indices from first to fourth generation, covering the nonparametric alternatives, and performing the corresponding capability analysis graphical outputs, including the process capability plots.


Quality Control Statistics

Description

Create an object of class 'qcs' to perform statistical quality control. This object may then be used to plot Shewhart charts, Multivariate Control Charts, and more.

Usage

qcs(
  x,
  sample.index,
  sizes = NULL,
  type = c("xbar", "R", "S", "one", "p", "np", "c", "u", "ewma", "cusum"),
  center = NULL,
  std.dev,
  conf.nsigma = 3,
  limits = NULL,
  type.data = c("continuous", "atributte", "dependence"),
  lambda = 0.2,
  decision.interval = 5,
  se.shift = 1
)

qcs.continuous(
  x,
  sample.index,
  sizes = NULL,
  type = c("xbar", "R", "S", "one"),
  center = NULL,
  std.dev,
  conf.nsigma = 3,
  limits = NULL
)

qcs.atributte(
  x,
  sample.index = NULL,
  sizes = NULL,
  type = c("p", "np", "c", "u"),
  center = NULL,
  conf.nsigma = 3,
  limits = NULL
)

qcs.dependence(
  x,
  sample.index = NULL,
  sizes = NULL,
  type = c("ewma", "cusum"),
  center = NULL,
  std.dev,
  nsigma = 3,
  lambda = 0.2,
  decision.interval = 5,
  se.shift = 1
)

Arguments

x

An object of class "qcd".

sample.index

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

sizes

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 "p", "np" and "u" charts the argument sizes is required.

type

A character string specifying the group statistics to compute:

Statistic charted Chart description
"xbar" mean means of a continuous process variable
"R" range ranges of a continuous process variable
"S" standard deviation standard deviations of a continuous variable
"one" mean one-at-time data of a continuous process variable
"p" proportion proportion of nonconforming units
"np" count number of nonconforming units
"c" count nonconformities per unit
"u" count average nonconformities per unit
"g" count number of non-events between events
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.

type.data

A string specifying el type de data.

lambda

The smoothing parameter 0λ10 \le \lambda \le 1

decision.interval

A numeric value specifying the number of standard errors of the summary statistics at which the cumulative sum is out of control.

se.shift

The amount of shift to detect in the process, measured in standard errors of the summary statistics.

nsigma

A numeric value used to compute control limits, specifying the number of standard deviations.

Value

Returns an object of class 'qcs'.

References

Montgomery, D.C. (2000) Introduction to Statistical Quality Control, 4th ed. New York: John Wiley & Sons.
Wetherill, G.B. and Brown, D.W. (1991) Statistical Process Control. New York: Chapman & Hall.


qcs.add Add a data.frame object with a qcs object

Description

This function is used to join two objects of type data.frame and qcs.

Usage

qcs.add(x, ...)

## Default S3 method:
qcs.add(
  x,
  value,
  var.index = NULL,
  sample.index = NULL,
  covar.index = NULL,
  ...
)

Arguments

x

Object type qcs

...

Arguments to be passed to or from methods.

value

Object type data.frame

var.index

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

sample.index

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

covar.index

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


Function to plot Shewhart c chart

Description

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

Usage

qcs.c(x, ...)

## Default S3 method:
qcs.c(
  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 class 'qcd'
qcs.c(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 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.

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 c chart should be plotted.

Examples

library(qcr)
data(circuit)
attach(circuit)
str(circuit)
datos <- circuit
datos$sample <- 1:length(datos$x)
str(datos)
sizes <- datos[,2]

datos.qcd <- qcd(data = datos, var.index = 1,sample.index = 2,
                sizes = size, type.data = "atributte")
res.qcs <- qcs.c(datos.qcd)
summary(res.qcs)
plot(res.qcs)

Capability Analysis

Description

Calculates the process capability indices Cp, Cpk, Cpl, Cpu, Cpm, Cpmk for a qcs object and normal distribution. Also, this function calculates confidence limits for CpC_p using the method described by Chou et al. (1990). Approximate confidence limits for CplC_{pl}, CpuC_{pu} and CpkC_{pk} are computed using the method in Bissell (1990). Confidence limits for CpmC_{pm} are based on the method of Boyles (1991); this method is approximate and it assumes the target is midway between the specification limits. Moreover, calculates the process capability indices CNp, CNpk, CNpm, CNpmk for a qcs object. A histogram with a density curve is displayed along with the specification limits, a Quantile-Quantile Plot for the specified distribution and contour graph is plotted for estimate the index Cpm.

Usage

qcs.ca(
  object,
  limits = c(lsl = -3, usl = 3),
  target = NULL,
  std.dev = NULL,
  nsigmas = 3,
  confidence = 0.9973,
  plot = TRUE,
  main = NULL,
  ...
)

Arguments

object

qcs object of type "qcs.xbar" or "qcs.one".

limits

A vector specifying the lower and upper specification limits.

target

A value specifying the target of the process. If it is NULL, the target is set at the middle value between specification limits.

std.dev

A value specifying the within-group standard deviation.

nsigmas

A numeric value specifying the number of sigmas to use.

confidence

A numeric value between 0 and 1 specifying the probabilities for computing the quantiles. This values is used only when object values is provided. By default confidence=0.9973.

plot

Logical value indicating whether graph should be plotted.

main

Title of the plot.

...

Arguments to be passed to or from methods.

References

Montgomery, D.C. (1991) Introduction to Statistical Quality Control, 2nd ed, New York, John Wiley & Sons.
Tong, L.I. and Chen, J.P. (1998), Lower con???dence limits of process capability indices for nonnormal process distributions. International Journal of Quality & Reliability Management, Vol. 15 No. 8/9, pp. 907-19.
Vannman, K (1995) A Unified Approach to Capability Indices. Statitica Sinica,5,805-820.
Vannman, K. (2001). A Graphical Method to Control Process Capability. Frontiers in Statistical Quality Control, No 6, Editors: H-J Lenz and P-TH Wilrich. Physica-Verlag, Heidelberg, 290-311.
Hubele and Vannman (2004). The E???ect of Pooled and Un-pooled Variance Estimators on Cpm When Using Subsamples. Journal Quality Technology, 36, 207-222.

Examples

library(qcr)
data(pistonrings) 
xbar <- qcs.xbar(pistonrings[1:125,],plot = TRUE)
LSL=73.99; USL=74.01
limits = c(lsl = 73.99, usl = 74.01)
qcs.ca(xbar, limits = limits)

Process capability indices (parametric)

Description

Calculates CpCp, CpmCpm using the formulation described by Kerstin Vannman(1995).

Usage

qcs.cp(
  object,
  parameters = c(u = 0, v = 0),
  limits = c(lsl = -3, usl = 3),
  target = NULL,
  mu = 0,
  std.dev = 1,
  nsigmas = 3,
  k = 1,
  contour = TRUE,
  ylim = NULL,
  ...
)

Arguments

object

qcs object of type "qcs.xbar" or "qcs.one".

parameters

A vector specifying the u and v parameters values. If parameters = c(u=0, v=0), the Cp indice is calculed; If parameters = c(u=1, v=0), the Cpk indice is calculed; If parameters = c(u=0, v=1), the Cpm indice is calculed; If parameters = c(u=1, v=1), the Cpmk indice is calculed.

limits

A vector specifying the lower and upper specification limits.

target

A value specifying the target of the process. If it is NULL, the target is set at the middle value between specification limits.

mu

A value specifying the mean of data.

std.dev

A value specifying the within-group standard deviation.

nsigmas

A numeric value specifying the number of sigmas to use.

k

A numeric value. If the capacity index exceeds the k value, then the process is capable.

contour

Logical value indicating whether contour graph should be plotted.

ylim

The 'y' limits of the plot.

...

Arguments to be passed to or from methods.

References

Montgomery, D.C. (1991) Introduction to Statistical Quality Control, 2nd ed, New York, John Wiley & Sons.
Vannman, K (1995) A Unified Approach to Capability Indices. Statitica Sinica,5,805-820.

Examples

library(qcr)
data(pistonrings) 
xbar <- qcs.xbar(pistonrings[1:125,],plot = TRUE)
mu <-xbar$center
std.dev <-xbar$std.dev
LSL=73.99; USL=74.01
qcs.cp(parameters = c(0,0),limits = c(LSL,USL),
      mu = mu,std.dev = std.dev,ylim=c(0,1))
#calculating all the indices
qcs.cp(object = xbar,parameters = c(0,0), limits = c(LSL,USL),ylim=c(0,1))
qcs.cp(object = xbar,parameters = c(1,0), limits = c(LSL,USL),ylim=c(0,1))
qcs.cp(object = xbar,parameters = c(0,1), limits = c(LSL,USL),ylim=c(0,1))
qcs.cp(object = xbar,parameters = c(1,1), limits = c(LSL,USL),ylim=c(0,1))

Process capability indices (Nonparametric)

Description

Calculates CNpCNp, CNpmCNpm using the formulation described by Tong and Chen (1998).

Usage

qcs.cpn(
  object,
  parameters = c(u = 0, v = 0),
  limits = c(lsl = -3, usl = 3),
  q = c(lq = -3, uq = 3),
  target = NULL,
  median = 0,
  nsigmas = 3,
  confidence = 0.9973
)

Arguments

object

qcs object of type "qcs.xbar" or "qcs.one".

parameters

A vector specifying the u and v parameters values. If parameters = c(u=0, v=0), the CNp indice is calculed; If parameters = c(u=1, v=0), the CNpk indice is calculed; If parameters = c(u=0, v=1), the CNpm indice is calculed; If parameters = c(u=1, v=1), the CNpmk indice is calculed.

limits

A vector specifying the lower and upper specification limits.

q

A vector specifying the lower and upper quantiles. These values are necessary, if object value is missing.

target

A value specifying the target of the process. If it is NULL, the target is set at the middle value between specification limits.

median

A value specifying the median of data.

nsigmas

A numeric value specifying the number of sigmas to use.

confidence

A numeric value between 0 and 1 specifying the probabilities for computing the quantiles. This values is used only when object values is provided. By default confidence=0.9973.

References

Montgomery, D.C. (1991) Introduction to Statistical Quality Control, 2nd ed, New York, John Wiley & Sons.
Tong, L.I. and Chen, J.P. (1998), Lower confidence limits of process capability indices for nonnormal process distributions. International Journal of Quality & Reliability Management, Vol. 15 No. 8/9, pp. 907-19.

Examples

library(qcr)
##' data(pistonrings) 
xbar <- qcs.xbar(pistonrings[1:125,],plot = TRUE)
x<-xbar$statistics[[1]]
LSL=73.99; USL=74.01
median <-median(x)
lq=as.numeric(quantile(x,probs=0.00135))
uq=as.numeric(quantile(x,probs=0.99865))
qcs.cpn(parameters = c(0,0),limits = c(LSL,USL),
       median = median, q=c(lq,uq))
qcs.cpn(object = xbar,parameters = c(0,0), limits = c(LSL,USL))
qcs.cpn(object = xbar,parameters = c(1,0), limits = c(LSL,USL))
qcs.cpn(object = xbar,parameters = c(0,1), limits = c(LSL,USL))
qcs.cpn(object = xbar,parameters = c(1,1), limits = c(LSL,USL))

Function to plot the cusum chart

Description

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

Usage

qcs.cusum(x, ...)

## Default S3 method:
qcs.cusum(
  x,
  var.index = 1,
  sample.index = 2,
  covar.index = NULL,
  covar.names = NULL,
  data.name = NULL,
  sizes = NULL,
  center = NULL,
  std.dev = NULL,
  decision.interval = 5,
  se.shift = 1,
  plot = FALSE,
  ...
)

## S3 method for class 'qcd'
qcs.cusum(
  x,
  center = NULL,
  std.dev = NULL,
  decision.interval = 5,
  se.shift = 1,
  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

A value or a vector of values specifying the sample sizes associated with each group.

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.

decision.interval

A numeric value specifying the number of standard errors of the summary statistics at which the cumulative sum is out of control.

se.shift

The amount of shift to detect in the process, measured in standard errors of the summary statistics.

plot

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

Examples

library(qcr)
data(pistonrings)
attach(pistonrings)
res.qcd <- qcd(pistonrings, type.data = "dependence")
res.qcs <- qcs.cusum(res.qcd, type = "cusum")
summary(res.qcs)
plot(res.qcs)

Function to plot ewma chart

Description

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

Usage

qcs.ewma(x, ...)

## Default S3 method:
qcs.ewma(
  x,
  var.index = 1,
  sample.index = 2,
  covar.index = NULL,
  covar.names = NULL,
  data.name = NULL,
  sizes = NULL,
  center = NULL,
  std.dev = NULL,
  nsigma = 3,
  lambda = 0.2,
  plot = FALSE,
  ...
)

## S3 method for class 'qcd'
qcs.ewma(
  x,
  center = NULL,
  std.dev = NULL,
  nsigma = 3,
  lambda = 0.2,
  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 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.

nsigma

A numeric value used to compute control limits, specifying the number of standard deviations.

lambda

The smoothing parameter 0λ10 \le \lambda \le 1

plot

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

Examples

library(qcr)
data(pistonrings)
attach(pistonrings)
res.qcd <- qcd(pistonrings, type.data = "dependence")
res.qcs <- qcs.ewma(res.qcd, type = "ewma")
summary(res.qcs)
plot(res.qcs)

Process capability index (estimate Cpm)

Description

Estimate "Cpm" using the method described by Kerstin Vannman(2001).

Usage

qcs.hat.cpm(
  object,
  limits = c(lsl = -3, usl = 3),
  target = NULL,
  mu = 0,
  std.dev = 1,
  nsigmas = 3,
  k0 = 1,
  alpha = 0.05,
  n = 50,
  contour = TRUE,
  ylim = NULL,
  ...
)

Arguments

object

qcs object of type "qcs.xbar" or "qcs.one".

limits

A vector specifying the lower and upper specification limits.

target

A value specifying the target of the process. If it is NULL, the target is set at the middle value between specification limits.

mu

A value specifying the mean of data.

std.dev

A value specifying the within-group standard deviation.

nsigmas

A numeric value specifying the number of sigmas to use.

k0

A numeric value. If the capacity index exceeds the k value, then the process is capable.

alpha

The significance level (by default alpha=0.05).

n

Size of the sample.

contour

Logical value indicating whether contour graph should be plotted.

ylim

The "y" limits of the plot.

...

Arguments to be passed to or from methods.

References

Montgomery, D.C. (1991) Introduction to Statistical Quality Control, 2nd ed, New York, John Wiley & Sons.
Vannman, K. (2001). A Graphical Method to Control Process Capability. Frontiers in Statistical Quality Control, No 6, Editors: H-J Lenz and P-TH Wilrich. Physica-Verlag, Heidelberg, 290-311.
Hubele and Vannman (2004). The E???ect of Pooled and Un-pooled Variance Estimators on Cpm When Using Subsamples. Journal Quality Technology, 36, 207-222.

Examples

library(qcr)
data(pistonrings) 
xbar <- qcs.xbar(pistonrings[1:125,],plot = TRUE)
mu <-xbar$center
std.dev <-xbar$std.dev
LSL=73.99; USL=74.01
qcs.hat.cpm(limits = c(LSL,USL),
           mu = mu,std.dev = std.dev,ylim=c(0,1))
qcs.hat.cpm(object = xbar, limits = c(LSL,USL),ylim=c(0,1))

Function to plot Shewhart np chart

Description

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

Usage

qcs.np(x, ...)

## Default S3 method:
qcs.np(
  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 class 'qcd'
qcs.np(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 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.

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 np chart should be plotted.

Examples

library(qcr)
data(orangejuice)
str(orangejuice)
attach(orangejuice)

datos.qcd <- qcd(data = orangejuice, var.index = 1, sample.index = 2,
                sizes = size, type.data = "atributte")

res.qcs <- qcs.np(datos.qcd)
summary(res.qcs)
plot(res.qcs)

datos.qcs <- qcs.np(orangejuice[trial,c(1,2)], sizes = orangejuice[trial,3])
plot(datos.qcs)

Function to plot the Shewhart xbar.one chart

Description

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

Usage

qcs.one(x, ...)

## Default S3 method:
qcs.one(
  x,
  var.index = 1,
  sample.index = 2,
  covar.index = NULL,
  covar.names = NULL,
  data.name = NULL,
  sizes = NULL,
  center = NULL,
  std.dev = c("MR", "SD"),
  k = 2,
  conf.nsigma = 3,
  limits = NULL,
  plot = FALSE,
  ...
)

## S3 method for class 'qcd'
qcs.one(
  x,
  center = NULL,
  std.dev = c("MR", "SD"),
  k = 2,
  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 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.

k

Number of successive pairs of observations for computing the standard deviation based on moving ranges of k points.

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.one chart should be plotted.

Examples

##
##  Continuous data 
##
library(qcr)
x <- c(33.75, 33.05, 34, 33.81, 33.46, 34.02, 33.68, 33.27, 33.49, 33.20,
      33.62, 33.00, 33.54, 33.12, 33.84)

sample <- 1:length(x)
datos <- data.frame(x,sample)
datos.qcd <- qcd(datos)

res.qcs <- qcs.one(datos.qcd)
class(res.qcs)
summary(res.qcs)  
 plot(res.qcs, title = "Control Chart Xbar.one for pistonrings")

Function to plot Shewhart p chart

Description

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

Usage

qcs.p(x, ...)

## Default S3 method:
qcs.p(
  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 class 'qcd'
qcs.p(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 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.

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 p chart should be plotted.

Examples

library(qcr)
data(orangejuice)
str(orangejuice)
attach(orangejuice)

datos.qcd <- qcd(data = orangejuice, var.index = 1, sample.index = 2,
                sizes = size, type.data = "atributte")

res.qcs <- qcs.p(datos.qcd)
summary(res.qcs)
plot(res.qcs)

datos.qcs <- qcs.p(orangejuice[trial,c(1,2)], sizes = orangejuice[trial,3])
plot(datos.qcs)

Process capability indices for a given dataset and distribution

Description

Calculates the process capability indices cp, cpk, cpkL and cpkU for a given dataset and distribution. A histogram with a density curve is displayed along with the specification limits and a Quantile-Quantile Plot for the specified distribution.

Usage

qcs.pcr(
  object,
  distribution = c("normal", "beta", "chi-squared", "exponential", "f", "geometric",
    "lognormal", "log-normal", "logistic", "t", "negative binomial", "poisson",
    "weibull", "gamma"),
  limits = c(lsl = -3, usl = 3),
  target = NULL,
  std.dev = NULL,
  boxcox = FALSE,
  lambda = c(-5, 5),
  confidence = 0.9973,
  plot = TRUE,
  main = NULL,
  ...
)

Arguments

object

qcs object of type "qcs.xbar" or "qcs.one".

distribution

Character string that represent the probability distribution of the data, such as: "normal", "beta", "chi-squared", "exponential", "f", "geometric", "lognormal", "log-normal", "logistic","t", "negative binomial", "poisson", "weibull", "gamma".

limits

A vector specifying the lower and upper specification limits.

target

A value specifying the target of the process. If it is NULL, the target is set at the middle value between specification limits.

std.dev

A value specifying the within-group standard deviation.

boxcox

Logical value (by default FALSE). If TRUE, perform a Box-Cox transformation.

lambda

A vector specifying or numeric value indicating lambda for the transformation.

confidence

A numeric value between 0 and 1 specifying the nivel for computing the specification limits.

plot

Logical value indicating whether graph should be plotted.

main

Title of the plot.

...

Arguments to be passed to or from methods.

References

Montgomery, D.C. (1991) Introduction to Statistical Quality Control, 2nd ed, New York, John Wiley & Sons.

Examples

library(qcr)
data(pistonrings) 
xbar <- qcs.xbar(pistonrings[1:125,],plot = TRUE)
limits = c(lsl = 73.99, usl = 74.01)
qcs.pcr(xbar, "normal", limits = limits) 
qcs.pcr(xbar, "weibull", limits = limits)

Function to plot Shewhart R chart

Description

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

Usage

qcs.R(x, ...)

## Default S3 method:
qcs.R(
  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", "MVLUE-R"),
  conf.nsigma = 3,
  limits = NULL,
  plot = FALSE,
  ...
)

## S3 method for class 'qcd'
qcs.R(
  x,
  center = NULL,
  std.dev = c("UWAVE-R", "MVLUE-R"),
  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 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-values vector specifying control limits.

plot

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

See Also

qcs, qcd

Examples

##
##  Continuous data 
##
library(qcr)
data(pistonrings)
str(pistonrings)
pistonrings.qcd<-qcd(pistonrings)

class(pistonrings.qcd)

res.qcs <- qcs.R(pistonrings.qcd)
class(res.qcs)
plot(res.qcs,title="Control Chart R for pistonrings")
summary(res.qcs)

Function to plot Shewhart S chart

Description

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

Usage

qcs.S(x, ...)

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

## S3 method for class 'qcd'
qcs.S(
  x,
  center = NULL,
  std.dev = c("UWAVE-SD", "MVLUE-SD", "RMSDF"),
  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 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-values vector specifying control limits.

plot

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

See Also

qcs, qcd

Examples

##
##  Continuous data 
##
library(qcr)
data(pistonrings)
str(pistonrings)
pistonrings.qcd<-qcd(pistonrings)

class(pistonrings.qcd)

res.qcs <- qcs.S(pistonrings.qcd)
class(res.qcs)
plot(res.qcs,title="Control Chart S for pistonrings")
summary(res.qcs)

Function to plot Shewhart u chart

Description

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

Usage

qcs.u(x, ...)

## Default S3 method:
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 class '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 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.

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.

See Also

qcs, qcd

Examples

data(pcmanufact)
attach(pcmanufact)
str(pcmanufact)
datos <- pcmanufact
datos$sample <- 1:length(datos$x)
str(datos)
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)
plot(res.qcs)

Function to plot the Shewhart xbar chart

Description

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

Usage

qcs.xbar(x, ...)

## Default S3 method:
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 class '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)
pistonrings.qcd<-qcd(pistonrings)

class(pistonrings.qcd)

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

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)  

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)  

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)


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

Univariante process state

Description

This function removes observations from the sample which violates the rules of a process under control.

Usage

state.control(x)

Arguments

x

Object qcs (Quality Control Statistical)

Examples

##
##  Continuous data 
##
library(qcr)
data(pistonrings)
str(pistonrings)
pistonrings.qcd<-qcd(pistonrings)

class(pistonrings.qcd)

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

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)  

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)