Package 'XRSCC'

Title: Statistical Quality Control Simulation
Description: This is a set of statistical quality control functions, that allows plotting control charts and its iterations, process capability for variable and attribute control, highlighting the xrs_gr() function, like a first iteration for variable chart, meanwhile the we_rules() function detects non random patterns in sample.
Authors: Erick Marroquin [aut, cre]
Maintainer: Erick Marroquin <[email protected]>
License: GPL (>= 2)
Version: 0.2
Built: 2024-12-07 10:37:45 UTC
Source: CRAN

Help Index


Calculates and plots variable and attributes control charts

Description

Calculates the control limits for each type of variable or attribute control chart, then using an iteration to get the true control limits

Details

Package: XRSCC
Type: Package
Version: 0.1
Date: 2016-05-04
License: GPL

Author(s)

Erick Marroquin
Maintainer: Erick Marroquin <[email protected]>


X chart OC Curve

Description

Calculates and plots the risk of not detecting shifts and the Average Run Length

Usage

Beta.X(k,n)

Arguments

k

A numeric vector, of length one, is the k standard deviations factor since the known mean

n

An integer, equal the sample size

Value

beta

risk of not detecting shifts

ARL

Average Run Lengh

Author(s)

Erick Marroquin

References

Montgomery, D.C. (2005) Introduction to Statistical Quality Control, 5th ed. New York: John Wiley & Sons, ISBN 0-471-65631-3

See Also

xrs_gr

Examples

Beta.X(k=1,n=5)
Beta.X(k=0.5,n=5)
Beta.X(k=1,n=3)

Defetive bottles sample

Description

The data give the number of defective bottles in a fixed sample size

Usage

data(bottles)

Format

A data frame with 80 observations on the following variable.

D

a numeric vector of integer number of defective bottles

Examples

data(bottles)
require(XRSCC)
p_gr(bottles, n=100)

The c chart control for attributes

Description

Calculates the c control chart for attributes, using a sample C of number of nonconformities. The plotted values in graph are the nonconformities number on each sample at a regular time interval when there is not a standard given.

Usage

c_gr(C)

Arguments

C

A data frame or a vector containing the number of nonconformities per sample. Note that the variable name must be the uppercase letter, like D.

Value

in.control

The under control row list for the c chart

out.control

The out of control row list for the c chart

Iteraciones

The number of iterations, in this function always will be the first and the last one

data.0

The original data frame

data.1

Subsetting the data frame with under control rows

bin

The binary values for out of control equal to one, and results under control equal to zero

Limites de Control Grafica \emph{c}

The c chart control limits vector

Conclusion del proceso

The same results in a phrase as the bin values

Author(s)

Erick Marroquin

References

Montgomery, D.C. (2005) Introduction to Statistical Quality Control, 5th ed. New York: John Wiley & Sons, ISBN 0-471-65631-3

See Also

p_gr, np_gr, u_gr, P_it, NP_it, C_it, U_it

Examples

data(clothes)
c_gr(clothes)

Iteration of c control chart for attributes

Description

Calculates the iteration i'th, for the control limits of c chart using the results obtained in c_gr and previous C_it iteration.

Usage

C_it(prev.results)

Arguments

prev.results

Its a list of previous results obtained by the c_gr function. In other cases, needs more than one iteration, to obtain the true control limits, before take conclusions about the process.

Value

in.control

The under control row list for the c chart

out.control

The out of control row list for the c chart

Iteraciones

The number of iterations, It is assumed to be the second or later

data.0

The original data frame or vector

data.1

The under control subset after iteration

bin

The binary values for out of control equal to one and under control equal to zero

Limites de Control Grafica \emph{c}

The c chart control limits vector

Conclusion del proceso

The same results in a phrase as the bin values

Author(s)

Erick Marroquin

References

Montgomery, D.C. (2005) Introduction to Statistical Quality Control, 5th ed. New York: John Wiley & Sons, ISBN 0-471-65631-3

See Also

p_gr, np_gr, u_gr, c_gr, P_it, NP_it, U_it

Examples

data(clothes)
r1<-c_gr(clothes)
r2<-C_it(r1)
r3<-C_it(r2)

Defective number per sample

Description

The data give a defectives number in a clothes process

Usage

data(clothes)

Format

A data frame with 90 observations on the following variable.

c

