contr.sdif | R Documentation |
A coding for factors based on successive differences.
contr.sdif(n, contrasts = TRUE, sparse = FALSE)
n |
The number of levels required. |
contrasts |
logical: Should there be |
sparse |
logical. If true and the result would be sparse (only
true for |
The contrast coefficients are chosen so that the coded coefficients in a one-way layout are the differences between the means of the second and first levels, the third and second levels, and so on. This makes most sense for ordered factors, but does not assume that the levels are equally spaced.
If contrasts
is TRUE
, a matrix with n
rows and
n - 1
columns, and the n
by n
identity matrix if
contrasts
is FALSE
.
Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth Edition, Springer.
contr.treatment
, contr.sum
,
contr.helmert
.
(A <- contr.sdif(6))
zapsmall(ginv(A))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.