Learn R Programming

spcadjust (version 1.1)

SPCModellm: Data model based on a linear model

Description

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

Usage

SPCModellm(formula, Delta = 0)

Arguments

formula
the linear model specified as a formula.
Delta
Object of class "numeric".

Examples

Run this code
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.

Run the code above in your browser using DataLab