Create a combining matrix
combMat(K, l1, l2)
The original number of classes: the matrix will define a combining from K to (K-1) classes.
Label of one of the two classes to be combined.
Label of the other class to be combined.
z is a vector (length K) whose kth entry is the probability that an observation belongs to the kth class in a K-classes classification, then
combiM %*% z is the vector (length K-1) whose kth entry is the probability that the observation belongs to the kth class in the K-1-classes classification obtained by merging classes
l2 in the initial classification.
J.-P. Baudry, A. E. Raftery, L. Scrucca