a numeric vector of integer number of nonconformities in a sample

Examples

require(XRSCC)
data(clothes)
c_gr(clothes)

Defective number per unit

Description

The data give a nonconformities number in a clothes process in a variable sample

Usage

data(clothes2)

Format

A data frame with 90 observations and two variables.

d

a numeric vector of integer number of nonconformities in a sample

n

a numeric vector of sample size

Examples

require(XRSCC)
data(clothes2)
u_gr(clothes2)

Calculates the process capability

Description

Given a variable sample, the function calculates the process capability and, assuming a normal distribution of the X chart, after the true control limits were found.

Usage

Cp_X(prev.results, LES, LEI, mu)

Arguments

prev.results

Is a list of previous results obtained by the xrs_gr function in the first iteration, or the results obtained in further iterations by the X_it function.

LES

A numeric vector of length one, containing the upper specification limit.

LEI

A numeric vector of length one, containing the lower specification limit.

mu

A numeric vector of length one, containing the average specification, if not exists, function takes the Control Limit of previous results.

Details

The function stops for the lack of any arguments.

Value

Cp

The process capability index

Cpk

The process capability index in case is not centered

P.cp

The specification range percentage used by the control limits

X.sigma

The process standard deviation

Conclusion del proceso

A phrase to take conclusion about the process capability

Author(s)

Erick Marroquin

References

Montgomery, D.C. (2005) Introduction to Statistical Quality Control, 5th ed. New York: John Wiley & Sons, ISBN 0-471-65631-3

See Also

xrs_gr X_it R_it we_rules

Examples

data(vol_sample)
results1<-xrs_gr(vol_sample)
results2<-X_it(results1)
# Type dev.off() function before use Cp_X
Cp_X(results2, LES=510, LEI=490, mu=500)

The piston hole length in mm

Description

A sample containing piston hole length in mm

Usage

data(dato2)

Format

A data frame with 45 subgroup of 5 observations

n1

a numeric vector of length in mm

n2

a numeric vector of length in mm

n3

a numeric vector of length in mm

n4

a numeric vector of length in mm

n5

a numeric vector of length in mm

Examples

data(dato2)
require(XRSCC)
results1<-xrs_gr(dato2)
results2<-X_it(results1)
results3<-R_it(results2)

Table: Factor for variable control charts

Description

A data frame containing the factor for variable control charts calculations.

Usage

data(factor.a)

Format

A data frame with factors (ex: A2, d2, D4 and so on) for size groups from 2 to 25.

Source

Montgomery, D.C. (2005) Introduction to Statistical Quality Control, 5th ed. New York: John Wiley & Sons, ISBN 0-471-65631-3

Examples

data(factor.a)

The np chart control for attributes

Description

Calculates the np control chart for attributes, using a sample D of number of defectives or nonconforming items and a constant sample size n. The values plotted in graph are the defectives number.

Usage

np_gr(D, n)

Arguments

D

A data frame containing the non conforming items, and must be integer and non negative.

n

A vector of length one, integer and nonnegative, to fix the sample size.

Value

in.control

The under control row list for the np chart

out.control

The out of control row list for the np chart

Iteraciones

The number of iterations, in this function always will be the first and the last one

data.n

The fixed sample size

data.0

The original data frame

data.1

The filtered data frame

bin

The binary values for out of control equal to one and under control equal to zero

Limites de Control Grafica \emph{np}

The np chart control limits vector

Conclusion del proceso

The same results in a phrase as the bin values

Author(s)

Erick Marroquin

References

Montgomery, D.C. (2005) Introduction to Statistical Quality Control, 5th ed. New York: John Wiley & Sons, ISBN 0-471-65631-3

See Also

p_gr, u_gr, c_gr, P_it, NP_it, C_it, U_it

Examples

data(bottles)
np_gr(bottles, n=100)

Iteration of np control chart for attributes

Description

Calculates the iteration i'th for the control limits of p chart using the results obtained in np_gr or further NP_it iterations.

Usage

NP_it(prev.results)

Arguments

prev.results

Is a list of previous results obtained by the np_gr function. In other cases, needs more than one iteration, to obtain the true control limits for np chart before take conclusions about the process.

Value

in.control

The under control row list for the np chart in this iteration

out.control

The out of control row list for the np chart

Iteraciones

The number of iterations, It is assumed to be the second or later

