contr.SAS {nlme} | R Documentation |
Return a matrix of contrasts corresponding to the parameterization for a factor used in SAS.
contr.SAS(n, contrasts=TRUE)
n |
a vector of levels for a factor, or the number of levels. |
contrasts |
a logical indicating whether contrasts should be computed. |
This function is used for creating contrast matrices for use in
fitting analysis of variance and regression models. The columns of
the resulting matrix contain contrasts which can be used for coding
a factor with n
levels. The returned value contains the
computed contrasts. If the argument contrasts
is FALSE
then a square indicator matrix is returned.
These contrasts are similar to those from contr.treatment
except that they represent shifts relative to the last level of the
factor, not the first level. This generates the same parameterization for a
linear model as is used in SAS (see http://www.sas.com).
A matrix with n
rows and k
columns, with k=n-1
if
contrasts
is TRUE
and k=n
if contrasts
is
FALSE
.
Jose Pinheiro jcp@research.bell-labs.com, Douglas Bates bates@stat.wisc.edu
contr.SAS(4)