if (FALSE) {
# Create some data
dataA1 <- mspProcessData(faults = "B1")
traindataA1 <- dataA1[1:8567,]
# Train on the data that should be in control
trainResults <- mspTrain(traindataA1[,-1], traindataA1[,1], trainObs = 4320)
# Lag an out of control observation
testdataA1 <- dataA1[8567:8568,-1]
testdataA1 <- lag.xts(testdataA1,0:1)
testdataA1 <- testdataA1[-1,]
testdataA1 <- cbind(dataA1[8568,1],testdataA1)
# Monitor this observation
monitorResults <- mspMonitor(observations = testdataA1[,-1],
labelVector = testdataA1[,1],
trainingSummary = trainResults$TrainingSpecs)
tD <- traindataA1[,-1]
tL <- traindataA1[,1]
nD <- testdataA1[,-1]
nL <- testdataA1[,1]
tO <- trainObs
vA <- 0.95
nSPE <- monitorResults$SPE
tSPE <- trainResults$TrainingSpecs[[nL]]$SPE
mspSPEPlot(tD,tL,tSPE,nD,nL,nSPE,tO,vA)
}
Run the code above in your browser using DataLab