data.n

The fixed sample size

data.0

The original data frame

data.1

The under control subset after iteration

bin

The binary values for out of control equal to one and under control equal to zero

Limites de Control Grafica \emph{np}

The np chart control limits vector

Conclusion del proceso

The same results in a phrase as the bin values

Author(s)

Erick Marroquin

References

Montgomery, D.C. (2005) Introduction to Statistical Quality Control, 5th ed. New York: John Wiley & Sons, ISBN 0-471-65631-3

See Also

p_gr, np_gr, c_gr, u_gr, P_it, C_it, U_it

Examples

data(bottles)
r1<-np_gr(bottles, n=100)
r2<-NP_it(r1)
r3<-NP_it(r2)

P control chart for attributes

Description

Calculates the p control chart for attributes, using a sample D of number of defectives or nonconforming items and a constant sample size n. The values plotted in graph are the fractions pof defectives.

Usage

p_gr(D, n)

Arguments

D

A data frame containing in one column the non conforming items, and must be integer and non negative.

n

A vector of length one, integer and nonnegative, to fix the sample size.

Value

in.control

The under control row list for the p chart

out.control

The out of control row list for the p chart

Iteraciones

The number of iterations, in this function always will be the first and the last one

data.n

The fixed sample size

data.0

The original data frame

data.1

The filtered data frame

bin

The binary values for out of control equal to one and under control equal to zero

Limites de Control Grafica p

The p chart control limits vector

Conclusion del proceso

The same results in a phrase as the bin values

Author(s)

Erick Marroquin

References

Montgomery, D.C. (2005) Introduction to Statistical Quality Control, 5th ed. New York: John Wiley & Sons, ISBN 0-471-65631-3

See Also

P_it, c_gr, C_it, np_gr, NP_it, u_gr, U_it

Examples

data(bottles)
p_gr(bottles, n=100)

Iteration of p control chart for attributes

Description

Calculates the iteration i'th for the control limits of p chart using the results obtained in p_gr or further P_it iterations.

Usage

P_it(prev.results)

Arguments

prev.results

Is a list of previous results obtained by the p_gr function. In other cases, needs more than one iteration, to obtain the true control limits for p chart before take conclusions about the process.

Value

in.control

The under control row list for the p chart in this iteration

out.control

The out of control row list for the p chart

Iteraciones

The number of iterations, It is assumed to be the second or later

data.n

The fixed sample size

data.0

The original data frame

data.1

The under control subset after iteration

bin

The binary values for out of control equal to one and under control equal to zero

Limites de Control Grafica \emph{p}

The p chart control limits vector

Conclusion del proceso

The same results in a phrase as the bin values

Author(s)

Erick Marroquin

References

Montgomery, D.C. (2005) Introduction to Statistical Quality Control, 5th ed. New York: John Wiley & Sons, ISBN 0-471-65631-3

See Also

p_gr, c_gr, C_it, np_gr, NP_it, u_gr, U_it

Examples

data(bottles)
r1<-p_gr(bottles, n=100)
r2<-P_it(r1)
r3<-P_it(r2)

Sugar bags weights in pounds

Description

A sample containing weights of sugar bags

Usage

data(qqsugar)

Format

A data frame with 100 subgroup of ten observations

muestra1

a numeric vector of weights in pounds

muestra2

a numeric vector of weights in pounds

muestra3

a numeric vector of weights in pounds

muestra4

a numeric vector of weights in pounds

muestra5

a numeric vector of weights in pounds

muestra6

a numeric vector of weights in pounds

muestra7

a numeric vector of weights in pounds

muestra8

a numeric vector of weights in pounds

muestra9

a numeric vector of weights in pounds

muestra10

a numeric vector of weights in pounds

Examples

data(qqsugar)
require(XRSCC)
xrs_gr(qqsugar)

Calculates the i'th iteration R Chart

Description

Calculates the iteration i'th for R chart, after the X chart is under control. The function estimates if any value (range) is out of control limits, and returns a values list.

Usage

R_it(prev.results)

Arguments

prev.results

Is a list of previous results obtained by the xrs_gr, followed by X_it function if it is necessary. In other cases, needs more than one iteration to obtain the true control limits for R chart, before take conclusions about the process.

Details

The function stops if the R chart is under control already, and also stops if there is not any active graphic device.

Value

