spc {qAnalyst}R Documentation

Function to create spc object

Description

spc function creates spc class objects from data. Generic methods plot, print, summary are avaiable for SPC class objects.

Usage

  spc(x, sg = NULL, type = "xbar", xbarVariability = "auto", name = deparse(substitute(x)), testType = 1, 
      k = NA, p = NA, nSigma = 3, mu = NA, sigma = NA)

Arguments

x

data vector

sg

Subgroup variable. This argument has a different meaning according to chart type.

xbar, r and s charts: sg represents rational sub-group of observations. It can be specified either as a vector, of the same length of x of ordered subgroup id, or as a constant value that will be replicated along x. Subgroup dimension must be greather than one.

i and mr charts: sg represents the width of the window over which moving range are computed. Must be a scalar. Default value is set to two.

p, np and u charts: sg represents sample size of observation. It can be specified either as a vector, of the same length of x or as a constant value that will be replicated along x.

c chart: sg is not required

type

Chart type. String identifying chart type. Charts can be of type: "xbar", "r", "s", "i", "mr", "p", "np", "u", "c".

xbarVariability

How to compute variability for xbar charts.

"auto": (default) use the ranges if all subgroups have the same numerosity, and it is less than 7; otherwise it use the standard deviations.

"r" : use the ranges for the variaibility of the xbar charts.

"s" : use the standard deviations for the variability of the xbar charts.

name

Name of x variable as it appears in the charts. By default the name of the given x variable.

testType

A vector or a scalar of test codes to be performed. Eight tests are implemented corrensponding to codes 1-8. Default performed test is 1.

test 1: At least k out of p points in a row beyond Zone A (outside the control limits). Default values: k = p = 1, nSigma = 3.

test 2: At least k out of p points in a row on one side of central line. Default values: k = p = 9.

test 3: At least k out of p points in a row all increasing or all decreasing. Default values: k = p = 6.

test 4: At least k out of p points in a row all up and down. Default values: k = p = 14.

test 5: At least k out of p points in a row in Zone A or beyond (> (2/3)*nSigma*sigma from central line; same side of central line). Default values: k = 2, p = 3, nSigma = 3.

test 6: At least k out of p points in a row in Zone B or beyond (> (1/3)*nSigma*sigma from central line; same side of central line). Default values: k = 4, p = 5, nSigma = 3.

test 7: At least k out of p points in a row in Zone C (both sides of central line). Default values: k = p = 15, nSigma = 3

test 8: At least k out of p points in a row with no one in Zone C. Default values: k = p = 8, nSigma = 3

k

A vector or a scalar of parameters to be used by tests. If k is not specified, tests are performed with k default values. If k is specified, its length must be of the same length as testType.

p

A vector or a scalar of parameters to be used by tests. If p is not specified, tests are performed with p default values. If p is specified, its length must be of the same length as testType.

nSigma

A vector or a scalar of parameters to be used by tests. If nSigma is not specified, tests are performed with nSigma default values. If nSigma is specified, its length must be of the same length as testType.

mu

A scalar containing the process mean. Its use will be different depending from chart type.

xbar and i charts: mu represents the center line. If mu is specified also sigma must be specified. If mu is not specified, then the process mean is calculated from data.

p, np, c and u charts: mu represents the parameter value for the in-control process, and then the center line. If mu is not specified, then the process mean is calculated from data.

s, r and mr charts: mu is not used.

sigma

A scalar containing the process within samples standard deviation. Its use will be different depending from chart type.

xbar and i charts: the within samples variability around the center line. If sigma is specified also mu must be specified. If sigma is not specified, then the process within samples standard deviation is calculated from data.

s chart: sigma represents the center line. If sigma is not specified, then the process standard within samples deviation is calculated from data.

r and mr charts: sigma is used to calculate the center line. If sigma is not specified, then the process standard within samples deviation is calculated from data.

p, np, c and u charts: sigma is not used.

Details

spc function performs coherence tests on subgroups dimension and chart name. Then it calculates graphical parameters, statistics values and test results and stores this values in lists.

Value

An object of class spc

Note

No notes

Author(s)

Andrea Spano'

References

Montgomery, Statistical Quality Control

See Also

plot.spc, print.spc

Examples

# xbar and s chart with standard given
data(brakeCap)
xbarchart = spc(x=brakeCap$hardness, sg=brakeCap$subgroup, type="xbar", mu=40, sigma=1)
plot(xbarchart)
summary(xbarchart)
schart = spc(x=brakeCap$hardness, sg=brakeCap$subgroup, type="s", mu=1)
plot(schart)
summary(schart)

# i-chart, moving range to estimate standard deviaiton is equal to 2 points
  # with testType=1 
data(rawWeight)
ichart = spc(x=rawWeight$rawWeight, sg=2, type="i", name="weight", testType=1)
plot(ichart)
summary(ichart)

# u chart with standard given
data(toyCarsDefects)
uchart = spc(x=toyCarsDefects$defects, sg=toyCarsDefects$sampled, type="u",
    name="defects", mu=0.05)
plot(uchart)
summary(uchart)

[Package qAnalyst version 0.6.4 Index]