The Nelson rules for control charts describe patterns, which are "special" and need our attention. One of these rules is the "alternation rule". According to Nelson it is "unusual" to obtain a series of 14 alternating points -- direction does not matter.
I tried to simulate the probability of such an event using a normal distribution. Here my code:
nSim = 1e6
count = 0
n = 14
iVec1 = seq(1, n, by=2)
iVec2 = iVec1 + 1
for (i in 1:nSim){
tmp = rnorm(n)
sumSide = sum( tmp[iVec1] > tmp[iVec2] )
if ( sumSide >= round(n/2) ){
count = count + 1
} else if ( sumSide == 0 ){
count = count + 1
}
}
print(100*count/nSim)
which yields a probability close to 1.5%. However, the analytic result yields a probability around 0.45%, which is approx. a factor three off. Is this an artefact of the non-true randomness of the used random numbers?