Function mapindex() maps the 1-d index r=1,...,N to 2-d
index i=1, ...a, j=1, ..., ni. Generally the covariate values
from all treatments are stored together in one vector and
r=1,...,N enumerates the values. For any integer between 1 and N,
mapindex tells which treatment the rth value belongs to, and which
observation in the identified treatment.