3

At my work we do a lot of control charts for n variables for monitoring multivariate measurement processes. I am trying to implement Hotelling multivariate control charts so we can consider the correlation between variables and assess when a sample has gone out-of-control. The package MSQC has the function mult.chart to achieve this easily. The function returns some information about the data, the plot of the control chart including limits and additionally, when a sample has gone out-of-control, it decomposes it so is possible to determine which variable (or variables) are the responsible for the shift and the information is given as a list. I cannot to determine how to extract that information since the structure of the return does not follow the traditional form of name_of_data_frame$name_of_variable_of_interest, at leasts for the decomposition matrix.

library(MSQC)

data("carbon1")
Xmv <- mult.chart(carbon1, type = "t2") $Xmv
S <- mult.chart(carbon1, type = "t2") $covariance
colm<-nrow(carbon1)
#Phase II
data("carbon2")
Hot<-mult.chart(carbon2, type = "t2", Xmv = Xmv, S = S, colm = colm)

The following(s) point(s) fall outside of the control limits[1] 4

$`Decomposition of`
[1] 4

I tried str(Hot) but the part of $`Decomposition of` does not appear. How can I get this kind of information?

Edgar Santos
  • 3,426
  • 2
  • 17
  • 29
Cris
  • 325
  • 1
  • 5
  • 20

1 Answers1

2

The decomposition of the test statistic (T2) is not included ATM in the output of the mult.chart. I will include it in the next update. One way of working around it is using:

library(MSQC)
data("carbon1") # dataset used in Phase I
Xmv <- mult.chart(carbon1, type = "t2") $Xmv
S <- mult.chart(carbon1, type = "t2") $covariance
colm<-nrow(carbon1)

#Phase II
data("carbon2")

co <- capture.output(Hot<-mult.chart(carbon2, type = "t2", Xmv = Xmv, S = S, colm = colm))
write(co[5:length(co)], "C:\\1\\decomp.txt") # saving it 
df <- read.table("C:\\1\\decomp.txt", sep = "", header = F)

Hope it helps.

Edgar Santos
  • 3,426
  • 2
  • 17
  • 29
  • 1
    That is a very elegant solution. Thanks, As creating new tags is a privilege that I do not have yet but think that _MSQC_ should be included, could you please create it for us? – Cris Jan 29 '18 at 13:09
  • 1
    thanks. Just added the tags MSQC and control charts. – Edgar Santos Jan 29 '18 at 20:29