Type: Package
Title: Quality Control Review
Version: 1.4
Date: 2022-02-15
Maintainer: Miguel Flores <ma.flores@outlook.com>
Depends: R (≥ 2.10), qcc, fda.usc, mvtnorm, MASS
Suggests: rmarkdown, knitr
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. See Flores et al. (2021) <doi:10.32614/RJ-2021-034>.
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
URL: https://github.com/mflores72000/qcr
BugReports: https://github.com/mflores72000/qcr/issues
LazyData: yes
Encoding: UTF-8
RoxygenNote: 7.1.2
NeedsCompilation: no
Packaged: 2022-02-25 17:54:54 UTC; ruben.fcasal
Repository: CRAN
Date/Publication: 2022-03-02 09:00:06 UTC
Author: Miguel Flores ORCID iD [aut, cre], Ruben Fernandez-Casal ORCID iD [aut], Salvador Naya [aut], Javier Tarrio-Saavedra [aut]

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 company from A Corunia wants to control the performance of the counters installed throughout the city. 60 subsamples are taken each one composed by 3 measurements made by the counters of the same antiquity (10 years) and caliber, in a period of 5 years. Taking into account that there are two brands or providers of counters

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 employment in their establishments. For this it is going to make a continuous control that measures the amount of occupants in terms of percentage. 48 sub samples are taken of six hotels belonging to two 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's data.

...

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 R object (used to select the method). See details.

...

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's data.

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

a logical value indicating that it should be plotted.

trim

The porcentage of the trimming.

smo

The smoothing parameter for the bootstrap samples.

draw.control

ist that 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 (DFD) - 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

an R object (used to select the method). See details.

...

arguments passed to or from methods.

y

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

func.depth

Type of depth measure, by default depth.mode.

alpha

Quantile to determine the cutoff from the Bootstrap procedure

plot

a logical value indicating that it should be plotted.

trim

The porcentage of the trimming.

draw.control

ist that 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(data, data.name = NULL)

Arguments

data

a matrix or data-frame or 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's data.

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

Object mqcd (Multivariante Quality Control Data)

method

Is the method employed to compute the covatiance 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 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 R object (used to select the method). See details.

...

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's data.

limits

a two-values vector specifying the control limits.

Xmv

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

S

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

k

is a constant used in MCUSUM chart. Frequently k = 0.5

h

is a constant used in MCUSUM chart. Usually h = 5.5

method

is the method employed to compute the covatiance 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

a logical value indicating that it should be plotted.

Author(s)

Edgar Santos-Fernandez

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 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 R object (used to select the method). See details.

...

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's data.

limits

a two-values vector specifying the control limits.

Xmv

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

S

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

method

is the method employed to compute the covatiance 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

a logical value indicating that it should be plotted.

lambda

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

Author(s)

Edgar Santos-Fernandez

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 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 R object (used to select the method). See details.

...

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's data.

limits

a two-values vector specifying the control limits.

Xmv

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

S

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

colm

is 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

is the method employed to compute the covatiance 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

a logical value indicating that it should be plotted.

Author(s)

Edgar Santos-Fernandez

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 or data-frame or 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 Multivariante 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.


Function to plot the Q chart

Description

This function is used to compute statistics required by the 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 npqcd (Non parametric Quality Control Data)

...

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 the significance level (0.01 for default)

plot

a logical value indicating it 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 S chart

Description

This function is used to compute statistics required by the 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 npqcd (Non parametric Quality Control Data)

...

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 the significance level (0.01 for default)

plot

a logical value indicating it 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)

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 r chart

Description

This function is used to compute statistics required by the 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 npqcd (Non parametric Quality Control Data)

...

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 the significance level (0.01 for default)

plot

a logical value indicating it 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)

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

Object 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. We have 50 subsamples of oil with their temperature to oxide.

Format

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

OOT

That is a quantitative variable that controls the quality of oil.

sample

sample id

Examples


data(oxidation)
attach(oxidation)
summary(oxidation)
plot(OOT, type="b")
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 10 observations on the following 2 variables.

x

number of nonconformities (inspection units)

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

Piston rings for an automotive engine are produced by a forging process. The inside diameter of the rings manufactured by the process is measured on 25 samples, each of size 5, drawn from a process being considered 'in control'.

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

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.

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

Usage

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

## 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

Object 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

ist that it specifies the col, lty and lwd for objects: fdataobj, statistic, IN and OUT.

...

arguments to be passed to or from methods.

title.rank

an overall title for the depth plot


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

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


Plot method for 'npqcs' objects

Description

Generic function for plotting Multivarite 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

Object npqcs (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

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

Object 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 presion 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 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 with 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.


Quality Control Review

Description

Quality Control Review 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

a vector containing observed data

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


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 R object (used to select the method). See details.

...

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 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 with 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

a logical value indicating should be plotted.

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 R object (used to select the method). See details.

...

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 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 with 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

a logical value indicating should be plotted.

Details

In the default method qcs.S.default parameter x is a matrix or data-frame where it should contain data, index sample and, optionally, covariate(s).

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)  


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

a logical value indicating that it 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 C_p using the method described by Chou et al. (1990). Approximate confidence limits for C_{pl}, C_{pu} and C_{pk} are computed using the method in Bissell (1990). Confidence limits for C_{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 histogramm 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 indice 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 is NULL, the target is set at the middle value bewteen 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. The default value is 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 Cp, Cpm 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 is NULL, the target is set at the middle value bewteen 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 CNp, CNpm 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 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.

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 is NULL, the target is set at the middle value bewteen 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. The default value is 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

Object 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 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 with 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

a logical value indicating it 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.

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

Object 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 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 with 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 \le \lambda \le 1

plot

a logical value indicating it 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 is NULL, the target is set at the middle value bewteen 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 (0.05 for default)

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 R object (used to select the method). See details.

...

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 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 with 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

a logical value indicating 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

Object 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 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 with 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

a logical value indicating 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 xbar 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 R object (used to select the method). See details.

...

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 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 with 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

a logical value indicating 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 histogramm 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 representing the probability distribution 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 is NULL, the target is set at the middle value bewteen specification limits.

std.dev

A value specifying the within-group standard deviation.

boxcox

Logical value (default is 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 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 R object (used to select the method). See details.

...

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 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 with 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

a logical value indicating should be plotted.

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

Object 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 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 with 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

a logical value indicating 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)