contr.sdif               package:MASS               R Documentation

Successive Differences contrast coding

Description:

     A coding for unordered factors based on successive differences.

Usage:

     contr.sdif(n, contrasts = TRUE)

Arguments:

       n: The number of levels required. 

contrasts: Should there be 'n - 1' columns orthogonal to the mean (the
          default) or 'n' columns spanning the space. 

Details:

     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.

Value:

     If 'contrasts is' 'TRUE', a matrix with 'n' rows and 'n - 1'
     columns, and the 'n' by 'n' identity matrix if 'contrasts' is
     'FALSE'.

References:

     Venables, W. N. and Ripley, B. D. (2002) _Modern Applied
     Statistics with S._ Fourth Edition, Springer.

See Also:

     'contr.treatment', 'contr.sum', 'contr.helmert'

Examples:

     contr.sdif(6)

