Return something similar to a contrast matrix for a categorical covariate that we wish to be monotonically non-decreasing in a specified order.
1 2 3
a vector of levels for a factor, or the number of levels.
a permutation of the levels of
a logical indicating whether constrasts should be computed.
included for compatibility reasons. Has no effect.
contr.isotonic is used in creating the design matrix
for categorical covariates with a specified order under a
particular parameterisation. For Poisson and negative binomial models, this
occurs if a categorical covariate is defined as monotonic;
for binomial models, each parameterisation defines a
permutation of the levels that must be monotonically
For overparameterised binomial models, the design matrix for
categorical covariates must include isotonic-style dummy
covariates for every possible permutation of the levels. This
is the function of
In the order specified by
perm, the coefficient
associated with each level is the sum of increments between
the preceding levels. That is, the first level is defined
as 0, the second as 0 + d_2, the third as 0 + d_2 + d_3, and
so on. In fitting the model, these increments are
constrained to be non-negative.
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
A matrix with
n rows and
k columns, with
Mark W. Donoghoe email@example.com
1 2 3 4 5 6 7 8
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.