# Chi Square Test for QC Samples

An analytical procedure is run for 112 consecutive days. Each day, the analyses are run in four batches in order -- Batch-1, Batch-2, etc. In each batch is a QC sample, labeled QC1, QC2, etc. The following R code generates a contingency table for the data, showing the number of times each QC sample was a particular rank. For example, QC1 had the highest result 43 days out of 112 and QC4 had the lowest result 28 days out of 112. The analyst has the feeling that the first batch of the day tends to have the highest results. What statistical test should I use to check out whether or not the ranks of the QC samples are random from day to day? I understand that I should not use a chi-square test of independence between the QC sample and the ranks, but why not?

count <- c(43,26,26,17,24,33,28,27,18,27,27,40,27,26,31,28)
mat.obs <- matrix(count,nrow=4,byrow=TRUE)
rownames(mat.obs) <- c("QC1","QC2","QC3","QC4")
colnames(mat.obs) <- c("1","2","3","4")
mat.obs

• I think that this feeling comes from the fact that given the way your 4×4 matrix is generated, all rows and all columns sum to 112. This is definitely not a classical contingency table. Commented Dec 5, 2012 at 23:14
• The table was generated after the analyst expressed the gut feeling about the QC samples, and if nothing else it is a concise way of presenting the results for discussion.
– Tom
Commented Dec 6, 2012 at 11:56
• I think the table is fine. I just point out what makes it special... I'll try to propose an answer later. Commented Dec 6, 2012 at 12:16