Return a matrix of contrasts for factor coding.
1 2 3 4 5
A vector of levels for a factor, or the number of levels.
These functions are used for creating contrast matrices for use in
fitting regression models. The columns of the
resulting matrices contain contrasts which can be used for coding a
contr.cum gives a coding corresponding to successive differences
between factor levels.
contr.diff gives a coding that correspond to the cumulative sum
of the value for each level. This is not meaningful in a model where the
intercept is included, therefore
n columns ia always returned.
contr.2nd gives contrasts corresponding to 2nd order differences
between factor levels. Returns a matrix with
contr.orth gives a matrix with
n-2 columns, which are
mutually orthogonal and orthogonal to the matrix
A matrix with
n rows and
k columns, with
1 2 3 4 5
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.