in.control

The under control row list for the X chart

R.in.control

The under control row list for the R chart

out.control

The out of control row list for the X chart

Iteraciones

The number of iterations, It is assumed to be the second or later

data.0

The original data frame

data.1

The filtered data frame

data.r.1

The calculated ranges of data.0

bin

The binary values for out of control equal to one and under control equal to zero, for X and R charts

LX

The X chart control limits vector

LR

The R chart control limits vector

Limites Grafixa X

The X chart control limits vector

Limites Grafixa R

The R chart control limits vector

Conclusion del proceso

The same results in a phrase as the bin values

Author(s)

Erick Marroquin

References

Montgomery, D.C. (2005) Introduction to Statistical Quality Control, 5th ed. New York: John Wiley & Sons, ISBN 0-471-65631-3

See Also

xrs_gr X_it we_rules Cp_X

Examples

data(dato2)
results1<-xrs_gr(dato2)
results2<-X_it(results1)
results3<-R_it(results2)

The u chart control for attributes

Description

Calculates the u control chart for attributes, given a variable sample n and a number of nonconformities u per sample. The plotted values in graph are the average number of nonconformities per unit.

Usage

u_gr(U)

Arguments

U

A data frame containing the number d of nonconformities per sample, the sample n can be variable. Note that the variable names must be lowercase letter, say d and n.

Value

in.control

The under control row list for the u chart

out.control

The out of control row list for the u chart

Iteraciones

The number of iterations, in this function always will be the first and the last one

data.0

The original data frame

data.1

Subsetting the data frame with under control rows

bin

The binary values for out of control equal to one and under control equal to zero

Limites de Control Grafica \emph{u}

The u chart control limits vector

Conclusion del proceso

The same results in a phrase as the bin values

Author(s)

Erick Marroquin

References

Montgomery, D.C. (2005) Introduction to Statistical Quality Control, 5th ed. New York: John Wiley & Sons, ISBN 0-471-65631-3

See Also

p_gr, np_gr, c_gr, P_it, NP_it, C_it, U_it

Examples

data(udata2)
u_gr(udata2)

Iteration of u control chart for attributes

Description

Calculates the iteration i'th for the control limits of c chart using the results obtained in c_gr and previous U_it iteration.

Usage

U_it(prev.results)

Arguments

prev.results

Is a list of previous results obtained by the u_gr function. In other cases, needs more than one iteration, to obtain the true control limits for u chart before take conclusions about the process.

Value

in.control

The under control row list for the u chart

out.control

The out of control row list for the u chart

Iteraciones

The number of iterations, in this function always will be the first and the last one

data.0

The original data frame

data.1

Subsetting the data frame with under control rows

bin

The binary values for out of control equal to one and under control equal to zero

Limites de Control Grafica \emph{u}

The u chart control limits vector

Conclusion del proceso

The same results in a phrase as the bin values

Author(s)

Erick Marroquin

References

Montgomery, D.C. (2005) Introduction to Statistical Quality Control, 5th ed. New York: John Wiley & Sons, ISBN 0-471-65631-3

See Also

p_gr, np_gr, c_gr, u_gr, P_it, NP_it, C_it

Examples

data(udata2)
r1<-u_gr(udata2)
r2<-U_it(r1)

Defective number per unit

Description

The data give a nonconformities number on a clothes manufacturing process, the sample size is fixed.

Usage

data(udata2)

Format

A data frame with 90 observations and two variables.

d

a numeric vector of integer number of nonconformities in a sample

n

a numeric vector of sample size

Examples

require(XRSCC)
data(udata2)
u_gr(udata2)

Volume in ml

Description

A volume sample in milliliters

Usage

data(vol_sample)

Format

A data frame with 100 subgroup of five observations

n1

a numeric vector of volume

n2

a numeric vector of volume

n3

a numeric vector of volume

n4

a numeric vector of volume

n5

a numeric vector of volume

Examples

data(vol_sample)
require(XRSCC)
xrs_gr(vol_sample)

Estimates the first four Western Electric Rules for detecting patterns

Description

Estimates the first four Western Electric Rules for detecting patterns, starting with under control X chart obtained in the sequence xrs_gr, X_it, R_it functions. At the same time, plots the X chart including the zones above and below the central limit. For last, a binary value for each rule is presented if at least one rule is violated, '1' for 'yes', 0 for 'no'.

