Title: | Functions for Calibrating Control Charts |
---|---|
Description: | Calibration of thresholds of control charts such as CUSUM charts based on past data, taking estimation error into account. |
Authors: | Axel Gandy <[email protected]> and Jan Terje Kvaloy <[email protected]>. |
Maintainer: | Axel Gandy <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.1 |
Built: | 2024-11-08 03:58:21 UTC |
Source: | https://github.com/cran/spcadjust |
A dataset describing the results of cardiac surgery. The data give information about the date of surgery, surgeon, Parsonnet score and outcome up to 90 days after surgery.
data(cardiacsurgery)
data(cardiacsurgery)
A data frame with 5595 rows and 5 variables:
date: | date of the operation in days since the beginning of study |
time: | number of days between surgery and the earlier of death and 90 days |
status: | status at endpoint, 0/1 for censored/dead |
Parsonnet: | Parsonnet score of the patient |
surgeon: | surgeon performing the operation, numbered from 1 to 7 |
Based on the data described in Steiner et al (2000). A subset of the data has been selected, some noise has been introduced and the follow-up was censored at 90 days.
Steiner SH, Cook RJ, Farewell VT, Treasure T (2000). Monitoring surgical performance using risk-adjusted cumulative sum charts. Biostat 1(4) 441-452.
Consider running a control chart with given parameters with data
coming from a given probability model. This function computes the
cumulative distribution function (CDF) of the updates of the
control charts as they would be computed by the method updates
.
getcdfupdates(chart, P, xi) ## S4 method for signature 'SPCchart' getcdfupdates(chart, P, xi) ## S4 method for signature 'SPCShew' getcdfupdates(chart, P, xi)
getcdfupdates(chart, P, xi) ## S4 method for signature 'SPCchart' getcdfupdates(chart, P, xi) ## S4 method for signature 'SPCShew' getcdfupdates(chart, P, xi)
chart |
the chart to be used. |
P |
the probability model from which data is generated. |
xi |
the parameters of the control chart. |
A function mapping one-dimensional numerical values into the interval [0,1], having all properties of a cumulative distribution function.
SPCchart
: Standard method which simply first applies
getcdfresiduals from the data model.
SPCShew
: Computes the CDF of the updates taking
into account if the chart is one-sided or two-sided.
Returns functions to compute desired properties of a given control chart.
getq(chart, property, params) ## S4 method for signature 'SPCCUSUM' getq(chart, property, params) ## S4 method for signature 'SPCEWMA' getq(chart, property, params) ## S4 method for signature 'SPCShew' getq(chart, property, params)
getq(chart, property, params) ## S4 method for signature 'SPCCUSUM' getq(chart, property, params) ## S4 method for signature 'SPCEWMA' getq(chart, property, params) ## S4 method for signature 'SPCShew' getq(chart, property, params)
chart |
the chart to be used. |
property |
the name of the property. |
params |
additional parameters needed for the computations. |
A list with the elements q
, trafo
, lowerconf
, format
.
q(P,xi)
: The transformed property of interest. To improve the bootstrap a log transform is used for calARL
,calhitprob
and ARL
, and a logit transform for hitprob
. This function depends on the distribution of updates P
and the chart parameters xi
.
trafo(x)
: The inverse of the transformation of the property used in the bootstrap. Needed to back-transform the result to the correct scale.
lowerconf
: Logical value. TRUE if a lower confidence interval should be reported, FALSE otherwise. Default is TRUE for properties calARL
, calhitprob
and hitprob
and FALSE for ARL
.
format(res)
: Output summary given as a text string.
SPCCUSUM
: Implements the properties ARL
,
calARL
, hitprob
and calhitprob
.
SPCEWMA
: Implements the properties ARL
,
calARL
, hitprob
and calhitprob
.
SPCShew
: Implements the properties ARL
,
calARL
, hitprob
and calhitprob
.
Generic method for running a chart on new data using given
parameters xi
.
runchart(chart, newdata, xi) ## S4 method for signature 'SPCCUSUM' runchart(chart, newdata, xi) ## S4 method for signature 'SPCEWMA' runchart(chart, newdata, xi) ## S4 method for signature 'SPCShew' runchart(chart, newdata, xi)
runchart(chart, newdata, xi) ## S4 method for signature 'SPCCUSUM' runchart(chart, newdata, xi) ## S4 method for signature 'SPCEWMA' runchart(chart, newdata, xi) ## S4 method for signature 'SPCShew' runchart(chart, newdata, xi)
chart |
the chart to be used. |
newdata |
the new observed data. |
xi |
the parameters to be used in running the chart. |
The path of the chart over time.
SPCCUSUM
: Generic function for running CUSUM
charts. Relies on updates
being implemented for the
chart.
SPCEWMA
: Generic function for running EWMA
charts. Relies on updates
being implemented for the
chart.
SPCShew
: Simply computes the updates appropriate for
the Shewhart chart and returns them.
Computes a two-sided confidence interval for properties of a control chart.
SPC2sidedconfint(covprob = 0.9, ...)
SPC2sidedconfint(covprob = 0.9, ...)
covprob |
The coverage probability of the adjustment. |
... |
Parameters to be passed to SPCproperty |
The desired confidence interval, a vector of length 2.
# Compute 2-sided CI for the ARL of a CUSUM control chart assuming normality. X <- rnorm(100) #observed data chart <- new("SPCCUSUM",model=SPCModelNormal(Delta=1)) # CUSUM chart with normal observations SPC2sidedconfint(data=X,nrep=100,covprob=0.95, property="ARL",chart=chart,params=list(threshold=4))
# Compute 2-sided CI for the ARL of a CUSUM control chart assuming normality. X <- rnorm(100) #observed data chart <- new("SPCCUSUM",model=SPCModelNormal(Delta=1)) # CUSUM chart with normal observations SPC2sidedconfint(data=X,nrep=100,covprob=0.95, property="ARL",chart=chart,params=list(threshold=4))
Virtual S4 base class for Control Charts.
model
The data model to be used in the chart. Must be of type
SPCDataModel
.
Class extending SPCChart with a basic CUSUM charts implementation.
The only slot this class contains is the data model. This data model should already incorporate the negative mean for in-control updates that is typical for CUSUM charts.
Let be the updates from the data model. Then
the CUSUM chart is given by
and
X <- rnorm(1000) chart <- new("SPCCUSUM",model=SPCModelNormal(Delta=1)) ## Not run: SPCproperty(data=X,nrep=10,chart=chart, property="calARL",params=list(target=100)) SPCproperty(data=X,nrep=10,chart=chart, property="calhitprob",params=list(target=0.05,nsteps=1e3)) SPCproperty(data=X,nrep=10,chart=chart, property="ARL",params=list(threshold=3)) ## End(Not run) SPCproperty(data=X,nrep=10,chart=chart, property="hitprob",params=list(threshold=3,nsteps=1e3)) #increase the number of repetitions nrep for real applications.
X <- rnorm(1000) chart <- new("SPCCUSUM",model=SPCModelNormal(Delta=1)) ## Not run: SPCproperty(data=X,nrep=10,chart=chart, property="calARL",params=list(target=100)) SPCproperty(data=X,nrep=10,chart=chart, property="calhitprob",params=list(target=0.05,nsteps=1e3)) SPCproperty(data=X,nrep=10,chart=chart, property="ARL",params=list(threshold=3)) ## End(Not run) SPCproperty(data=X,nrep=10,chart=chart, property="hitprob",params=list(threshold=3,nsteps=1e3)) #increase the number of repetitions nrep for real applications.
This is the basic structure for converting observations (data) into updates for control charts. Classes of this type also have the ability to generate new data sets (resampling).
Every element of this class has to consist of a list of the
following functions: updates, getcdfupdates, Pofdata,
resample, xiofP, which have to be of a specific form. The arguments generally have the
following meaning: xi
denotes the parameter vector needed to create
updates for running the chart from observed data, data
is
observed data, P
is a data model.
updates(xi,data)
: Returns updates for the chart using the parameter xi
and the observed data data
.
Pofdata(data)
: Estimates a probability model from the data.
xiofP(P): Computes the parameter xi
needed to compute updates from an (estimated) probability model P
.
resample(P)
: Generates a new data set from the probability model P
.
getcdfupdates(P,xi,cadlag=TRUE)
: Returns the cumulative distribution function (CDF) of updates of data generated from the probability model P
and computed using the parameter xi
. The CDF has to be a function of one argument that also accepts vectors. If cadlag is TRUE then the CDF is right-continuous (i.e. ). If cadlag is FALSE then the CDF is left-continuous (i.e.
).
SPCModelNormal
,
SPCModelNonpar
,
SPCModelNonparCenterScale
Class extending SPCChart with a basic EWMA charts implementation.
Let be the updates from the data model. Then
the EWMA chart is given by
and
model
The data model. The data model should center the in-control updates such that they have mean 0.
lambda
The smoothing constant, .
X <- rnorm(1000) chart <- new("SPCEWMA",model=SPCModelNormal(Delta=0),lambda=0.8) ## Not run: SPCproperty(data=X,nrep=10,chart=chart, property="calARL",params=list(target=100)) SPCproperty(data=X,nrep=10,chart=chart, property="calhitprob",params=list(target=0.05,nsteps=1e3)) ## End(Not run) SPCproperty(data=X,nrep=10,chart=chart, property="ARL",params=list(threshold=3)) SPCproperty(data=X,nrep=10,chart=chart, property="hitprob",params=list(threshold=3,nsteps=1e3)) #increase the number of repetitions nrep for real applications.
X <- rnorm(1000) chart <- new("SPCEWMA",model=SPCModelNormal(Delta=0),lambda=0.8) ## Not run: SPCproperty(data=X,nrep=10,chart=chart, property="calARL",params=list(target=100)) SPCproperty(data=X,nrep=10,chart=chart, property="calhitprob",params=list(target=0.05,nsteps=1e3)) ## End(Not run) SPCproperty(data=X,nrep=10,chart=chart, property="ARL",params=list(threshold=3)) SPCproperty(data=X,nrep=10,chart=chart, property="hitprob",params=list(threshold=3,nsteps=1e3)) #increase the number of repetitions nrep for real applications.
The parameters needed for running the chart are the fitted linear model. Resampled data sets are created by resampling cases with replacement (i.e. keeping observations together).
SPCModellm(formula, Delta = 0)
SPCModellm(formula, Delta = 0)
formula |
the linear model specified as a formula. |
Delta |
Object of class |
n <- 1000 Xlinreg <- data.frame(x1= rbinom(n,1,0.4), x2= runif(n,0,1), x3= rnorm(n)) Xlinreg$y <- 2 + Xlinreg$x1 + Xlinreg$x2 + Xlinreg$x3 + rnorm(n) ## Not run: chartlinregCUSUM <- new("SPCCUSUM", model=SPCModellm(Delta=1,formula="y~x1+x2+x3")) SPCproperty(data=Xlinreg,nrep=10,property="calARL", chart=chartlinregCUSUM,params=list(target=100)) #increase nrep in real applications. #' chartlinregCUSUM2 <- new("SPCCUSUM",model=SPCModellm(Delta=1,formula="y~x1")) SPCproperty(data=Xlinreg,nrep=10,property="calARL", chart=chartlinregCUSUM2,params=list(target=100)) #increase nrep in real applications. chartlinregEWMA <- new("SPCEWMA", model=SPCModellm(Delta=0,formula="y~x1+x2+x3"),lambda=0.8) SPCproperty(data=Xlinreg,nrep=10,property="calARL", chart=chartlinregEWMA,params=list(target=100)) #increase nrep in real applications. chartlinregEWMA2 <- new("SPCEWMA",model=SPCModellm(Delta=0,formula="y~x1"),lambda=0.8) SPCproperty(data=Xlinreg,nrep=10,property="calARL", chart=chartlinregEWMA2,params=list(target=100)) ## End(Not run) #increase nrep in real applications.
n <- 1000 Xlinreg <- data.frame(x1= rbinom(n,1,0.4), x2= runif(n,0,1), x3= rnorm(n)) Xlinreg$y <- 2 + Xlinreg$x1 + Xlinreg$x2 + Xlinreg$x3 + rnorm(n) ## Not run: chartlinregCUSUM <- new("SPCCUSUM", model=SPCModellm(Delta=1,formula="y~x1+x2+x3")) SPCproperty(data=Xlinreg,nrep=10,property="calARL", chart=chartlinregCUSUM,params=list(target=100)) #increase nrep in real applications. #' chartlinregCUSUM2 <- new("SPCCUSUM",model=SPCModellm(Delta=1,formula="y~x1")) SPCproperty(data=Xlinreg,nrep=10,property="calARL", chart=chartlinregCUSUM2,params=list(target=100)) #increase nrep in real applications. chartlinregEWMA <- new("SPCEWMA", model=SPCModellm(Delta=0,formula="y~x1+x2+x3"),lambda=0.8) SPCproperty(data=Xlinreg,nrep=10,property="calARL", chart=chartlinregEWMA,params=list(target=100)) #increase nrep in real applications. chartlinregEWMA2 <- new("SPCEWMA",model=SPCModellm(Delta=0,formula="y~x1"),lambda=0.8) SPCproperty(data=Xlinreg,nrep=10,property="calARL", chart=chartlinregEWMA2,params=list(target=100)) ## End(Not run) #increase nrep in real applications.
Data Model for Binary Responses using a logarithmic model and likelihood ratio updates.
SPCModellogregLikRatio(formula, Delta = 1)
SPCModellogregLikRatio(formula, Delta = 1)
formula |
The formula of the model. |
Delta |
This value will be added to the log odds ratio in the out-of-control model in the likelihood ratio between the out-of-control and the in-control model constituting the updates. |
n <- 1000 Xlogreg <- data.frame(x1=rbinom(n,1,0.4), x2=runif(n,0,1), x3=rnorm(n)) xbeta <- -1+Xlogreg$x1*100+Xlogreg$x2+Xlogreg$x3 Xlogreg$y <- rbinom(n,1,exp(xbeta)/(1+exp(xbeta))) chartlogreg <- new("SPCCUSUM", model=SPCModellogregLikRatio(Delta= 1, formula="y~x1+x2+x3")) SPCproperty(data=Xlogreg,nrep=10,property="calARL", chart=chartlogreg,params=list(target=100)) #increase nrep for real applications.
n <- 1000 Xlogreg <- data.frame(x1=rbinom(n,1,0.4), x2=runif(n,0,1), x3=rnorm(n)) xbeta <- -1+Xlogreg$x1*100+Xlogreg$x2+Xlogreg$x3 Xlogreg$y <- rbinom(n,1,exp(xbeta)/(1+exp(xbeta))) chartlogreg <- new("SPCCUSUM", model=SPCModellogregLikRatio(Delta= 1, formula="y~x1+x2+x3")) SPCproperty(data=Xlogreg,nrep=10,property="calARL", chart=chartlogreg,params=list(target=100)) #increase nrep for real applications.
Data Model for Binary Responses using a Logarithmic Model and observed minus expected updates.
SPCModellogregOE(formula, Delta = 0)
SPCModellogregOE(formula, Delta = 0)
formula |
The formula of the model. |
Delta |
Half of this value will be subtracted for every update. |
n <- 1000 Xlogreg <- data.frame(x1=rbinom(n,1,0.4), x2=runif(n,0,1), x3=rnorm(n)) xbeta <- -1+Xlogreg$x1*100+Xlogreg$x2+Xlogreg$x3 Xlogreg$y <- rbinom(n,1,exp(xbeta)/(1+exp(xbeta))) chartlogreg <- new("SPCEWMA", model=SPCModellogregOE(Delta= 0, formula="y~x1+x2+x3"), lambda=0.8) SPCproperty(data=Xlogreg,nrep=10,property="calARL", chart=chartlogreg,params=list(target=100)) #increase nrep for real applications.
n <- 1000 Xlogreg <- data.frame(x1=rbinom(n,1,0.4), x2=runif(n,0,1), x3=rnorm(n)) xbeta <- -1+Xlogreg$x1*100+Xlogreg$x2+Xlogreg$x3 Xlogreg$y <- rbinom(n,1,exp(xbeta)/(1+exp(xbeta))) chartlogreg <- new("SPCEWMA", model=SPCModellogregOE(Delta= 0, formula="y~x1+x2+x3"), lambda=0.8) SPCproperty(data=Xlogreg,nrep=10,property="calARL", chart=chartlogreg,params=list(target=100)) #increase nrep for real applications.
Generic model that allows nonparametric resampling (with replacement) of the data. The transformation of data into updates needs to be defined via the arguments.
SPCModelNonpar(updates, xiofP)
SPCModelNonpar(updates, xiofP)
updates |
function that computes updates. |
xiofP |
function that computes xi given P. |
The parameters to the functions being returned have the following meaning.
data: a numeric vector or a matrix where the rows contain the observations.
xi: depends on the parameter xiofP.
P: The data
with no modifications (thus either a numeric vector or a matrix).
The main operations are defined as follows:
resample(P): generates a new data set of the same size by either resampling the values (if the data is a vector) or by resampling the rows of the data matrix (both use resampling with replacement).
An object of class SPCDataModel.
Nonparametric resampling of univariate observations. Updates are centered and scaled transformations of the data (with a constant potentially being subtracted).
SPCModelNonparCenterScale(Delta = 0)
SPCModelNonparCenterScale(Delta = 0)
Delta |
how much to subtract before scaling. |
Calls SPCModelNonpar
to generate the data object, so it only needs to specify the meaning of xi
, the parameter needed to compute updates and the definition of the updates.
xi: a list with two elements:
mu: the mean.
sd: the standard deviation.
updates(xi,data): returns the centered and scale version of the data from which has been subtracted, i.e.
An object of class SPCDataModel.
An object of class SPCDataModel.
X <- rnorm(1000) #CUSUM chart model <- SPCModelNonparCenterScale(1) chart <- new("SPCCUSUM",model=model) SPCproperty(data=X,nrep=10,property="calARL", chart=chart,params=list(target=100)) #Shewhart chart model <- SPCModelNonparCenterScale(0) chart <- new("SPCCUSUM",model=model) SPCproperty(data=X,nrep=10,property="calARL", chart=chart,params=list(target=100))
X <- rnorm(1000) #CUSUM chart model <- SPCModelNonparCenterScale(1) chart <- new("SPCCUSUM",model=model) SPCproperty(data=X,nrep=10,property="calARL", chart=chart,params=list(target=100)) #Shewhart chart model <- SPCModelNonparCenterScale(0) chart <- new("SPCCUSUM",model=model) SPCproperty(data=X,nrep=10,property="calARL", chart=chart,params=list(target=100))
Returns a data model for univariate observations using normality
assumptions with updates that center and scale the observations and
potentially subtract half of a constant Delta
. Subtracting
is useful for CUSUM charts.
SPCModelNormal(Delta = 0)
SPCModelNormal(Delta = 0)
Delta |
Half of this constant is subtracted for updates (before centering and scaling). |
The parameters to the function have the following meaning.
data: a numeric vector.
xi: a list with two elements:
mu: the mean.
sd: the standard deviation.
P: a list with three elements:
mu: the mean.
sd: the standard deviation.
m: the number of data points to resample.
The main operations are defined as follows:
updates(xi,data): returns the centered and scale version of the data from which has been subtracted, i.e.
.
resample(P): resamples m
new data points from a normal distribution if mean mu
and standard deviation sd
.
An object of class SPCDataModel
.
Computes bootstrap adjusted properties for control charts.
SPCproperty(data, nrep = 500, chart, property, params, covprob = 0.9, quiet = FALSE, reportdistr = FALSE, parallel = 1)
SPCproperty(data, nrep = 500, chart, property, params, covprob = 0.9, quiet = FALSE, reportdistr = FALSE, parallel = 1)
data |
The observed data. |
nrep |
The number of bootstrap repetitions. Default 500. |
chart |
The chart to be used. |
property |
The property to be computed. A string. Must be implemented by the chart. |
params |
Additional parameters for computing the property. |
covprob |
The coverage probability of the adjustment. Default 0.9. |
quiet |
Logical value indicating if progress bar should be suppressed. Default FALSE. |
reportdistr |
Logical value indicating if the ecdf of the bootstrap distribution should be plotted. Default FALSE. |
parallel |
Number of cores to use for parallel computations
(using mclapply from the package parallel). Defaults to 1. If set
to |
An object of type SPCpropertyres.
# calibrate CUSUM chart to an in-control ARL of 100. # run with a larger number of replications in real examples! X <- rnorm(100) #observed data chart <- new("SPCCUSUM",model=SPCModelNormal(Delta=1)) # CUSUM chart with normal observations SPCproperty(data=X,nrep=15,chart=chart,property="calARL", params=list(target=100))
# calibrate CUSUM chart to an in-control ARL of 100. # run with a larger number of replications in real examples! X <- rnorm(100) #observed data chart <- new("SPCCUSUM",model=SPCModelNormal(Delta=1)) # CUSUM chart with normal observations SPCproperty(data=X,nrep=15,chart=chart,property="calARL", params=list(target=100))
Results of SPCproperty.
## S4 method for signature 'SPCpropertyres' show(object)
## S4 method for signature 'SPCpropertyres' show(object)
object |
the result to be shown. |
show
: Prints the object nicely.
nrep
number of repetitions used in the simulation.
chart
the chart used.
property
the property of interest, ARL
, calARL
, calhitprob
or hitprob
.
covprob
the probability of the guaranteed conditional performance.
res
the guaranteed conditional performance.
raw
the unadjusted result.
params
additional parameters used for computing this property.
restext
a readable version of the result.
Shewhart charts.
twosided
TRUE if a two-sided chart should be used. Default FALSE.
X<-rnorm(100); ##calibrate to ARL 100 chartShew <- new("SPCShew",model=SPCModelNormal(),twosided=TRUE) ## Not run: SPCproperty(data=X,nrep=500, property="calARL",chart=chartShew,params=list(target=100), covprob=c(0.7,0.9)) chartShewOneSided <- new("SPCShew",model=SPCModelNormal(),twosided=FALSE) SPCproperty(data=X,nrep=500, property="calARL",chart=chartShewOneSided, params=list(target=100),covprob=c(0.7,0.9)) ##calibrate to a hitting probability of 0.01 in 100 steps SPCproperty(data=X,nrep=500, property="calhitprob", chart=chartShew,params=list(target=0.01,nsteps=100)) SPCproperty(data=X,nrep=500, property="calhitprob",chart=chartShewOneSided,params=list(target=0.01,nsteps=100)) ## work out for ARL for a fixed threshold of 4 SPCproperty(data=X,nrep=500, property="ARL",chart=chartShew,params=list(threshold=4)) SPCproperty(data=X,nrep=500, property="ARL",chart=chartShewOneSided, params=list(threshold=4)) SPCproperty(data=X,nrep=500, property="hitprob",chart=chartShew,params=list(nsteps=100,threshold=4)) SPCproperty(data=X,nrep=500, property="hitprob",chart=chartShewOneSided,params=list(nsteps=100,threshold=4)) ## End(Not run) X<-rnorm(100) chartShew <- new("SPCShew",model=SPCModelNormal()) ## Not run: SPCproperty(data=X,nrep=500, property="calARL", chart=chartShew, params=list(target=1000)) SPCproperty(data=X,nrep=500, property="calhitprob",chart=chartShew, params=list(target=0.01,nsteps=100)) SPCproperty(data=X,nrep=10,chart=chartShew, property="ARL",params=list(threshold=3)) SPCproperty(data=X,nrep=500, property="hitprob", chart=chartShew,params=list(nsteps=100,threshold=4)) ## End(Not run)
X<-rnorm(100); ##calibrate to ARL 100 chartShew <- new("SPCShew",model=SPCModelNormal(),twosided=TRUE) ## Not run: SPCproperty(data=X,nrep=500, property="calARL",chart=chartShew,params=list(target=100), covprob=c(0.7,0.9)) chartShewOneSided <- new("SPCShew",model=SPCModelNormal(),twosided=FALSE) SPCproperty(data=X,nrep=500, property="calARL",chart=chartShewOneSided, params=list(target=100),covprob=c(0.7,0.9)) ##calibrate to a hitting probability of 0.01 in 100 steps SPCproperty(data=X,nrep=500, property="calhitprob", chart=chartShew,params=list(target=0.01,nsteps=100)) SPCproperty(data=X,nrep=500, property="calhitprob",chart=chartShewOneSided,params=list(target=0.01,nsteps=100)) ## work out for ARL for a fixed threshold of 4 SPCproperty(data=X,nrep=500, property="ARL",chart=chartShew,params=list(threshold=4)) SPCproperty(data=X,nrep=500, property="ARL",chart=chartShewOneSided, params=list(threshold=4)) SPCproperty(data=X,nrep=500, property="hitprob",chart=chartShew,params=list(nsteps=100,threshold=4)) SPCproperty(data=X,nrep=500, property="hitprob",chart=chartShewOneSided,params=list(nsteps=100,threshold=4)) ## End(Not run) X<-rnorm(100) chartShew <- new("SPCShew",model=SPCModelNormal()) ## Not run: SPCproperty(data=X,nrep=500, property="calARL", chart=chartShew, params=list(target=1000)) SPCproperty(data=X,nrep=500, property="calhitprob",chart=chartShew, params=list(target=0.01,nsteps=100)) SPCproperty(data=X,nrep=10,chart=chartShew, property="ARL",params=list(threshold=3)) SPCproperty(data=X,nrep=500, property="hitprob", chart=chartShew,params=list(nsteps=100,threshold=4)) ## End(Not run)
Computes updates of a control chart using the given parameters and the given data.
updates(chart, xi, data) ## S4 method for signature 'SPCchart' updates(chart, xi, data) ## S4 method for signature 'SPCShew' updates(chart, xi, data)
updates(chart, xi, data) ## S4 method for signature 'SPCchart' updates(chart, xi, data) ## S4 method for signature 'SPCShew' updates(chart, xi, data)
chart |
the control chart. |
xi |
the parameters used for running the chart. |
data |
the observed data. |
A vector of the same length as data.
SPCchart
: Standard method which simply first applies
getresiduals from the data model.
SPCShew
: Computes the updates taking into account if the
chart is one-sided or two-sided.
Estimates the parameters used to run a control chart from given data.
xiofdata(chart, data) ## S4 method for signature 'SPCchart' xiofdata(chart, data)
xiofdata(chart, data) ## S4 method for signature 'SPCchart' xiofdata(chart, data)
chart |
the control chart to be used. |
data |
the data to be used. |
The parameter values for running the control chart chart
.
SPCchart
: Standard method which simply first applies
PofData to get a model and then xiofP to get the parameters.