This function is used in creating the design matrix
for categorical covariates with a specified order under a
particular parameterisation. This is required
if a categorical covariate is defined as monotonic.
In the order specified by perm
, the coefficient
associated with each level is the sum of increments between
the following levels. That is, if there are a total of \(k\)
levels, the first level is defined as \(d_2 + d_3 + d_4 + \cdots + d_k\),
the second as \(d_3 + d_4 + \cdots + d_k\),
the third as \(d_4 + \cdots + d_k\), and so on. In fitting the model,
these increments are constrained to be non-positive.
Note that these are not `contrasts' as defined in the
theory for linear models, rather this is used to define the
contrasts
attribute of each variable so that
model.matrix
produces the desired design
matrix.