Usage

we_rules(prev.results)

Arguments

prev.results

Its a list of previous results obtained by the xrs_gr function in the first iteration, or a list of results obtained in further iterations by the X_it, and if necessary by the R_it function.

Details

The previous results may say that the process is under control, but, it's a conclusion concerning the first Western Electric rule only.

Value

Resultados de analisis

A phrarse saying the process is or not under control

Las siguientes reglas tienen al menos un grupo que viola la regla

The conclussion about the Western Electric rules from 1 to 4, showing a binary response, '1' for 'yes', 0 for 'no'.

Author(s)

Erick Marroquin

References

Montgomery, D.C. (2005) Introduction to Statistical Quality Control, 5th ed. New York: John Wiley & Sons, ISBN 0-471-65631-3

SMALL, Bonnie B. (1956) Statistical Quality Control Handbook, 2th ed. Easton : Western Electric Co, Inc.

yhat The Yhat Blog. Machine Learning, Data Science, Engineering, [On line] http://blog.yhathq.com/posts/quality-control-in-r.html

See Also

xrs_gr, X_it, R_it, Cp_X

Examples

data(qqsugar)
results1<-xrs_gr(qqsugar)
results2<-R_it(results1)
we_rules(results2)

Calculates the iteration i'th X Chart

Description

With the results of xrs_gr followed by previous X_it iterations, the function calculates the X control limits charts, using a data frame with a fixed subgroup size n. In the graph plotting, the function estimates if any value (row or subgroup average) is out of control limits, and returns a list with calculations. Also, gives the R chart and control limits, which will be used in R_it function.

Usage

X_it(prev.results)

Arguments

prev.results

Is a list of previous results obtained by the xrs_gr function in the first iteration, or a list of results obtained in further iterations by the X_it function.

Details

The function stops if the X chart is under control already, and also stops if there is not any active graphic device.

Value

in.control

The under control row list for the X chart

R.in.control

The under control row list for the R chart

out.control

The out of control row list for the X chart

Iteraciones

The iterations number, It is assumed to be the second or later

data.0

The original data frame

data.1

The under control subset after iteration

data.r.1

The calculated ranges of data.0

bin

The binary values for out of control equal to one and under control equal to zero, for X and R charts

LX

The X chart control limits vector

LR

The R chart control limits vector

Limites Grafixa X

The X chart control limits vector

Limites Grafixa R

The R chart control limits vector

Conclusion del proceso

The same results in a phrase as the bin values

Note

For the true Range control limits calculation, use R_it.

Author(s)

Erick Marroquin

References

Montgomery, D.C. (2005) Introduction to Statistical Quality Control, 5th ed. New York: John Wiley & Sons, ISBN 0-471-65631-3

See Also

xrs_gr, R_it, Cp_X, we_rules

Examples

data(vol_sample)
results1<-xrs_gr(vol_sample)
results2<-X_it(results1)

Calculate and plot the X, R and S Charts for variable charts

Description

Calculates the control limits for X, R and S charts, using a data frame with a fixed subgroup size. Plots the corresponding graph, the function estimates if any value is out of the control limits, returns a list with calculations.

Usage

xrs_gr(X)

Arguments

X

A sample in a dataframe object, with m rows like subgroups, and n columns like sample size.

Value

in.control

The under control row list for the X chart

R.in.control

The under control row list for the R chart

out.control

The out of control row list for the X chart

Iteraciones

The iterations number, the firts and the last one on this function

data.0

The original data frame

data.1

The under control subset after iteration

data.r.1

The calculated ranges of data.0

bin

The binary values for out of control equal to one and under control equal to zero, for X, R and S charts

LX

The X chart control limits vector

LR

The R chart control limits vector

LS

The S chart control limits vector

Limites Grafixa X

The X chart control limits vector

Limites Grafixa R

The R chart control limits vector

Limites Grafixa S

The S chart control limits vector

Conclusion del proceso

The same results in a phrase as the bin values

Author(s)

Erick Marroquin

References

Montgomery, D.C. (2005) Introduction to Statistical Quality Control, 5th ed. New York: John Wiley & Sons, ISBN 0-471-65631-3

See Also

X_it, we_rules, R_it, Cp_X, Beta.X

Examples

data(vol_sample)
results1<-xrs_gr(vol_sample)